From 656dc3be4a6e7b3a2b995cc85aa9d049974ebddf Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 13 Jul 2019 15:57:50 +0200 Subject: [PATCH] Collapsing Functionality Fully Implemented --- FloatingSpace/FloatingObject.js | 17 ++++++++++------- FloatingSpace/StrategyPartConstructor.js | 3 +++ .../FunctionLibraries/StringifyNode.js | 1 + 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/FloatingSpace/FloatingObject.js b/FloatingSpace/FloatingObject.js index 62664ac0a..ac7d40296 100644 --- a/FloatingSpace/FloatingObject.js +++ b/FloatingSpace/FloatingObject.js @@ -24,6 +24,7 @@ function newFloatingObject () { isFrozen: false, isTensed: false, isCollapsed: false, + isParentCollapsed: false, frozenManually: false, collapsedManually: false, getPinStatus: getPinStatus, @@ -102,7 +103,7 @@ function newFloatingObject () { } function getContainer (point) { - if (thisObject.isCollapsed === true && thisObject.collapsedManually === false) { return } + if ((thisObject.isCollapsed === true && thisObject.collapsedManually === false) || thisObject.isParentCollapsed === true) { return } let container container = thisObject.payload.uiObject.getContainer(point) @@ -192,9 +193,10 @@ function newFloatingObject () { } function collapsePhysics () { - if (thisObject.collapsedManually === false) { - let parent = thisObject.payload.chainParent - if (parent !== undefined) { + let parent = thisObject.payload.chainParent + if (parent !== undefined) { + thisObject.isParentCollapsed = parent.payload.floatingObject.isCollapsed + if (thisObject.collapsedManually === false) { thisObject.isCollapsed = parent.payload.floatingObject.isCollapsed } } @@ -337,17 +339,17 @@ function newFloatingObject () { } function drawBackground () { - if (thisObject.isCollapsed === true && thisObject.collapsedManually === false) { return } + if ((thisObject.isCollapsed === true && thisObject.collapsedManually === false) || thisObject.isParentCollapsed === true) { return } thisObject.payload.uiObject.drawBackground() } function drawMiddleground () { - if (thisObject.isCollapsed === true && thisObject.collapsedManually === false) { return } + if ((thisObject.isCollapsed === true && thisObject.collapsedManually === false) || thisObject.isParentCollapsed === true) { return } thisObject.payload.uiObject.drawMiddleground() } function drawForeground () { - if (thisObject.isCollapsed === true && thisObject.collapsedManually === false) { return } + if ((thisObject.isCollapsed === true && thisObject.collapsedManually === false) || thisObject.isParentCollapsed === true) { return } thisObject.payload.uiObject.drawForeground() } @@ -459,3 +461,4 @@ function newFloatingObject () { function updateRadius () { } } + diff --git a/FloatingSpace/StrategyPartConstructor.js b/FloatingSpace/StrategyPartConstructor.js index 1ef4d4cce..91d34379f 100644 --- a/FloatingSpace/StrategyPartConstructor.js +++ b/FloatingSpace/StrategyPartConstructor.js @@ -51,6 +51,9 @@ function newStrategyPartConstructor () { if (payload.node.savedPayload.floatingObject.isFrozen === true) { floatingObject.freezeToggle() } + if (payload.node.savedPayload.floatingObject.isCollapsed === true) { + floatingObject.collapseToggle() + } if (payload.node.savedPayload.floatingObject.isTensed === true) { floatingObject.tensionToggle() } diff --git a/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js b/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js index d8a760c0b..05039cebc 100644 --- a/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js +++ b/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js @@ -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: {