From 030256bc4f768e391d6cfcbefb804002341302c2 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 21 Mar 2020 19:32:26 +0100 Subject: [PATCH] arrows up and down --- CanvasApp/ChartingSpace/EdgeEditor.js | 31 +++++++++++++++++++ .../Plotters-Stairs-Patterns/CandleStairs.js | 10 +++--- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/CanvasApp/ChartingSpace/EdgeEditor.js b/CanvasApp/ChartingSpace/EdgeEditor.js index f45fea578..43329b0c0 100644 --- a/CanvasApp/ChartingSpace/EdgeEditor.js +++ b/CanvasApp/ChartingSpace/EdgeEditor.js @@ -197,6 +197,18 @@ function newEdgeEditor () { return } + if (event.shiftKey === false && event.code === 'ArrowUp') { + thisObject.container.frame.position.y = thisObject.container.frame.position.y + STEP + whatHappened = 'up or down arrow key pressed' + return + } + + if (event.shiftKey === false && event.code === 'ArrowDown') { + thisObject.container.frame.position.y = thisObject.container.frame.position.y - STEP + whatHappened = 'up or down arrow key pressed' + return + } + if (event.shiftKey === true && (event.ctrlKey === true || event.metaKey === true) && (event.key === 'A' || event.key === 'a')) { resetAspectRatio() return @@ -309,6 +321,7 @@ function newEdgeEditor () { } coordinateSystem.recalculateScale(event) } + break case 'left or right arrow key pressed': { let point = { x: -dragVector.x, @@ -325,6 +338,24 @@ function newEdgeEditor () { } coordinateSystem.recalculateScale(event) } + break + case 'up or down arrow key pressed': { + let point = { + x: 0, + y: -dragVector.y + } + + let newMaxRate = getRateFromPointAtContainer(point, thisObject.container.parentContainer, coordinateSystem) + let yDifferenceMaxMin = coordinateSystem.max.y - coordinateSystem.min.y + coordinateSystem.min.y = newMaxRate - yDifferenceMaxMin + coordinateSystem.max.y = newMaxRate + let event = { + type: 'center dragged', + dragVector: dragVector + } + coordinateSystem.recalculateScale(event) + } + break } thisObject.container.parentContainer.eventHandler.raiseEvent('onMouseOver', mouse.position) break diff --git a/Legacy-Code/Masters/plotters/Plotters-Stairs-Patterns/CandleStairs.js b/Legacy-Code/Masters/plotters/Plotters-Stairs-Patterns/CandleStairs.js index eb1cc144a..b49e55a4b 100644 --- a/Legacy-Code/Masters/plotters/Plotters-Stairs-Patterns/CandleStairs.js +++ b/Legacy-Code/Masters/plotters/Plotters-Stairs-Patterns/CandleStairs.js @@ -517,7 +517,7 @@ let stairsPoint3; let stairsPoint4; - if (stairs.direction === 'up') { + if (stairs.direction === 'Up') { stairsPoint1 = { x: stairs.begin + timeFrame / 7 * 5.5, @@ -603,11 +603,11 @@ let opacity = '0.25'; - if (stairs.direction === 'up') { browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.PATINATED_TURQUOISE + ', ' + opacity + ')'; } - if (stairs.direction === 'down') { browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.RED + ', ' + opacity + ')'; } + if (stairs.direction === 'Up') { browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.PATINATED_TURQUOISE + ', ' + opacity + ')'; } + if (stairs.direction === 'Down') { browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.RED + ', ' + opacity + ')'; } - if (stairs.direction === 'up') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.GREEN + ', ' + opacity + ')'; } - if (stairs.direction === 'down') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.RUSTED_RED + ', ' + opacity + ')'; } + if (stairs.direction === 'Up') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.GREEN + ', ' + opacity + ')'; } + if (stairs.direction === 'Down') { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.RUSTED_RED + ', ' + opacity + ')'; } if (userPositionDate >= stairs.begin && userPositionDate <= stairs.end) { /* highlight the current stairs */