diff --git a/Canvas.js b/Canvas.js index c99219890..6f5a49c25 100644 --- a/Canvas.js +++ b/Canvas.js @@ -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 () { } } } + diff --git a/FloatingSpace/StrategyPart.js b/FloatingSpace/StrategyPart.js index e3c56f8f2..6da021f37 100644 --- a/FloatingSpace/StrategyPart.js +++ b/FloatingSpace/StrategyPart.js @@ -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 () { } } } +