detachUsingMouse implemented at Space Settings so that users don't detach by mistake nodes

This commit is contained in:
Luis Fernando Molina committed 2021-03-11 17:13:56 +01:00
1 parent f7d93ed994
commit b5819e7a14
4 files changed
+11 -1

No files matched your search

+1 -1
View File
@@ -15936,7 +15936,7 @@
"config": true
},
"initialValues": {
"config": "{\"node\":{\"distancePercentage\":60,\"radiusPercentage\":85,\"massPercentage\":100,\"animationSteps\":2,\"menuItem\":{\"widthPercentage\":100,\"heightPercentage\":60,\"radiusPercentage\":90}},\"physics\":false}"
"config": "{\"node\":{\"distancePercentage\":60,\"radiusPercentage\":85,\"massPercentage\":100,\"animationSteps\":2,\"menuItem\":{\"widthPercentage\":100,\"heightPercentage\":60,\"radiusPercentage\":90}},\"physics\":false,\"detachUsingMouse\":false }"
},
"menuItems": [
{
@@ -55,6 +55,10 @@
{
"style": "List",
"text": "physics determines wether the environment is static (false) or dynamic (true). When physics is set to true, nodes in the design space are affected by th gravitational pull and repulsion of other nodes."
},
{
"style": "List",
"text": "detachUsingMouse defines if you can detach nodes from it's parent or reference parents only using the mouse (when true) or if you can not use the mouse for that and can only do it using the detach buttons on the icon's menu (when false)."
}
]
}
@@ -100,6 +100,7 @@ function newSuperalgosFloatingSpace() {
}
},
physics: true,
detachUsingMouse: false
}
return thisObject
@@ -536,6 +537,9 @@ function newSuperalgosFloatingSpace() {
if (configSettings.physics !== undefined) {
thisObject.settings.physics = configSettings.physics
}
if (configSettings.detachUsingMouse !== undefined) {
thisObject.settings.detachUsingMouse = configSettings.detachUsingMouse
}
}
function positionContraintsPhysics() {
@@ -560,6 +560,7 @@ function newUiObject() {
function chainDetachingPhysics() {
if (isDragging !== true) { return }
if (rightDragging === false) { return }
if (UI.projects.superalgos.spaces.floatingSpace.settings.detachUsingMouse !== true) {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 / previousDistanceToChainParent
@@ -665,6 +666,7 @@ function newUiObject() {
if (thisObject.payload === undefined) { return }
if (thisObject.payload.floatingObject.isFrozen === true) { return }
if (rightDragging === false) { return }
if (UI.projects.superalgos.spaces.floatingSpace.settings.detachUsingMouse !== true) {return}
if (thisObject.payload.referenceParent === undefined) { return }