arrows up and down

This commit is contained in:
Luis Fernando Molina committed 2020-03-21 19:32:26 +01:00
1 parent 5f139fe68f
commit 030256bc4f
2 files changed
+36 -5

No files matched your search

+31
View File
@@ -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
@@ -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 */