diff --git a/ChartsSpace/TimeMachine.js b/ChartsSpace/TimeMachine.js index 5ff5de51e..107f09648 100644 --- a/ChartsSpace/TimeMachine.js +++ b/ChartsSpace/TimeMachine.js @@ -77,8 +77,9 @@ function newTimeMachine () { thisObject.container.eventHandler.stopListening(onMouseNotOverEventSuscriptionId) for (let i = 0; i < thisObject.timelineCharts.length; i++) { - let chart = thisObject.timelineCharts[i] - chart.finalize() + let timelineChart = thisObject.timelineCharts[i] + timelineChart.container.eventHandler.stopListening(timelineChart.onChildrenMouseOverEventSuscriptionId) + timelineChart.finalize() } thisObject.timelineCharts = undefined @@ -276,6 +277,7 @@ function newTimeMachine () { let timelineChart = thisObject.timelineCharts[i] if (timelineChart.syncWithDesignerLoop < syncWithDesignerLoop) { /* Must be removed */ + timelineChart.container.eventHandler.stopListening(timelineChart.onChildrenMouseOverEventSuscriptionId) timelineChart.finalize() timelineChartsMap.delete(timelineChart.nodeId) thisObject.timelineCharts.splice(i, 1) @@ -300,6 +302,13 @@ function newTimeMachine () { timelineChart.container.frame.position.y = 0 timelineChart.initialize(DEFAULT_EXCHANGE, DEFAULT_MARKET, timeLineCoordinateSystem, onTimelineChartInitialized) + /* we will store the event suscription id as a property of the timelineChart, to avoid keeping it an a separate array */ + timelineChart.onChildrenMouseOverEventSuscriptionId = timelineChart.container.eventHandler.listenToEvent('onChildrenMouseOver', onChildrenMouseOver) + + function onChildrenMouseOver (event) { + thisObject.container.eventHandler.raiseEvent('onMouseOver', event) + } + function onTimelineChartInitialized (err) { if (err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) { if (ERROR_LOG === true) { logger.write('[ERROR] syncWithDesigner -> initializeTimelineChart -> Initialization Failed. -> Err ' + err.message) } diff --git a/ChartsSpace/TimelineChart.js b/ChartsSpace/TimelineChart.js index 0eb9022dd..7e68224e4 100644 --- a/ChartsSpace/TimelineChart.js +++ b/ChartsSpace/TimelineChart.js @@ -178,6 +178,7 @@ function newTimelineChart () { onMouseOverEventSuscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseOver', onMouseOver) function onMouseOver (event) { + /* This event gets to the timelinechart container because it inherits it from the time machine container, which is the one raising Mouse Over and Mouse not Over Events to its children. */ if (thisObject.timeFrameScale !== undefined) { thisObject.timeFrameScale.visible = true thisObject.timeFrameScale.onMouseOverSomeTimeMachineContainer(event) @@ -225,8 +226,7 @@ function newTimelineChart () { timeFrameScaleMouseOverEventSuscriptionId = thisObject.timeFrameScale.container.eventHandler.listenToEvent('onMouseOver', timeFrameScaleMouseOver) function timeFrameScaleMouseOver (event) { - mouse.position.x = event.x - mouse.position.y = event.y + thisObject.container.eventHandler.raiseEvent('onChildrenMouseOver', event) saveUserPosition(thisObject.container, timeLineCoordinateSystem, event) } diff --git a/Scales/TimeScale.js b/Scales/TimeScale.js index 9bd8a5372..30713d73c 100644 --- a/Scales/TimeScale.js +++ b/Scales/TimeScale.js @@ -17,7 +17,7 @@ function newTimeScale () { } const LENGHT_PERCENTAGE_DEFAULT_VALUE = 5 - const STEP_SIZE = 2.5 + const STEP_SIZE = 1 thisObject.container = newContainer() thisObject.container.initialize(MODULE_NAME)