From 8962e062207ee499f3758c5207cc8d31b933fa48 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 3 Oct 2018 10:54:23 +0200 Subject: [PATCH] Play button at the bottom --- {TopSpace => BottomSpace}/PlayStopButton.js | 12 +++++++----- Panels/TimeControlPanel.js | 6 +++--- Project.njsproj | 2 +- Scripts/AppLoader.js | 2 +- Spaces/BottomSpace.js | 7 +++++++ Spaces/TopSpace.js | 8 -------- 6 files changed, 19 insertions(+), 18 deletions(-) rename {TopSpace => BottomSpace}/PlayStopButton.js (91%) diff --git a/TopSpace/PlayStopButton.js b/BottomSpace/PlayStopButton.js similarity index 91% rename from TopSpace/PlayStopButton.js rename to BottomSpace/PlayStopButton.js index af6e58926..960b96d21 100644 --- a/TopSpace/PlayStopButton.js +++ b/BottomSpace/PlayStopButton.js @@ -16,8 +16,8 @@ function newPlayStopButton() { thisObject.container.frame.width = 50; thisObject.container.frame.height = TOP_SPACE_HEIGHT; - container.frame.position.x = viewPort.visibleArea.topRight.x; - container.frame.position.y = 0; + container.frame.position.x = (viewPort.visibleArea.topRight.x - viewPort.visibleArea.topLeft.x) / 2 - 10; + container.frame.position.y = viewPort.visibleArea.bottomLeft.y; container.isDraggeable = false; container.isClickeable = true; @@ -126,14 +126,16 @@ function newPlayStopButton() { thisObject.container.frame.draw(false, false); + let breakpointsHeight = 15; + if (canDraw === false) { return; } - let imageHeight = 15; - let imageWidth = 15; + let imageHeight = 20; + let imageWidth = 20; let imagePoint = { x: thisObject.container.frame.width / 2 - imageWidth / 2, - y: thisObject.container.frame.height / 2 - imageHeight / 2 + y: thisObject.container.frame.height / 2 - imageHeight / 2 + breakpointsHeight }; imagePoint = thisObject.container.frame.frameThisPoint(imagePoint); diff --git a/Panels/TimeControlPanel.js b/Panels/TimeControlPanel.js index 22b4302d1..a5191f5f7 100644 --- a/Panels/TimeControlPanel.js +++ b/Panels/TimeControlPanel.js @@ -50,8 +50,8 @@ function newTimeControlPanel() { /* Here we will listen to the event when time was changed due to a Bot Execution. */ - canvas.topSpace.playStopButton.container.eventHandler.listenToEvent("Bot Execution Changed Datetime", onBotChangedTime); - canvas.topSpace.playStopButton.setDatetime(datetime); + canvas.bottomSpace.playStopButton.container.eventHandler.listenToEvent("Bot Execution Changed Datetime", onBotChangedTime); + canvas.bottomSpace.playStopButton.setDatetime(datetime); viewPort.eventHandler.listenToEvent("Zoom Changed", onZoomChanged); timePeriod = INITIAL_TIME_PERIOD; @@ -95,7 +95,7 @@ function newTimeControlPanel() { function setDatetime(pDatetime) { thisObject.datetimeDisplay.currentDatetime = new Date(pDatetime); - canvas.topSpace.playStopButton.setDatetime(pDatetime); + canvas.bottomSpace.playStopButton.setDatetime(pDatetime); } function addTime(seconds) { diff --git a/Project.njsproj b/Project.njsproj index 3117f769c..570516c25 100644 --- a/Project.njsproj +++ b/Project.njsproj @@ -146,7 +146,7 @@ Code - + Code diff --git a/Scripts/AppLoader.js b/Scripts/AppLoader.js index 9542f03e6..70cca27d6 100644 --- a/Scripts/AppLoader.js +++ b/Scripts/AppLoader.js @@ -34,8 +34,8 @@ "BottomSpace/UsersModule.js", "BottomSpace/TeamsModule.js", "BottomSpace/KeyVaultModule.js", + "BottomSpace/PlayStopButton.js", - "TopSpace/PlayStopButton.js", "TopSpace/CompanyLogo.js", "TopSpace/CurrentStartMode.js", "TopSpace/CurrentProcess.js", diff --git a/Spaces/BottomSpace.js b/Spaces/BottomSpace.js index 38f3eb950..e2978ce52 100644 --- a/Spaces/BottomSpace.js +++ b/Spaces/BottomSpace.js @@ -7,6 +7,7 @@ function newBottomSpace() { UsersModule: undefined, TeamsModule: undefined, KeyVaultModule: undefined, + playStopButton: undefined, container: undefined, draw: draw, getContainer: getContainer, // returns the inner most container that holds the point received by parameter. @@ -44,6 +45,8 @@ function newBottomSpace() { thisObject.KeyVaultModule = newKeyVaultModule(); thisObject.KeyVaultModule.initialize(); + thisObject.playStopButton = newPlayStopButton(); + thisObject.playStopButton.initialize(); } function getContainer(point) { @@ -65,6 +68,9 @@ function newBottomSpace() { container = thisObject.KeyVaultModule.getContainer(point); if (container !== undefined) { return container; } + container = thisObject.playStopButton.getContainer(point); + if (container !== undefined) { return container; } + /* The point does not belong to any inner container, so we return the current container. */ return thisObject.container; @@ -81,6 +87,7 @@ function newBottomSpace() { thisObject.UsersModule.draw(); thisObject.TeamsModule.draw(); thisObject.KeyVaultModule.draw(); + thisObject.playStopButton.draw(); } diff --git a/Spaces/TopSpace.js b/Spaces/TopSpace.js index f259a5f99..5c11128dc 100644 --- a/Spaces/TopSpace.js +++ b/Spaces/TopSpace.js @@ -12,7 +12,6 @@ function newTopSpace() { currentProcess: undefined, currentStartMode: undefined, login: undefined, - playStopButton: undefined, initialize: initialize }; @@ -61,9 +60,6 @@ function newTopSpace() { thisObject.login = newLogin(); thisObject.login.initialize(); - thisObject.playStopButton = newPlayStopButton(); - thisObject.playStopButton.initialize(); - } function getContainer(point) { @@ -91,9 +87,6 @@ function newTopSpace() { container = thisObject.login.getContainer(point); if (container !== undefined) { return container; } - container = thisObject.playStopButton.getContainer(point); - if (container !== undefined) { return container; } - /* The point does not belong to any inner container, so we return the current container. */ return thisObject.container; @@ -112,7 +105,6 @@ function newTopSpace() { thisObject.currentProcess.draw(); thisObject.currentStartMode.draw(); thisObject.login.draw(); - thisObject.playStopButton.draw(); }