From 64e154d165a36a148c5bdef2e9682421cd65644f Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 13 Jul 2019 14:18:56 +0200 Subject: [PATCH 1/4] Collapsing implemented at Trading System only --- FloatingSpace/FloatingObject.js | 29 ++++++++++++++++++++++++ FloatingSpace/StrategyPart.js | 7 +++++- FloatingSpace/StrategyPartConstructor.js | 16 ++++++++++++- 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/FloatingSpace/FloatingObject.js b/FloatingSpace/FloatingObject.js index cca996732..48a35269b 100644 --- a/FloatingSpace/FloatingObject.js +++ b/FloatingSpace/FloatingObject.js @@ -23,14 +23,18 @@ function newFloatingObject () { isPinned: false, isFrozen: false, isTensed: false, + isCollapsed: 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, @@ -128,6 +132,10 @@ function newFloatingObject () { return thisObject.isFrozen } + function getCollapseStatus () { + return thisObject.isCollapsed + } + function getTensionStatus () { return thisObject.isTensed } @@ -143,6 +151,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 +177,7 @@ function newFloatingObject () { thisObjectPhysics() thisObject.payload.uiObject.physics() frozenPhysics() + collapsePhysics() tensionPhysics() } @@ -170,6 +190,15 @@ function newFloatingObject () { } } + function collapsePhysics () { + if (thisObject.collapsedManually === false) { + let parent = thisObject.payload.chainParent + if (parent !== undefined) { + thisObject.isCollapsed = parent.payload.floatingObject.isCollapsed + } + } + } + function tensionPhysics () { /* Tension Effect */ if (thisObject.isTensed === true) { diff --git a/FloatingSpace/StrategyPart.js b/FloatingSpace/StrategyPart.js index 5b42a748b..304464f3d 100644 --- a/FloatingSpace/StrategyPart.js +++ b/FloatingSpace/StrategyPart.js @@ -137,6 +137,8 @@ function newStrategyPart () { } function getContainer (point) { + if (thisObject.payload.floatingObject.isCollapsed === true && thisObject.payload.floatingObject.collapsedManually === false) { return } + let container if (isDragging === false && thisObject.isOnFocus === true) { @@ -379,7 +381,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)) @@ -520,6 +522,7 @@ function newStrategyPart () { } function drawBackground () { + if (thisObject.payload.floatingObject.isCollapsed === true && thisObject.payload.floatingObject.collapsedManually === false) { return } if (thisObject.isOnFocus === false) { drawConnectingLine() @@ -530,6 +533,7 @@ function newStrategyPart () { } function drawMiddleground () { + if (thisObject.payload.floatingObject.isCollapsed === true && thisObject.payload.floatingObject.collapsedManually === false) { return } if (thisObject.isOnFocus === false) { drawValue() drawText() @@ -538,6 +542,7 @@ function newStrategyPart () { } function drawForeground () { + if (thisObject.payload.floatingObject.isCollapsed === true && thisObject.payload.floatingObject.collapsedManually === false) { return } if (thisObject.isOnFocus === false) { drawBodyAndPicture() if (isDragging === false) { diff --git a/FloatingSpace/StrategyPartConstructor.js b/FloatingSpace/StrategyPartConstructor.js index a998a8b1c..c255a6166 100644 --- a/FloatingSpace/StrategyPartConstructor.js +++ b/FloatingSpace/StrategyPartConstructor.js @@ -145,7 +145,7 @@ function newStrategyPartConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 180 + angle: -165 }, { action: 'Freeze / Unfreeze', @@ -159,6 +159,20 @@ function newStrategyPartConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, + angle: 165 + }, + { + action: 'Collapse / Uncollapse', + actionFunction: floatingObject.collapseToggle, + actionStatus: floatingObject.getCollapeseStatus, + currentStatus: false, + label: undefined, + visible: false, + iconPathOn: 'tap', + iconPathOff: 'layout', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, angle: 135 }, { From e19dbd5655aa4b7bcf73478974ff3ba8e0aed0ad Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 13 Jul 2019 14:51:33 +0200 Subject: [PATCH 2/4] Reducing Funcitonality to Floating Object Only --- FloatingSpace/FloatingObject.js | 5 +- FloatingSpace/StrategyPart.js | 5 - FloatingSpace/StrategyPartConstructor.js | 133 ++++++++++++----------- 3 files changed, 74 insertions(+), 69 deletions(-) diff --git a/FloatingSpace/FloatingObject.js b/FloatingSpace/FloatingObject.js index 48a35269b..62664ac0a 100644 --- a/FloatingSpace/FloatingObject.js +++ b/FloatingSpace/FloatingObject.js @@ -102,6 +102,7 @@ function newFloatingObject () { } function getContainer (point) { + if (thisObject.isCollapsed === true && thisObject.collapsedManually === false) { return } let container container = thisObject.payload.uiObject.getContainer(point) @@ -336,14 +337,17 @@ function newFloatingObject () { } function drawBackground () { + if (thisObject.isCollapsed === true && thisObject.collapsedManually === false) { return } thisObject.payload.uiObject.drawBackground() } function drawMiddleground () { + if (thisObject.isCollapsed === true && thisObject.collapsedManually === false) { return } thisObject.payload.uiObject.drawMiddleground() } function drawForeground () { + if (thisObject.isCollapsed === true && thisObject.collapsedManually === false) { return } thisObject.payload.uiObject.drawForeground() } @@ -455,4 +459,3 @@ function newFloatingObject () { function updateRadius () { } } - diff --git a/FloatingSpace/StrategyPart.js b/FloatingSpace/StrategyPart.js index 304464f3d..049de0b79 100644 --- a/FloatingSpace/StrategyPart.js +++ b/FloatingSpace/StrategyPart.js @@ -137,8 +137,6 @@ function newStrategyPart () { } function getContainer (point) { - if (thisObject.payload.floatingObject.isCollapsed === true && thisObject.payload.floatingObject.collapsedManually === false) { return } - let container if (isDragging === false && thisObject.isOnFocus === true) { @@ -522,7 +520,6 @@ function newStrategyPart () { } function drawBackground () { - if (thisObject.payload.floatingObject.isCollapsed === true && thisObject.payload.floatingObject.collapsedManually === false) { return } if (thisObject.isOnFocus === false) { drawConnectingLine() @@ -533,7 +530,6 @@ function newStrategyPart () { } function drawMiddleground () { - if (thisObject.payload.floatingObject.isCollapsed === true && thisObject.payload.floatingObject.collapsedManually === false) { return } if (thisObject.isOnFocus === false) { drawValue() drawText() @@ -542,7 +538,6 @@ function newStrategyPart () { } function drawForeground () { - if (thisObject.payload.floatingObject.isCollapsed === true && thisObject.payload.floatingObject.collapsedManually === false) { return } if (thisObject.isOnFocus === false) { drawBodyAndPicture() if (isDragging === false) { diff --git a/FloatingSpace/StrategyPartConstructor.js b/FloatingSpace/StrategyPartConstructor.js index c255a6166..1b07a59c6 100644 --- a/FloatingSpace/StrategyPartConstructor.js +++ b/FloatingSpace/StrategyPartConstructor.js @@ -80,6 +80,57 @@ function newStrategyPartConstructor () { return } + function addLeftIcons (menuItemsInitialValues, floatingObject) { + menuItemsInitialValues.push( + { + action: 'Tense / Untense', + actionFunction: floatingObject.tensionToggle, + actionStatus: floatingObject.getTensionStatus, + currentStatus: true, + label: undefined, + visible: false, + iconPathOn: 'compass', + iconPathOff: 'headphones', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -165 + } + ) + menuItemsInitialValues.push( + { + action: 'Freeze / Unfreeze', + actionFunction: floatingObject.freezeToggle, + actionStatus: floatingObject.getFreezeStatus, + currentStatus: true, + label: undefined, + visible: false, + iconPathOn: 'broken-link', + iconPathOff: 'targeting', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 165 + } + ) + menuItemsInitialValues.push( + { + action: 'Collapse / Uncollapse', + actionFunction: floatingObject.collapseToggle, + actionStatus: floatingObject.getCollapeseStatus, + currentStatus: false, + label: undefined, + visible: false, + iconPathOn: 'tap', + iconPathOff: 'layout', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 135 + } + ) + } + function getMenuItemsInitialValues (strategyPart, floatingObject, payload) { let menuItemsInitialValues = [] switch (payload.node.type) { @@ -118,63 +169,8 @@ function newStrategyPartConstructor () { case 'Trading System': { floatingObject.isPinned = true floatingObject.positionLocked = true - menuItemsInitialValues = [ - { - action: 'Pin / Unpin', - actionFunction: floatingObject.pinToggle, - actionStatus: floatingObject.getPinStatus, - currentStatus: true, - label: undefined, - visible: false, - iconPathOn: 'target', - iconPathOff: 'security', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -135 - }, - { - action: 'Tense / Untense', - actionFunction: floatingObject.tensionToggle, - actionStatus: floatingObject.getTensionStatus, - currentStatus: true, - label: undefined, - visible: false, - iconPathOn: 'compass', - iconPathOff: 'headphones', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -165 - }, - { - action: 'Freeze / Unfreeze', - actionFunction: floatingObject.freezeToggle, - actionStatus: floatingObject.getFreezeStatus, - currentStatus: true, - label: undefined, - visible: false, - iconPathOn: 'broken-link', - iconPathOff: 'targeting', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 165 - }, - { - action: 'Collapse / Uncollapse', - actionFunction: floatingObject.collapseToggle, - actionStatus: floatingObject.getCollapeseStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'tap', - iconPathOff: 'layout', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 135 - }, + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( { action: 'Run Trading System', actionFunction: payload.uiObject.run, @@ -186,7 +182,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: -70 - }, + } + ) + menuItemsInitialValues.push( { action: 'Save Trading System', actionFunction: payload.onMenuItemClick, @@ -201,7 +199,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: -40 - }, + } + ) + menuItemsInitialValues.push( { action: 'Delete Trading System', askConfirmation: true, @@ -215,7 +215,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: -10 - }, + } + ) + menuItemsInitialValues.push( { action: 'New Strategy', actionFunction: payload.onMenuItemClick, @@ -228,7 +230,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: +10 - }, + } + ) + menuItemsInitialValues.push( { action: 'Add Parameters', actionFunction: payload.onMenuItemClick, @@ -241,7 +245,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 40 - }, + } + ) + menuItemsInitialValues.push( { action: 'Download', actionFunction: payload.onMenuItemClick, @@ -253,7 +259,8 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 70 - }] + } + ) break } case 'Parameters': { From d7e31b4d8e96e829f04639569cbb86be37c8c184 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 13 Jul 2019 15:20:53 +0200 Subject: [PATCH 3/4] Added Icon at all objects --- FloatingSpace/StrategyPartConstructor.js | 1136 ++++------------------ 1 file changed, 216 insertions(+), 920 deletions(-) diff --git a/FloatingSpace/StrategyPartConstructor.js b/FloatingSpace/StrategyPartConstructor.js index 1b07a59c6..1ef4d4cce 100644 --- a/FloatingSpace/StrategyPartConstructor.js +++ b/FloatingSpace/StrategyPartConstructor.js @@ -81,6 +81,22 @@ function newStrategyPartConstructor () { } function addLeftIcons (menuItemsInitialValues, floatingObject) { + menuItemsInitialValues.push( + { + action: 'Pin / Unpin', + actionFunction: floatingObject.pinToggle, + actionStatus: floatingObject.getPinStatus, + currentStatus: false, + label: undefined, + visible: false, + iconPathOn: 'target', + iconPathOff: 'security', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -135 + } + ) menuItemsInitialValues.push( { action: 'Tense / Untense', @@ -264,49 +280,8 @@ function newStrategyPartConstructor () { break } case 'Parameters': { - menuItemsInitialValues = [ - { - action: 'Pin / Unpin', - actionFunction: floatingObject.pinToggle, - actionStatus: floatingObject.getPinStatus, - currentStatus: true, - label: undefined, - visible: false, - iconPathOn: 'target', - iconPathOff: 'security', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -135 - }, - { - action: 'Tense / Untense', - actionFunction: floatingObject.tensionToggle, - actionStatus: floatingObject.getTensionStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'compass', - iconPathOff: 'headphones', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 180 - }, - { - action: 'Freeze / Unfreeze', - actionFunction: floatingObject.freezeToggle, - actionStatus: floatingObject.getFreezeStatus, - currentStatus: true, - label: undefined, - visible: false, - iconPathOn: 'targeting', - iconPathOff: 'broken-link', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 135 - }, + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( { action: 'Delete Parameters', askConfirmation: true, @@ -320,7 +295,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: -40 - }, + } + ) + menuItemsInitialValues.push( { action: 'Add Missing Parameters', actionFunction: payload.onMenuItemClick, @@ -332,7 +309,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 0 - }, + } + ) + menuItemsInitialValues.push( { action: 'Download', actionFunction: payload.onMenuItemClick, @@ -344,53 +323,13 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 40 - }] + } + ) break } case 'Base Asset': { - menuItemsInitialValues = [ - { - action: 'Pin / Unpin', - actionFunction: floatingObject.pinToggle, - actionStatus: floatingObject.getPinStatus, - currentStatus: true, - label: undefined, - visible: false, - iconPathOn: 'target', - iconPathOff: 'security', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -135 - }, - { - action: 'Tense / Untense', - actionFunction: floatingObject.tensionToggle, - actionStatus: floatingObject.getTensionStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'compass', - iconPathOff: 'headphones', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 180 - }, - { - action: 'Freeze / Unfreeze', - actionFunction: floatingObject.freezeToggle, - actionStatus: floatingObject.getFreezeStatus, - currentStatus: true, - label: undefined, - visible: false, - iconPathOn: 'targeting', - iconPathOff: 'broken-link', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 135 - }, + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( { action: 'Delete Base Asset', askConfirmation: true, @@ -404,7 +343,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: -40 - }, + } + ) + menuItemsInitialValues.push( { action: 'Add Formula', actionFunction: payload.onMenuItemClick, @@ -417,7 +358,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 0 - }, + } + ) + menuItemsInitialValues.push( { action: 'Download', actionFunction: payload.onMenuItemClick, @@ -429,53 +372,13 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 40 - }] + } + ) break } case 'Strategy': { - menuItemsInitialValues = [ - { - action: 'Pin / Unpin', - actionFunction: floatingObject.pinToggle, - actionStatus: floatingObject.getPinStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'target', - iconPathOff: 'security', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -135 - }, - { - action: 'Tense / Untense', - actionFunction: floatingObject.tensionToggle, - actionStatus: floatingObject.getTensionStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'compass', - iconPathOff: 'headphones', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 180 - }, - { - action: 'Freeze / Unfreeze', - actionFunction: floatingObject.freezeToggle, - actionStatus: floatingObject.getFreezeStatus, - currentStatus: true, - label: undefined, - visible: false, - iconPathOn: 'targeting', - iconPathOff: 'broken-link', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 135 - }, + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( { action: 'Add Missing Stages', actionFunction: payload.onMenuItemClick, @@ -487,7 +390,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: -40 - }, + } + ) + menuItemsInitialValues.push( { action: 'Delete Strategy', askConfirmation: true, @@ -501,7 +406,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 0 - }, + } + ) + menuItemsInitialValues.push( { action: 'Download', actionFunction: payload.onMenuItemClick, @@ -513,7 +420,8 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 40 - }] + } + ) break } case 'Trigger Stage': { @@ -601,49 +509,8 @@ function newStrategyPartConstructor () { break } case 'Open Stage': { - menuItemsInitialValues = [ - { - action: 'Pin / Unpin', - actionFunction: floatingObject.pinToggle, - actionStatus: floatingObject.getPinStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'target', - iconPathOff: 'security', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -135 - }, - { - action: 'Tense / Untense', - actionFunction: floatingObject.tensionToggle, - actionStatus: floatingObject.getTensionStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'compass', - iconPathOff: 'headphones', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 180 - }, - { - action: 'Freeze / Unfreeze', - actionFunction: floatingObject.freezeToggle, - actionStatus: floatingObject.getFreezeStatus, - currentStatus: true, - label: undefined, - visible: false, - iconPathOn: 'targeting', - iconPathOff: 'broken-link', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 135 - }, + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( { action: 'Add Initial Definition', actionFunction: payload.onMenuItemClick, @@ -655,7 +522,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: -40 - }, + } + ) + menuItemsInitialValues.push( { action: 'Delete Open Stage', askConfirmation: true, @@ -669,7 +538,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 0 - }, + } + ) + menuItemsInitialValues.push( { action: 'Download', actionFunction: payload.onMenuItemClick, @@ -681,53 +552,13 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 40 - }] + } + ) break } case 'Manage Stage': { - menuItemsInitialValues = [ - { - action: 'Pin / Unpin', - actionFunction: floatingObject.pinToggle, - actionStatus: floatingObject.getPinStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'target', - iconPathOff: 'security', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -135 - }, - { - action: 'Tense / Untense', - actionFunction: floatingObject.tensionToggle, - actionStatus: floatingObject.getTensionStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'compass', - iconPathOff: 'headphones', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 180 - }, - { - action: 'Freeze / Unfreeze', - actionFunction: floatingObject.freezeToggle, - actionStatus: floatingObject.getFreezeStatus, - currentStatus: true, - label: undefined, - visible: false, - iconPathOn: 'targeting', - iconPathOff: 'broken-link', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 135 - }, + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( { action: 'Add Missing Items', actionFunction: payload.onMenuItemClick, @@ -739,7 +570,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: -40 - }, + } + ) + menuItemsInitialValues.push( { action: 'Delete Manage Stage', askConfirmation: true, @@ -753,7 +586,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 0 - }, + } + ) + menuItemsInitialValues.push( { action: 'Download', actionFunction: payload.onMenuItemClick, @@ -765,53 +600,13 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 40 - }] + } + ) break } case 'Close Stage': { - menuItemsInitialValues = [ - { - action: 'Pin / Unpin', - actionFunction: floatingObject.pinToggle, - actionStatus: floatingObject.getPinStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'target', - iconPathOff: 'security', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -135 - }, - { - action: 'Tense / Untense', - actionFunction: floatingObject.tensionToggle, - actionStatus: floatingObject.getTensionStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'compass', - iconPathOff: 'headphones', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 180 - }, - { - action: 'Freeze / Unfreeze', - actionFunction: floatingObject.freezeToggle, - actionStatus: floatingObject.getFreezeStatus, - currentStatus: true, - label: undefined, - visible: false, - iconPathOn: 'targeting', - iconPathOff: 'broken-link', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 135 - }, + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( { action: 'Delete Close Stage', askConfirmation: true, @@ -825,7 +620,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: -20 - }, + } + ) + menuItemsInitialValues.push( { action: 'Download', actionFunction: payload.onMenuItemClick, @@ -837,53 +634,13 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 20 - }] + } + ) break } case 'Position Size': { - menuItemsInitialValues = [ - { - action: 'Pin / Unpin', - actionFunction: floatingObject.pinToggle, - actionStatus: floatingObject.getPinStatus, - currentStatus: true, - label: undefined, - visible: false, - iconPathOn: 'target', - iconPathOff: 'security', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -135 - }, - { - action: 'Tense / Untense', - actionFunction: floatingObject.tensionToggle, - actionStatus: floatingObject.getTensionStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'compass', - iconPathOff: 'headphones', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 180 - }, - { - action: 'Freeze / Unfreeze', - actionFunction: floatingObject.freezeToggle, - actionStatus: floatingObject.getFreezeStatus, - currentStatus: true, - label: undefined, - visible: false, - iconPathOn: 'targeting', - iconPathOff: 'broken-link', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 135 - }, + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( { action: 'Delete Position Size', askConfirmation: true, @@ -897,7 +654,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: -40 - }, + } + ) + menuItemsInitialValues.push( { action: 'Add Formula', actionFunction: payload.onMenuItemClick, @@ -910,7 +669,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 0 - }, + } + ) + menuItemsInitialValues.push( { action: 'Download', actionFunction: payload.onMenuItemClick, @@ -922,53 +683,13 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 40 - }] + } + ) break } case 'Position Rate': { - menuItemsInitialValues = [ - { - action: 'Pin / Unpin', - actionFunction: floatingObject.pinToggle, - actionStatus: floatingObject.getPinStatus, - currentStatus: true, - label: undefined, - visible: false, - iconPathOn: 'target', - iconPathOff: 'security', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -135 - }, - { - action: 'Tense / Untense', - actionFunction: floatingObject.tensionToggle, - actionStatus: floatingObject.getTensionStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'compass', - iconPathOff: 'headphones', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 180 - }, - { - action: 'Freeze / Unfreeze', - actionFunction: floatingObject.freezeToggle, - actionStatus: floatingObject.getFreezeStatus, - currentStatus: true, - label: undefined, - visible: false, - iconPathOn: 'targeting', - iconPathOff: 'broken-link', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 135 - }, + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( { action: 'Delete Position Rate', askConfirmation: true, @@ -982,7 +703,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: -40 - }, + } + ) + menuItemsInitialValues.push( { action: 'Add Formula', actionFunction: payload.onMenuItemClick, @@ -995,7 +718,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 0 - }, + } + ) + menuItemsInitialValues.push( { action: 'Download', actionFunction: payload.onMenuItemClick, @@ -1007,53 +732,13 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 40 - }] + } + ) break } case 'Trigger On Event': { - menuItemsInitialValues = [ - { - action: 'Pin / Unpin', - actionFunction: floatingObject.pinToggle, - actionStatus: floatingObject.getPinStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'target', - iconPathOff: 'security', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -135 - }, - { - action: 'Tense / Untense', - actionFunction: floatingObject.tensionToggle, - actionStatus: floatingObject.getTensionStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'compass', - iconPathOff: 'headphones', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 180 - }, - { - action: 'Freeze / Unfreeze', - actionFunction: floatingObject.freezeToggle, - actionStatus: floatingObject.getFreezeStatus, - currentStatus: true, - label: undefined, - visible: false, - iconPathOn: 'targeting', - iconPathOff: 'broken-link', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 135 - }, + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( { action: 'Add Situation', actionFunction: payload.onMenuItemClick, @@ -1066,7 +751,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: -40 - }, + } + ) + menuItemsInitialValues.push( { action: 'Delete Event', askConfirmation: true, @@ -1080,7 +767,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 0 - }, + } + ) + menuItemsInitialValues.push( { action: 'Download', actionFunction: payload.onMenuItemClick, @@ -1092,53 +781,13 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 40 - }] + } + ) break } case 'Trigger Off Event': { - menuItemsInitialValues = [ - { - action: 'Pin / Unpin', - actionFunction: floatingObject.pinToggle, - actionStatus: floatingObject.getPinStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'target', - iconPathOff: 'security', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -135 - }, - { - action: 'Tense / Untense', - actionFunction: floatingObject.tensionToggle, - actionStatus: floatingObject.getTensionStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'compass', - iconPathOff: 'headphones', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 180 - }, - { - action: 'Freeze / Unfreeze', - actionFunction: floatingObject.freezeToggle, - actionStatus: floatingObject.getFreezeStatus, - currentStatus: true, - label: undefined, - visible: false, - iconPathOn: 'targeting', - iconPathOff: 'broken-link', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 135 - }, + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( { action: 'Add Situation', actionFunction: payload.onMenuItemClick, @@ -1151,7 +800,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: -40 - }, + } + ) + menuItemsInitialValues.push( { action: 'Delete Event', askConfirmation: true, @@ -1165,7 +816,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 0 - }, + } + ) + menuItemsInitialValues.push( { action: 'Download', actionFunction: payload.onMenuItemClick, @@ -1177,53 +830,13 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 40 - }] + } + ) break } case 'Take Position Event': { - menuItemsInitialValues = [ - { - action: 'Pin / Unpin', - actionFunction: floatingObject.pinToggle, - actionStatus: floatingObject.getPinStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'target', - iconPathOff: 'security', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -135 - }, - { - action: 'Tense / Untense', - actionFunction: floatingObject.tensionToggle, - actionStatus: floatingObject.getTensionStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'compass', - iconPathOff: 'headphones', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 180 - }, - { - action: 'Freeze / Unfreeze', - actionFunction: floatingObject.freezeToggle, - actionStatus: floatingObject.getFreezeStatus, - currentStatus: true, - label: undefined, - visible: false, - iconPathOn: 'targeting', - iconPathOff: 'broken-link', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 135 - }, + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( { action: 'Add Situation', actionFunction: payload.onMenuItemClick, @@ -1236,7 +849,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: -40 - }, + } + ) + menuItemsInitialValues.push( { action: 'Delete Event', askConfirmation: true, @@ -1250,7 +865,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 0 - }, + } + ) + menuItemsInitialValues.push( { action: 'Download', actionFunction: payload.onMenuItemClick, @@ -1262,53 +879,13 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 40 - }] + } + ) break } case 'Initial Definition': { - menuItemsInitialValues = [ - { - action: 'Pin / Unpin', - actionFunction: floatingObject.pinToggle, - actionStatus: floatingObject.getPinStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'target', - iconPathOff: 'security', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -135 - }, - { - action: 'Tense / Untense', - actionFunction: floatingObject.tensionToggle, - actionStatus: floatingObject.getTensionStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'compass', - iconPathOff: 'headphones', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 180 - }, - { - action: 'Freeze / Unfreeze', - actionFunction: floatingObject.freezeToggle, - actionStatus: floatingObject.getFreezeStatus, - currentStatus: true, - label: undefined, - visible: false, - iconPathOn: 'targeting', - iconPathOff: 'broken-link', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 135 - }, + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( { action: 'Add Missing Items', actionFunction: payload.onMenuItemClick, @@ -1320,7 +897,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: -40 - }, + } + ) + menuItemsInitialValues.push( { action: 'Delete Initial Definition', askConfirmation: true, @@ -1334,7 +913,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 0 - }, + } + ) + menuItemsInitialValues.push( { action: 'Download', actionFunction: payload.onMenuItemClick, @@ -1346,53 +927,13 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 40 - }] + } + ) break } case 'Stop': { - menuItemsInitialValues = [ - { - action: 'Pin / Unpin', - actionFunction: floatingObject.pinToggle, - actionStatus: floatingObject.getPinStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'target', - iconPathOff: 'security', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -135 - }, - { - action: 'Tense / Untense', - actionFunction: floatingObject.tensionToggle, - actionStatus: floatingObject.getTensionStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'compass', - iconPathOff: 'headphones', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 180 - }, - { - action: 'Freeze / Unfreeze', - actionFunction: floatingObject.freezeToggle, - actionStatus: floatingObject.getFreezeStatus, - currentStatus: true, - label: undefined, - visible: false, - iconPathOn: 'targeting', - iconPathOff: 'broken-link', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 135 - }, + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( { action: 'Add Phase', actionFunction: payload.onMenuItemClick, @@ -1405,7 +946,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: -40 - }, + } + ) + menuItemsInitialValues.push( { action: 'Delete Managed Item', askConfirmation: true, @@ -1419,7 +962,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 0 - }, + } + ) + menuItemsInitialValues.push( { action: 'Download', actionFunction: payload.onMenuItemClick, @@ -1431,53 +976,13 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 40 - }] + } + ) break } case 'Take Profit': { - menuItemsInitialValues = [ - { - action: 'Pin / Unpin', - actionFunction: floatingObject.pinToggle, - actionStatus: floatingObject.getPinStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'target', - iconPathOff: 'security', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -135 - }, - { - action: 'Tense / Untense', - actionFunction: floatingObject.tensionToggle, - actionStatus: floatingObject.getTensionStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'compass', - iconPathOff: 'headphones', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 180 - }, - { - action: 'Freeze / Unfreeze', - actionFunction: floatingObject.freezeToggle, - actionStatus: floatingObject.getFreezeStatus, - currentStatus: true, - label: undefined, - visible: false, - iconPathOn: 'targeting', - iconPathOff: 'broken-link', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 135 - }, + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( { action: 'Add Phase', actionFunction: payload.onMenuItemClick, @@ -1490,7 +995,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: -40 - }, + } + ) + menuItemsInitialValues.push( { action: 'Delete Managed Item', askConfirmation: true, @@ -1504,7 +1011,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 0 - }, + } + ) + menuItemsInitialValues.push( { action: 'Download', actionFunction: payload.onMenuItemClick, @@ -1516,53 +1025,13 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 40 - }] + } + ) break } case 'Phase': { - menuItemsInitialValues = [ - { - action: 'Pin / Unpin', - actionFunction: floatingObject.pinToggle, - actionStatus: floatingObject.getPinStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'target', - iconPathOff: 'security', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -135 - }, - { - action: 'Tense / Untense', - actionFunction: floatingObject.tensionToggle, - actionStatus: floatingObject.getTensionStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'compass', - iconPathOff: 'headphones', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 180 - }, - { - action: 'Freeze / Unfreeze', - actionFunction: floatingObject.freezeToggle, - actionStatus: floatingObject.getFreezeStatus, - currentStatus: true, - label: undefined, - visible: false, - iconPathOn: 'targeting', - iconPathOff: 'broken-link', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 135 - }, + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( { action: 'Add Formula', actionFunction: payload.onMenuItemClick, @@ -1575,7 +1044,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: -60 - }, + } + ) + menuItemsInitialValues.push( { action: 'Add Next Phase Event', actionFunction: payload.onMenuItemClick, @@ -1588,7 +1059,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: -20 - }, + } + ) + menuItemsInitialValues.push( { action: 'Delete Phase', askConfirmation: true, @@ -1602,7 +1075,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 20 - }, + } + ) + menuItemsInitialValues.push( { action: 'Download', actionFunction: payload.onMenuItemClick, @@ -1614,7 +1089,8 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 60 - }] + } + ) break } case 'Formula': { @@ -1623,49 +1099,8 @@ function newStrategyPartConstructor () { strategyPart.codeEditor.initialize() strategyPart.codeEditor.container.connectToParent(strategyPart.container, false, false, true, true, false, false, false, false) - menuItemsInitialValues = [ - { - action: 'Pin / Unpin', - actionFunction: floatingObject.pinToggle, - actionStatus: floatingObject.getPinStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'target', - iconPathOff: 'security', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -135 - }, - { - action: 'Tense / Untense', - actionFunction: floatingObject.tensionToggle, - actionStatus: floatingObject.getTensionStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'compass', - iconPathOff: 'headphones', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 180 - }, - { - action: 'Freeze / Unfreeze', - actionFunction: floatingObject.freezeToggle, - actionStatus: floatingObject.getFreezeStatus, - currentStatus: true, - label: undefined, - visible: false, - iconPathOn: 'targeting', - iconPathOff: 'broken-link', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 135 - }, + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( { action: 'Edit Formula', actionFunction: strategyPart.codeEditor.activate, @@ -1678,7 +1113,9 @@ function newStrategyPartConstructor () { currentRadius: 0, angle: -40, dontShowAtFullscreen: true - }, + } + ) + menuItemsInitialValues.push( { action: 'Delete Formula', askConfirmation: true, @@ -1692,7 +1129,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 0 - }, + } + ) + menuItemsInitialValues.push( { action: 'Download', actionFunction: payload.onMenuItemClick, @@ -1704,53 +1143,13 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 40 - }] + } + ) break } case 'Next Phase Event': { - menuItemsInitialValues = [ - { - action: 'Pin / Unpin', - actionFunction: floatingObject.pinToggle, - actionStatus: floatingObject.getPinStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'target', - iconPathOff: 'security', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -135 - }, - { - action: 'Tense / Untense', - actionFunction: floatingObject.tensionToggle, - actionStatus: floatingObject.getTensionStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'compass', - iconPathOff: 'headphones', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 180 - }, - { - action: 'Freeze / Unfreeze', - actionFunction: floatingObject.freezeToggle, - actionStatus: floatingObject.getFreezeStatus, - currentStatus: true, - label: undefined, - visible: false, - iconPathOn: 'targeting', - iconPathOff: 'broken-link', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 135 - }, + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( { action: 'Add Situation', actionFunction: payload.onMenuItemClick, @@ -1763,7 +1162,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: -40 - }, + } + ) + menuItemsInitialValues.push( { action: 'Delete Event', askConfirmation: true, @@ -1777,7 +1178,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 0 - }, + } + ) + menuItemsInitialValues.push( { action: 'Download', actionFunction: payload.onMenuItemClick, @@ -1789,53 +1192,13 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 40 - }] + } + ) break } case 'Situation': { - menuItemsInitialValues = [ - { - action: 'Pin / Unpin', - actionFunction: floatingObject.pinToggle, - actionStatus: floatingObject.getPinStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'target', - iconPathOff: 'security', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -135 - }, - { - action: 'Tense / Untense', - actionFunction: floatingObject.tensionToggle, - actionStatus: floatingObject.getTensionStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'compass', - iconPathOff: 'headphones', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 180 - }, - { - action: 'Freeze / Unfreeze', - actionFunction: floatingObject.freezeToggle, - actionStatus: floatingObject.getFreezeStatus, - currentStatus: true, - label: undefined, - visible: false, - iconPathOn: 'targeting', - iconPathOff: 'broken-link', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 135 - }, + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( { action: 'Add Condition', actionFunction: payload.onMenuItemClick, @@ -1848,7 +1211,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: -40 - }, + } + ) + menuItemsInitialValues.push( { action: 'Delete Situation', askConfirmation: true, @@ -1862,7 +1227,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 0 - }, + } + ) + menuItemsInitialValues.push( { action: 'Download', actionFunction: payload.onMenuItemClick, @@ -1874,53 +1241,13 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 40 - }] + } + ) break } case 'Condition': { - menuItemsInitialValues = [ - { - action: 'Pin / Unpin', - actionFunction: floatingObject.pinToggle, - actionStatus: floatingObject.getPinStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'target', - iconPathOff: 'security', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -135 - }, - { - action: 'Tense / Untense', - actionFunction: floatingObject.tensionToggle, - actionStatus: floatingObject.getTensionStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'compass', - iconPathOff: 'headphones', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 180 - }, - { - action: 'Freeze / Unfreeze', - actionFunction: floatingObject.freezeToggle, - actionStatus: floatingObject.getFreezeStatus, - currentStatus: true, - label: undefined, - visible: false, - iconPathOn: 'targeting', - iconPathOff: 'broken-link', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 135 - }, + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( { action: 'Add Code', actionFunction: payload.onMenuItemClick, @@ -1933,7 +1260,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: -40 - }, + } + ) + menuItemsInitialValues.push( { action: 'Delete Condition', askConfirmation: true, @@ -1947,7 +1276,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 0 - }, + } + ) + menuItemsInitialValues.push( { action: 'Download', actionFunction: payload.onMenuItemClick, @@ -1959,7 +1290,8 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 40 - }] + } + ) break } case 'Code': { @@ -1968,49 +1300,8 @@ function newStrategyPartConstructor () { strategyPart.codeEditor.initialize() strategyPart.codeEditor.container.connectToParent(strategyPart.container, false, false, true, true, false, false, false, false) - menuItemsInitialValues = [ - { - action: 'Pin / Unpin', - actionFunction: floatingObject.pinToggle, - actionStatus: floatingObject.getPinStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'target', - iconPathOff: 'security', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -135 - }, - { - action: 'Tense / Untense', - actionFunction: floatingObject.tensionToggle, - actionStatus: floatingObject.getTensionStatus, - currentStatus: false, - label: undefined, - visible: false, - iconPathOn: 'compass', - iconPathOff: 'headphones', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 180 - }, - { - action: 'Freeze / Unfreeze', - actionFunction: floatingObject.freezeToggle, - actionStatus: floatingObject.getFreezeStatus, - currentStatus: true, - label: undefined, - visible: false, - iconPathOn: 'targeting', - iconPathOff: 'broken-link', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 135 - }, + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( { action: 'Edit Code', actionFunction: strategyPart.codeEditor.activate, @@ -2023,7 +1314,9 @@ function newStrategyPartConstructor () { currentRadius: 0, angle: -40, dontShowAtFullscreen: true - }, + } + ) + menuItemsInitialValues.push( { action: 'Delete Code', askConfirmation: true, @@ -2037,7 +1330,9 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 0 - }, + } + ) + menuItemsInitialValues.push( { action: 'Download', actionFunction: payload.onMenuItemClick, @@ -2049,7 +1344,8 @@ function newStrategyPartConstructor () { targetRadius: 0, currentRadius: 0, angle: 40 - }] + } + ) break } default: { From 656dc3be4a6e7b3a2b995cc85aa9d049974ebddf Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 13 Jul 2019 15:57:50 +0200 Subject: [PATCH 4/4] 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: {