Merge pull request #74 from AAMasters/develop

IMPROVEMENT: Phase 0
This commit is contained in:
benme authored and GitHub committed 2019-06-27 13:38:25 -03:00
commit 0cb2e4d0ce
2 files changed
+10 -1

No files matched your search

+3 -1
View File
@@ -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 () {
}
}
}
+7
View File
@@ -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
@@ -495,6 +497,11 @@ function newStrategyPart () {
thisObject.codeEditor.deactivate()
}
isDragging = true
if (event.button === 2) {
detachingEnabled = true
} else {
detachingEnabled = false
}
}
function onDragFinished (event) {