Bug Fixes

This commit is contained in:
Luis Fernando Molina committed 2020-09-16 12:51:09 +02:00
1 parent cb9b0ce904
commit 1daf5a583f
7 files changed
+66 -7

No files matched your search

+16
View File
@@ -142,6 +142,7 @@ function newTimeMachine() {
function initialize(callBackFunction) {
timeFrame = INITIAL_TIME_PERIOD
loadFrame(thisObject.payload, thisObject.container.frame)
setInitialPosition()
saveFrame(thisObject.payload, thisObject.container.frame)
recalculateCoordinateSystem()
@@ -158,6 +159,21 @@ function newTimeMachine() {
callBackFunction()
}
function setInitialPosition() {
let centerOfScreenX = browserCanvas.width / 2 - browserCanvas.width / TIME_MACHINE_WIDTH / 2
let centerOfScreenY = browserCanvas.height / 2 - (browserCanvas.height - TOP_SPACE_HEIGHT - COCKPIT_SPACE_HEIGHT) / TIME_MACHINE_HEIGHT / 2
if (thisObject.container.frame.position.x === 0 && thisObject.container.frame.position.y === 0) {
let timeMachineIndex = findChildIndexAtParentNode(thisObject.payload.node)
let dashboardIndex = findChildIndexAtParentNode(thisObject.payload.parentNode)
let timeMachinesCount = thisObject.payload.parentNode.timeMachines.length
let dashboardsCount = thisObject.payload.parentNode.payload.parentNode.dashboards.length
thisObject.container.frame.position.x = centerOfScreenX + thisObject.container.frame.width * timeMachineIndex * 2 - timeMachinesCount * thisObject.container.frame.width
thisObject.container.frame.position.y = centerOfScreenY + thisObject.container.frame.height * dashboardIndex * 2 - dashboardsCount * thisObject.container.frame.height
}
}
function onKeyPressed(event) {
thisObject.edgeEditor.onKeyPressed(event)
}