Detaching only with 2 mouse button allowed
This commit is contained in:
1 parent
69b1b6c916
commit
4e355dd60f
2 files changed
+13
-12
No files matched your search
@@ -236,7 +236,8 @@ function newCanvas () {
|
||||
try {
|
||||
let point = {
|
||||
x: event.pageX,
|
||||
y: event.pageY - CURRENT_TOP_MARGIN
|
||||
y: event.pageY - CURRENT_TOP_MARGIN,
|
||||
button: event.button
|
||||
}
|
||||
|
||||
dragVector.downX = point.x
|
||||
@@ -706,3 +707,4 @@ function newCanvas () {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,6 +79,7 @@ function newStrategyPart () {
|
||||
|
||||
let errorMessage = ''
|
||||
let formulaValue = 0
|
||||
let detachingEnabled = false
|
||||
|
||||
return thisObject
|
||||
|
||||
@@ -373,6 +374,7 @@ function newStrategyPart () {
|
||||
function detachingPhysics () {
|
||||
if (isDragging !== true) { return }
|
||||
if (thisObject.isFrozen === true) { return }
|
||||
if (detachingEnabled === false) { return }
|
||||
|
||||
let distanceToChainParent = Math.sqrt(Math.pow(thisObject.payload.position.x - thisObject.payload.targetPosition.x, 2) + Math.pow(thisObject.payload.position.y - thisObject.payload.targetPosition.y, 2))
|
||||
let ratio = distanceToChainParent / previousDistance
|
||||
@@ -433,7 +435,7 @@ function newStrategyPart () {
|
||||
}
|
||||
|
||||
function setValue (value) {
|
||||
if (value !== undefined && isNaN(value) === false && (typeof value !== 'boolean')) {
|
||||
if (value !== undefined) {
|
||||
formulaValue = value
|
||||
hasValue = true
|
||||
valueCounter = 5
|
||||
@@ -495,6 +497,11 @@ function newStrategyPart () {
|
||||
thisObject.codeEditor.deactivate()
|
||||
}
|
||||
isDragging = true
|
||||
if (event.button === 2) {
|
||||
detachingEnabled = true
|
||||
} else {
|
||||
detachingEnabled = false
|
||||
}
|
||||
}
|
||||
|
||||
function onDragFinished (event) {
|
||||
@@ -738,16 +745,7 @@ function newStrategyPart () {
|
||||
for (let i = 0; i < parent.phases.length; i++) {
|
||||
let phase = parent.phases[i]
|
||||
if (phase.id === thisObject.payload.node.id) {
|
||||
let parentParent = parent.payload.parentNode
|
||||
if (parentParent !== undefined) {
|
||||
if (parentParent.type === 'Initial Definition') {
|
||||
label = label + ' #' + (i)
|
||||
} else {
|
||||
label = label + ' #' + (i + 1)
|
||||
}
|
||||
} else {
|
||||
label = label + ' #' + (i + 1)
|
||||
}
|
||||
label = label + ' #' + (i + 1)
|
||||
return label
|
||||
}
|
||||
}
|
||||
@@ -951,3 +949,4 @@ function newStrategyPart () {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user