new toggles

This commit is contained in:
Luis Fernando Molina committed 2020-03-15 18:51:24 +01:00
1 parent 0da45d9593
commit ab52593899
3 files changed
+21 -6

No files matched your search

+10 -5
View File
@@ -246,6 +246,9 @@ function newCanvas () {
}
function onKeyDown (event) {
/* From here we prevent the default behaviour */
event.preventDefault()
thisObject.mouse.event = event
thisObject.mouse.action = 'key down'
@@ -256,16 +259,21 @@ function newCanvas () {
canvas.floatingSpace.exitMapMode()
}
if (event.key === 'M' || event.key === 'm') {
if (event.shiftKey === true && (event.ctrlKey === true || event.metaKey === true) && (event.key === 'M' || event.key === 'm')) {
canvas.floatingSpace.toggleMapMode()
return
}
if (event.key === 'R' || event.key === 'r') {
if (event.shiftKey === true && (event.ctrlKey === true || event.metaKey === true) && (event.key === 'R' || event.key === 'r')) {
canvas.floatingSpace.toggleDrawReferenceLines()
return
}
if (event.shiftKey === true && (event.ctrlKey === true || event.metaKey === true) && (event.key === 'C' || event.key === 'c')) {
canvas.floatingSpace.toggleDrawChainLines()
return
}
let nodeOnFocus = canvas.designSpace.workspace.getNodeThatIsOnFocus()
if (nodeOnFocus !== undefined) {
if (nodeOnFocus.payload.uiObject.codeEditor !== undefined) {
@@ -392,9 +400,6 @@ function newCanvas () {
if ((event.ctrlKey === true || event.metaKey === true) && event.altKey === true) {
if ((event.keyCode >= 48 && event.keyCode <= 57) || (event.keyCode >= 65 && event.keyCode <= 90)) {
/* From here we prevent the default behaviour */
event.preventDefault()
let nodeUsingThisKey = canvas.designSpace.workspace.getNodeByShortcutKey(event.key)
if (nodeOnFocus === undefined && nodeUsingThisKey !== undefined) {
+1
View File
@@ -945,6 +945,7 @@ function newUiObject () {
}
function drawChainLine () {
if (canvas.floatingSpace.drawChainLines === false) { return }
if (thisObject.payload.chainParent === undefined) { return }
let targetPoint = {
+10 -1
View File
@@ -13,6 +13,8 @@ function newFloatingSpace () {
container: undefined,
inMapMode: false,
drawReferenceLines: true,
drawChainLines: true,
toggleDrawChainLines: toggleDrawChainLines,
toggleDrawReferenceLines: toggleDrawReferenceLines,
toggleMapMode: toggleMapMode,
enterMapMode: enterMapMode,
@@ -91,6 +93,14 @@ function newFloatingSpace () {
}
}
function toggleDrawChainLines () {
if (thisObject.drawChainLines === true) {
thisObject.drawChainLines = false
} else {
thisObject.drawChainLines = true
}
}
function transformPointToMap (point) {
let returnPoint = {
x: point.x - thisObject.container.frame.position.x,
@@ -395,4 +405,3 @@ function newFloatingSpace () {
browserCanvasContext.fill()
}
}