From 16fb5edd0a44c745428f96b3ce8a3d9be100767a Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 10 May 2019 14:37:19 +0200 Subject: [PATCH] Problem with scales not appearing fixed --- Spaces/ChartSpace.js | 50 ++++++++++++++++++++++---------------------- TimeMachine.js | 44 +++++++++++++++++++------------------- 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/Spaces/ChartSpace.js b/Spaces/ChartSpace.js index 8fce84ab3..5e0c6a3f7 100644 --- a/Spaces/ChartSpace.js +++ b/Spaces/ChartSpace.js @@ -58,8 +58,8 @@ function newChartSpace () { /* We make the time machine a little bit smaller than the current space. */ - timeMachine.container.frame.position.x = this.container.frame.width / 2 - timeMachine.container.frame.width / 2 - timeMachine.container.frame.position.y = this.container.frame.height / 2 - timeMachine.container.frame.height / 2 + timeMachine.container.frame.position.x = thisObject.container.frame.width / 2 - timeMachine.container.frame.width / 2 + timeMachine.container.frame.position.y = thisObject.container.frame.height / 2 - timeMachine.container.frame.height / 2 timeMachine.initialize(onTimeMachineInitialized) @@ -83,6 +83,29 @@ function newChartSpace () { } } + function getContainer (point, purpose) { + if (thisObject.visible !== true) { return } + + let container + + /* Now we see which is the inner most container that has it */ + + for (let i = 0; i < thisObject.timeMachines.length; i++) { + container = thisObject.timeMachines[i].getContainer(point, purpose) + if (container !== undefined) { + if (container.isForThisPurpose(purpose)) { + return container + } + } + } + + if (thisObject.container.frame.isThisPointHere(point, true) === true) { + return thisObject.container + } else { + return undefined + } + } + function fitIntoVisibleArea (point) { /* Here we check the boundaries of the resulting points, so they dont go out of the visible area. */ @@ -162,28 +185,5 @@ function newChartSpace () { timeMachine.draw() } } - - function getContainer (point, purpose) { - if (thisObject.visible !== true) { return } - - let container - - /* Now we see which is the inner most container that has it */ - - for (let i = 0; i < this.timeMachines.length; i++) { - container = this.timeMachines[i].getContainer(point, purpose) - if (container !== undefined) { - if (container.isForThisPurpose(purpose)) { - return container - } - } - } - - if (thisObject.container.frame.isThisPointHere(point, true) === true) { - return thisObject.container - } else { - return undefined - } - } } diff --git a/TimeMachine.js b/TimeMachine.js index 642ed2387..ab58e874f 100644 --- a/TimeMachine.js +++ b/TimeMachine.js @@ -186,27 +186,6 @@ function newTimeMachine () { } } - function drawBackground () { - for (let i = 0; i < this.charts.length; i++) { - let chart = this.charts[i] - chart.drawBackground() - } - } - - function draw () { - if (thisObject.container.frame.isInViewPort()) { - for (let i = 0; i < this.charts.length; i++) { - let chart = this.charts[i] - chart.draw() - } - - if (timeScale !== undefined) { timeScale.draw() } - if (rigthScale !== undefined) { rigthScale.draw() } - - // thisObject.container.frame.draw(false, true, false) - } - } - function getContainer (point, purpose) { let container @@ -237,7 +216,7 @@ function newTimeMachine () { } } - if (thisObject.container.frame.isThisPointHere(point, true) === true) { + if (thisObject.container.frame.isThisPointHere(point) === true) { return thisObject.container } else { if (purpose === GET_CONTAINER_PURPOSE.MOUSE_OVER) { @@ -247,6 +226,27 @@ function newTimeMachine () { } } + function drawBackground () { + for (let i = 0; i < this.charts.length; i++) { + let chart = this.charts[i] + chart.drawBackground() + } + } + + function draw () { + if (thisObject.container.frame.isInViewPort()) { + for (let i = 0; i < this.charts.length; i++) { + let chart = this.charts[i] + chart.draw() + } + + if (timeScale !== undefined) { timeScale.draw() } + if (rigthScale !== undefined) { rigthScale.draw() } + + // thisObject.container.frame.draw(false, true, false) + } + } + function recalculateScale () { if (INFO_LOG === true) { logger.write('[INFO] recalculateScale -> Entering function.') }