From 3b6e1e216e666d8cee23f993757ffc592a4b8ac0 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 24 Mar 2020 21:06:20 +0100 Subject: [PATCH] Bug fixes --- AppSchema.json | 6 +++--- CanvasApp/ChartingSpace/CoordinateSystem.js | 4 ++++ CanvasApp/ChartingSpace/TimelineChart.js | 12 ++++++++++++ CanvasApp/ChartingSpace/Viewport.js | 8 ++++---- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/AppSchema.json b/AppSchema.json index 7fa02e51a..43e3d4217 100644 --- a/AppSchema.json +++ b/AppSchema.json @@ -806,7 +806,7 @@ { "action": "Add UI Object", "disableIfPropertyIsDefined": true, - "propertyToCheckFor": "code", + "propertyToCheckFor": "javascriptCode", "label": "Add Code", "relatedUiObject": "Javascript Code", "actionFunction": "payload.onMenuItemClick" @@ -3305,7 +3305,7 @@ { "action": "Add UI Object", "disableIfPropertyIsDefined": true, - "propertyToCheckFor": "code", + "propertyToCheckFor": "javascriptCode", "label": "Add Code", "relatedUiObject": "Javascript Code", "actionFunction": "payload.onMenuItemClick" @@ -3343,7 +3343,7 @@ { "action": "Add UI Object", "disableIfPropertyIsDefined": true, - "propertyToCheckFor": "code", + "propertyToCheckFor": "javascriptCode", "label": "Add Code", "relatedUiObject": "Javascript Code", "actionFunction": "payload.onMenuItemClick" diff --git a/CanvasApp/ChartingSpace/CoordinateSystem.js b/CanvasApp/ChartingSpace/CoordinateSystem.js index 4fbfc24bd..4e28a1716 100644 --- a/CanvasApp/ChartingSpace/CoordinateSystem.js +++ b/CanvasApp/ChartingSpace/CoordinateSystem.js @@ -105,6 +105,10 @@ function newCoordinateSystem () { /* Reseting this to start over at each cycle. */ noXValueReported = true + + if (mustRecalculate === true) { + thisObject.eventHandler.raiseEvent('X-Range Changed') + } } if ((thisObject.autoMinYScale === true || thisObject.autoMaxYScale === true) && noYValueReported === false) { diff --git a/CanvasApp/ChartingSpace/TimelineChart.js b/CanvasApp/ChartingSpace/TimelineChart.js index f827726c0..44e96a02a 100644 --- a/CanvasApp/ChartingSpace/TimelineChart.js +++ b/CanvasApp/ChartingSpace/TimelineChart.js @@ -43,6 +43,7 @@ function newTimelineChart () { let timeFrameScaleEventSuscriptionId let timeFrameScaleMouseOverEventSuscriptionId let scaleChangedEventSubscriptionId + let xRangeChangedEventSubscriptionId let drawScales = false let mouse = { @@ -63,6 +64,7 @@ function newTimelineChart () { function finalize () { coordinateSystem.eventHandler.stopListening(scaleChangedEventSubscriptionId) + timelineChartCoordinateSystem.eventHandler.stopListening(xRangeChangedEventSubscriptionId) if (thisObject.layersManager !== undefined) { finalizeLayersManager() @@ -145,6 +147,7 @@ function newTimelineChart () { onMouseOverEventSuscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseOver', onMouseOver) onMouseNotOverEventSuscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseNotOver', onMouseNotOver) scaleChangedEventSubscriptionId = timeMachineCoordinateSystem.eventHandler.listenToEvent('Scale Changed', onScaleChanged) + xRangeChangedEventSubscriptionId = timelineChartCoordinateSystem.eventHandler.listenToEvent('X-Range Changed', xRangeChanged) } function initializeCoordinateSystem () { @@ -231,6 +234,15 @@ function newTimelineChart () { } } + function xRangeChanged (event) { + if (thisObject.rateScale !== undefined) { + /* We need to re trasmit the changes on the x Range of the timelinechart coordinate system to the time machine coordinate system so that its scale is syncronized. */ + timeMachineCoordinateSystem.min.x = timelineChartCoordinateSystem.min.x + timeMachineCoordinateSystem.max.x = timelineChartCoordinateSystem.max.x + timeMachineCoordinateSystem.recalculateScale() + } + } + function onScaleChanged (event) { if (thisObject.rateScale !== undefined) { thisObject.rateScale.onUpstreamScaleChanged(event) diff --git a/CanvasApp/ChartingSpace/Viewport.js b/CanvasApp/ChartingSpace/Viewport.js index 27f59ef1c..d51df170b 100644 --- a/CanvasApp/ChartingSpace/Viewport.js +++ b/CanvasApp/ChartingSpace/Viewport.js @@ -61,7 +61,7 @@ function newViewport () { /* Initial default value */ thisObject.zoomLevel = MIN_ZOOM_LEVEL - thisObject.zoomTargetLevel = MIN_ZOOM_LEVEL + thisObject.zoomTargetLevel = Math.round(MIN_ZOOM_LEVEL) INITIAL_TIME_PERIOD = recalculatePeriod(thisObject.zoomLevel) let overrideMousePositionCounter = 0 @@ -144,7 +144,7 @@ function newViewport () { } function zoomAtCenter (level) { - thisObject.zoomTargetLevel = level + thisObject.zoomTargetLevel = Math.round(level) overrideMousePositionCounter = 50 ANIMATION_INCREMENT = 0.5 } @@ -220,7 +220,7 @@ function newViewport () { if (thisObject.zoomTargetLevel + amount * morePower < MIN_ZOOM_LEVEL) { return false } - thisObject.zoomTargetLevel = Math.round((thisObject.zoomTargetLevel + amount * morePower) * MAC_AMOUNT_FACTOR) / MAC_AMOUNT_FACTOR + thisObject.zoomTargetLevel = Math.round(Math.round((thisObject.zoomTargetLevel + amount * morePower) * MAC_AMOUNT_FACTOR) / MAC_AMOUNT_FACTOR) ANIMATION_INCREMENT = Math.round(Math.abs(thisObject.zoomTargetLevel - thisObject.zoomLevel) / ANIMATION_STEPS * 100) / 100 @@ -398,7 +398,7 @@ function newViewport () { function newZoomLevel (level) { thisObject.zoomLevel = Math.round(level) - thisObject.zoomTargetLevel = level + thisObject.zoomTargetLevel = Math.round(level) INITIAL_TIME_PERIOD = recalculatePeriod(level) saveObjectState() ANIMATION_INCREMENT = 0