Bug Fixed: Deleting Phases and Conditions
This commit is contained in:
1 parent
1ec39c71fd
commit
c8904d7776
3 files changed
+21
-24
No files matched your search
@@ -1026,7 +1026,7 @@ function newStrategyPartConstructor () {
|
||||
}
|
||||
|
||||
function setFloatingObjectBasicProperties (floatingObject, payload) {
|
||||
const FRICTION = 0.97
|
||||
const FRICTION = 0.98
|
||||
|
||||
switch (payload.node.type) {
|
||||
case 'Trading System': {
|
||||
@@ -1078,7 +1078,7 @@ function newStrategyPartConstructor () {
|
||||
break
|
||||
}
|
||||
case 'Phase': {
|
||||
level_4()
|
||||
level_2()
|
||||
break
|
||||
}
|
||||
case 'Formula': {
|
||||
@@ -1128,7 +1128,7 @@ function newStrategyPartConstructor () {
|
||||
function level_2 () {
|
||||
floatingObject.friction = FRICTION
|
||||
|
||||
floatingObject.initializeMass(50)
|
||||
floatingObject.initializeMass(100)
|
||||
floatingObject.initializeRadius(40)
|
||||
floatingObject.initializeImageSize(70)
|
||||
floatingObject.initializeFontSize(10)
|
||||
|
||||
@@ -181,32 +181,29 @@ function newNodeDeleter () {
|
||||
for (let k = 0; k < payload.parentNode.phases.length; k++) {
|
||||
let phase = payload.parentNode.phases[k]
|
||||
if (phase.id === node.id) {
|
||||
while (phase.situations.length > 0) {
|
||||
let situation = phase.situations[0]
|
||||
deleteSituation(situation)
|
||||
}
|
||||
phase.situations = []
|
||||
/* Before deleting this phase we need to give its chainParent to the next phase down the chain */
|
||||
if (k < payload.parentNode.phases.length - 1) {
|
||||
payload.parentNode.phases[k + 1].payload.chainParent = payload.chainParent
|
||||
}
|
||||
/* Continue destroying this phase */
|
||||
payload.parentNode.phases.splice(k, 1)
|
||||
destroyPart(phase)
|
||||
cleanNode(phase)
|
||||
return
|
||||
}
|
||||
}
|
||||
} else {
|
||||
while (node.situations.length > 0) {
|
||||
let situation = node.situations[0]
|
||||
deleteSituation(situation)
|
||||
}
|
||||
node.situations = []
|
||||
completeDeletion(node, rootNodes)
|
||||
destroyPart(node)
|
||||
cleanNode(node)
|
||||
}
|
||||
|
||||
while (node.situations.length > 0) {
|
||||
let situation = node.situations[0]
|
||||
deleteSituation(situation)
|
||||
}
|
||||
node.situations = []
|
||||
|
||||
if (node.formula !== undefined) {
|
||||
deleteFormula(node.formula, rootNodes)
|
||||
}
|
||||
destroyPart(node)
|
||||
cleanNode(node)
|
||||
}
|
||||
|
||||
function deleteFormula (node, rootNodes) {
|
||||
@@ -257,16 +254,16 @@ function newNodeDeleter () {
|
||||
let condition = payload.parentNode.conditions[i]
|
||||
if (condition.id === node.id) {
|
||||
payload.parentNode.conditions.splice(i, 1)
|
||||
destroyPart(node)
|
||||
cleanNode(condition)
|
||||
return
|
||||
}
|
||||
}
|
||||
} else {
|
||||
completeDeletion(node, rootNodes)
|
||||
destroyPart(node)
|
||||
cleanNode(node)
|
||||
}
|
||||
if (node.code !== undefined) {
|
||||
deleteCode(node.code, rootNodes)
|
||||
}
|
||||
destroyPart(node)
|
||||
cleanNode(node)
|
||||
}
|
||||
|
||||
function deleteCode (node, rootNodes) {
|
||||
|
||||
@@ -114,7 +114,7 @@ function newWorkspace () {
|
||||
rootNodes: stringifyReadyNodes
|
||||
}
|
||||
let textToSave = JSON.stringify(workspace)
|
||||
window.localStorage.setItem('workspace', textToSave)
|
||||
// window.localStorage.setItem('workspace', textToSave)
|
||||
}
|
||||
|
||||
function spawn (nodeText, point) {
|
||||
|
||||
Reference in new issue
Block a user