Designer moving with the arrows
This commit is contained in:
1 parent
c6099d5908
commit
60915592b6
2 files changed
+64
-6
No files matched your search
@@ -186,20 +186,36 @@ function newCanvas () {
|
||||
}
|
||||
|
||||
function onKeyDown (event) {
|
||||
if (event.shiftKey === true && event.code === 'ArrowUp') {
|
||||
if (event.altKey === true && event.code === 'ArrowUp') {
|
||||
thisObject.cockpitSpace.toTop()
|
||||
}
|
||||
|
||||
if (event.shiftKey === true && event.code === 'ArrowDown') {
|
||||
if (event.altKey === true && event.code === 'ArrowDown') {
|
||||
thisObject.cockpitSpace.toBottom()
|
||||
}
|
||||
|
||||
if (event.keyCode === 37) {
|
||||
alert('Left key pressed')
|
||||
if (event.shiftKey === true && event.code === 'ArrowLeft') {
|
||||
alert('charts to the Left')
|
||||
}
|
||||
|
||||
if (event.keyCode === 39) {
|
||||
alert('Rigth key pressed')
|
||||
if (event.shiftKey === true && event.code === 'ArrowRight') {
|
||||
alert('charts to the Rigth')
|
||||
}
|
||||
|
||||
if (event.ctrlKey === true && event.code === 'ArrowLeft') {
|
||||
canvas.floatingSpace.oneScreenLeft()
|
||||
}
|
||||
|
||||
if (event.ctrlKey === true && event.code === 'ArrowRight') {
|
||||
canvas.floatingSpace.oneScreenRight()
|
||||
}
|
||||
|
||||
if (event.ctrlKey === true && event.code === 'ArrowUp') {
|
||||
canvas.floatingSpace.oneScreenUp()
|
||||
}
|
||||
|
||||
if (event.ctrlKey === true && event.code === 'ArrowDown') {
|
||||
canvas.floatingSpace.oneScreenDown()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,10 @@ function newFloatingSpace () {
|
||||
strategyPartConstructor: undefined,
|
||||
noteSets: undefined,
|
||||
container: undefined,
|
||||
oneScreenUp: oneScreenUp,
|
||||
oneScreenDown: oneScreenDown,
|
||||
oneScreenLeft: oneScreenLeft,
|
||||
oneScreenRight: oneScreenRight,
|
||||
fitIntoVisibleArea: fitIntoVisibleArea,
|
||||
isThisPointVisible: isThisPointVisible,
|
||||
makeVisible: makeVisible,
|
||||
@@ -41,6 +45,8 @@ function newFloatingSpace () {
|
||||
thisObject.container.frame.position.y = browserCanvas.height / 2 - thisObject.container.frame.height / 2
|
||||
|
||||
let visible = false
|
||||
|
||||
const PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT = 50
|
||||
return thisObject
|
||||
|
||||
function finalize () {
|
||||
@@ -93,6 +99,42 @@ function newFloatingSpace () {
|
||||
return returnPoint
|
||||
}
|
||||
|
||||
function oneScreenUp () {
|
||||
let displaceVector = {
|
||||
x: 0,
|
||||
y: browserCanvas.height * PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT / 100
|
||||
}
|
||||
|
||||
thisObject.container.displace(displaceVector)
|
||||
}
|
||||
|
||||
function oneScreenDown () {
|
||||
let displaceVector = {
|
||||
x: 0,
|
||||
y: -browserCanvas.height * PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT / 100
|
||||
}
|
||||
|
||||
thisObject.container.displace(displaceVector)
|
||||
}
|
||||
|
||||
function oneScreenLeft () {
|
||||
let displaceVector = {
|
||||
x: browserCanvas.width * PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT / 100,
|
||||
y: 0
|
||||
}
|
||||
|
||||
thisObject.container.displace(displaceVector)
|
||||
}
|
||||
|
||||
function oneScreenRight () {
|
||||
let displaceVector = {
|
||||
x: -browserCanvas.width * PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT / 100,
|
||||
y: 0
|
||||
}
|
||||
|
||||
thisObject.container.displace(displaceVector)
|
||||
}
|
||||
|
||||
function isThisPointVisible (point) {
|
||||
if (point.x > browserCanvas.width) {
|
||||
return false
|
||||
|
||||
Reference in new issue
Block a user