Restarting Chart Spaace when new workspace is loaded

This commit is contained in:
Luis Fernando Molina committed 2019-12-05 12:51:01 +01:00
1 parent be8b12a19c
commit fafe5b8d02
7 files changed
+118 -79

No files matched your search

+22 -13
View File
@@ -28,17 +28,6 @@ function newTimeMachine () {
finalize: finalize
}
thisObject.container = newContainer()
thisObject.container.initialize(MODULE_NAME)
thisObject.container.isDraggeable = false
thisObject.container.detectMouseOver = true
thisObject.container.frame.width = TIME_MACHINE_WIDTH
thisObject.container.frame.height = TIME_MACHINE_HEIGHT
thisObject.container.frame.position.x = browserCanvas.width / 2 - TIME_MACHINE_WIDTH / 2
thisObject.container.frame.position.y = browserCanvas.height / 2 - TIME_MACHINE_HEIGHT / 2
let controlPanelHandle // We need this to destroy the Panel when this object is itself destroyed or no longer needs it...
// ... also to request a reference to the object for the cases we need it.
const SEPARATION_BETWEEN_TIMELINE_CHARTS = 1.5
@@ -52,21 +41,38 @@ function newTimeMachine () {
}
}
setupContainer()
return thisObject
function setupContainer () {
thisObject.container = newContainer()
thisObject.container.initialize(MODULE_NAME)
thisObject.container.isDraggeable = false
thisObject.container.detectMouseOver = true
thisObject.container.frame.width = TIME_MACHINE_WIDTH
thisObject.container.frame.height = TIME_MACHINE_HEIGHT
thisObject.container.frame.position.x = browserCanvas.width / 2 - TIME_MACHINE_WIDTH / 2
thisObject.container.frame.position.y = browserCanvas.height / 2 - TIME_MACHINE_HEIGHT / 2
}
function finalize () {
for (let i = 0; i < thisObject.charts.length; i++) {
let chart = thisObject.charts[i]
chart.finalize()
}
thisObject.container.finalize()
thisObject.container = undefined
thisObject.charts = []
thisObject.timeScale.finalize()
thisObject.timeScale = undefined
thisObject.rateScale.finalize()
thisObject.rateScale = undefined
thisObject.fitFunction = undefined
thisObject.container.finalize()
thisObject.container = undefined
setupContainer()
}
function initialize (callBackFunction) {
@@ -261,6 +267,9 @@ function newTimeMachine () {
}
function childrenPhysics () {
if (thisObject.timeScale === undefined) { return }
if (thisObject.rateScale === undefined) { return }
thisObject.timeScale.physics()
thisObject.rateScale.physics()