Scrolling with keys charts and designer

This commit is contained in:
Luis Fernando Molina committed 2019-10-11 17:26:01 +02:00
1 parent 60915592b6
commit b3e3795e41
3 files changed
+52 -3

No files matched your search

+10 -2
View File
@@ -195,11 +195,19 @@ function newCanvas () {
}
if (event.shiftKey === true && event.code === 'ArrowLeft') {
alert('charts to the Left')
canvas.chartSpace.oneScreenLeft()
}
if (event.shiftKey === true && event.code === 'ArrowRight') {
alert('charts to the Rigth')
canvas.chartSpace.oneScreenRight()
}
if (event.shiftKey === true && event.code === 'ArrowUp') {
canvas.chartSpace.oneScreenUp()
}
if (event.shiftKey === true && event.code === 'ArrowDown') {
canvas.chartSpace.oneScreenDown()
}
if (event.ctrlKey === true && event.code === 'ArrowLeft') {
+41
View File
@@ -16,6 +16,10 @@ function newChartSpace () {
visible: true,
container: undefined,
timeMachines: [],
oneScreenUp: oneScreenUp,
oneScreenDown: oneScreenDown,
oneScreenLeft: oneScreenLeft,
oneScreenRight: oneScreenRight,
fitIntoVisibleArea: fitIntoVisibleArea,
isThisPointVisible: isThisPointVisible,
physics: physics,
@@ -34,6 +38,7 @@ function newChartSpace () {
let canvasBrowserResizedEventSubscriptionId
const PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT = 25
return thisObject
function finalize () {
@@ -112,6 +117,42 @@ function newChartSpace () {
thisObject.container.frame.height = COCKPIT_SPACE_POSITION
}
function oneScreenUp () {
let displaceVector = {
x: 0,
y: +browserCanvas.height * PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT / 100
}
viewPort.displace(displaceVector)
}
function oneScreenDown () {
let displaceVector = {
x: 0,
y: -browserCanvas.height * PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT / 100
}
viewPort.displace(displaceVector)
}
function oneScreenLeft () {
let displaceVector = {
x: -browserCanvas.width * PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT / 100,
y: 0
}
viewPort.displace(displaceVector)
}
function oneScreenRight () {
let displaceVector = {
x: +browserCanvas.width * PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT / 100,
y: 0
}
viewPort.displace(displaceVector)
}
function fitIntoVisibleArea (point) {
/* Here we check the boundaries of the resulting points, so they dont go out of the visible area. */
+1 -1
View File
@@ -46,7 +46,7 @@ function newFloatingSpace () {
let visible = false
const PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT = 50
const PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT = 25
return thisObject
function finalize () {