From 594e4851d8e1ba65aa469c9528dee87cfd179e13 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 11 Apr 2019 10:37:36 +0200 Subject: [PATCH] Rigth Scale added --- Scales/ChartGrid.js | 7 +++---- Scales/RightScale.js | 17 +++++++++++++++++ Scales/TimeScale.js | 17 ++++++++--------- TimeMachine.js | 4 ++++ 4 files changed, 32 insertions(+), 13 deletions(-) diff --git a/Scales/ChartGrid.js b/Scales/ChartGrid.js index cfa0f4304..86aa268ee 100644 --- a/Scales/ChartGrid.js +++ b/Scales/ChartGrid.js @@ -19,13 +19,10 @@ container.isDraggeable = false container.isClickeable = true - let rigthScale - return thisObject function initialize () { - rigthScale = newRigthScale() - rigthScale.initialize() + } function getContainer (point) { @@ -47,6 +44,8 @@ } function draw (container, timeLineCoordinateSystem) { + return // not for now + rightScaleBackground() leftScaleBackground() diff --git a/Scales/RightScale.js b/Scales/RightScale.js index ec5e4f7cb..67d3ac758 100644 --- a/Scales/RightScale.js +++ b/Scales/RightScale.js @@ -52,6 +52,23 @@ } function draw () { + drawBackground() + } + function drawBackground () { + const RIGHT_MARGIN = 50 + + /* We will paint some transparent background here. */ + + let opacity = '0.95' + + browserCanvasContext.beginPath() + + browserCanvasContext.rect(viewPort.visibleArea.topRight.x, viewPort.visibleArea.topRight.y, RIGHT_MARGIN, viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topRight.y) + browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', ' + opacity + ')' + + browserCanvasContext.closePath() + + browserCanvasContext.fill() } } diff --git a/Scales/TimeScale.js b/Scales/TimeScale.js index cbe523a25..7afaed0d6 100644 --- a/Scales/TimeScale.js +++ b/Scales/TimeScale.js @@ -16,19 +16,18 @@ function newTimeScale () { const RIGHT_MARGIN = 50 - let container = newContainer() - container.initialize(MODULE_NAME) - thisObject.container = container + thisObject.container = newContainer() + thisObject.container.initialize(MODULE_NAME) thisObject.container.frame.width = viewPort.visibleArea.bottomRight.x - viewPort.visibleArea.topLeft.x thisObject.container.frame.height = 100 - container.frame.position.x = viewPort.visibleArea.bottomRight.x - container.frame.position.y = TOP_SPACE_HEIGHT + thisObject.container.frame.position.x = viewPort.visibleArea.bottomRight.x + thisObject.container.frame.position.y = TOP_SPACE_HEIGHT - container.isDraggeable = false - container.isClickeable = false - container.isWheelable = true + thisObject.container.isDraggeable = false + thisObject.container.isClickeable = false + thisObject.container.isWheelable = true return thisObject @@ -55,7 +54,7 @@ function newTimeScale () { /* First we check if this point is inside this object UI. */ if (thisObject.container.frame.isThisPointHere(point, undefined, true) === true) { - return this.container + return thisObject.container } else { /* This point does not belong to this space. */ diff --git a/TimeMachine.js b/TimeMachine.js index bfd9c20eb..b89e5db04 100644 --- a/TimeMachine.js +++ b/TimeMachine.js @@ -41,6 +41,7 @@ function newTimeMachine () { const SEPARATION_BETWEEN_TIMELINE_CHARTS = 1.5 let timeScale + let rigthScale return thisObject @@ -71,6 +72,9 @@ function newTimeMachine () { timeScale = newTimeScale() timeScale.initialize() + rigthScale = newRigthScale() + rigthScale.initialize() + timeScale.container.eventHandler.listenToEvent('Lenght Percentage Changed', function (event) { thisObject.container.frame.width = TIME_MACHINE_WIDTH * event.lenghtPercentage / 100 thisObject.container.eventHandler.raiseEvent('Dimmensions Changed', event)