Merge pull request #87 from AAMasters/develop

Collapsing Branches Improvement
This commit is contained in:
benme authored and GitHub committed 2019-07-17 08:31:23 -03:00
commit b0099e7a5f
4 files changed
+326 -970

No files matched your search

+35
View File
@@ -23,14 +23,19 @@ function newFloatingObject () {
isPinned: false,
isFrozen: false,
isTensed: false,
isCollapsed: false,
isParentCollapsed: false,
frozenManually: false,
collapsedManually: false,
getPinStatus: getPinStatus,
getFreezeStatus: getFreezeStatus,
getCollapseStatus: getCollapseStatus,
getTensionStatus: getTensionStatus,
nearbyFloatingObjects: [],
setPosition: setPosition,
pinToggle: pinToggle,
freezeToggle: freezeToggle,
collapseToggle: collapseToggle,
tensionToggle: tensionToggle,
physics: physics,
initializeMass: initializeMass,
@@ -98,6 +103,7 @@ function newFloatingObject () {
}
function getContainer (point) {
if ((thisObject.isCollapsed === true && thisObject.collapsedManually === false) || thisObject.isParentCollapsed === true) { return }
let container
container = thisObject.payload.uiObject.getContainer(point)
@@ -128,6 +134,10 @@ function newFloatingObject () {
return thisObject.isFrozen
}
function getCollapseStatus () {
return thisObject.isCollapsed
}
function getTensionStatus () {
return thisObject.isTensed
}
@@ -143,6 +153,17 @@ function newFloatingObject () {
return thisObject.isFrozen
}
function collapseToggle () {
if (thisObject.isCollapsed !== true) {
thisObject.isCollapsed = true
thisObject.collapsedManually = true
} else {
thisObject.isCollapsed = false
thisObject.collapsedManually = false
}
return thisObject.isCollapsed
}
function tensionToggle () {
if (thisObject.isTensed !== true) {
thisObject.isTensed = true
@@ -158,6 +179,7 @@ function newFloatingObject () {
thisObjectPhysics()
thisObject.payload.uiObject.physics()
frozenPhysics()
collapsePhysics()
tensionPhysics()
}
@@ -170,6 +192,16 @@ function newFloatingObject () {
}
}
function collapsePhysics () {
let parent = thisObject.payload.chainParent
if (parent !== undefined) {
thisObject.isParentCollapsed = parent.payload.floatingObject.isCollapsed
if (thisObject.collapsedManually === false) {
thisObject.isCollapsed = parent.payload.floatingObject.isCollapsed
}
}
}
function tensionPhysics () {
/* Tension Effect */
if (thisObject.isTensed === true) {
@@ -307,14 +339,17 @@ function newFloatingObject () {
}
function drawBackground () {
if ((thisObject.isCollapsed === true && thisObject.collapsedManually === false) || thisObject.isParentCollapsed === true) { return }
thisObject.payload.uiObject.drawBackground()
}
function drawMiddleground () {
if ((thisObject.isCollapsed === true && thisObject.collapsedManually === false) || thisObject.isParentCollapsed === true) { return }
thisObject.payload.uiObject.drawMiddleground()
}
function drawForeground () {
if ((thisObject.isCollapsed === true && thisObject.collapsedManually === false) || thisObject.isParentCollapsed === true) { return }
thisObject.payload.uiObject.drawForeground()
}
+1 -1
View File
@@ -379,7 +379,7 @@ function newStrategyPart () {
function detachingPhysics () {
if (isDragging !== true) { return }
if (thisObject.isFrozen === true) { return }
if (thisObject.payload.floatingObject.isFrozen === true) { return }
if (rightDragging === 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))
File diff suppressed because it is too large. Load diff
@@ -323,6 +323,7 @@ function newStringifyNode () {
floatingObject: {
isPinned: node.payload.floatingObject.isPinned,
isFrozen: (node.payload.floatingObject.isFrozen && node.payload.floatingObject.frozenManually),
isCollapsed: (node.payload.floatingObject.isCollapsed && node.payload.floatingObject.collapsedManually),
isTensed: (node.payload.floatingObject.isTensed && node.payload.floatingObject.tensedManually)
},
uiObject: {