From 769395fb729b700a363bd8f81342d0ecb030699e Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 10 May 2019 08:46:07 +0200 Subject: [PATCH] Removing list of strategies on side panel --- Spaces/StrategySpace.js | 15 +++++---- StrategySpace/StrategyCollection.js | 47 +++++------------------------ 2 files changed, 14 insertions(+), 48 deletions(-) diff --git a/Spaces/StrategySpace.js b/Spaces/StrategySpace.js index 18c73f82d..0b683f576 100644 --- a/Spaces/StrategySpace.js +++ b/Spaces/StrategySpace.js @@ -3,7 +3,7 @@ function newStrategySpace () { const MODULE_NAME = 'Strategy Space' let thisObject = { sidePanel: undefined, - strategyCollection: undefined, + investmentPlanWorkspace: undefined, container: undefined, draw: draw, getContainer: getContainer, @@ -22,18 +22,18 @@ function newStrategySpace () { thisObject.sidePanel = newSidePanel() thisObject.sidePanel.initialize() - thisObject.strategyCollection = newStrategyCollection() - thisObject.strategyCollection.container.connectToParent(thisObject.sidePanel.container, true, true) - await thisObject.strategyCollection.initialize() + thisObject.investmentPlanWorkspace = newInvestmentPlanWorkspace() + thisObject.investmentPlanWorkspace.container.connectToParent(thisObject.sidePanel.container, true, true) + await thisObject.investmentPlanWorkspace.initialize() - thisObject.sidePanel.areas.push(thisObject.strategyCollection) + thisObject.sidePanel.areas.push(thisObject.investmentPlanWorkspace) } function getContainer (point) { let container - if (thisObject.strategyCollection !== undefined) { - container = thisObject.strategyCollection.getContainer(point) + if (thisObject.investmentPlanWorkspace !== undefined) { + container = thisObject.investmentPlanWorkspace.getContainer(point) if (container !== undefined) { return container } } @@ -49,4 +49,3 @@ function newStrategySpace () { thisObject.sidePanel.draw() } } - diff --git a/StrategySpace/StrategyCollection.js b/StrategySpace/StrategyCollection.js index 727e0d77d..c5fb45744 100644 --- a/StrategySpace/StrategyCollection.js +++ b/StrategySpace/StrategyCollection.js @@ -1,6 +1,6 @@ -function newStrategyCollection () { - const MODULE_NAME = 'Strategy Collection' +function newInvestmentPlanWorkspace () { + const MODULE_NAME = 'Investment Plan Workspace' const ERROR_LOG = true const logger = newWebDebugLog() logger.fileName = MODULE_NAME @@ -94,7 +94,7 @@ function newStrategyCollection () { .then(response => { window.localStorage.setItem('userStrategies', JSON.stringify(response.data.strategizer_StrategyByFb.subStrategies)) thisObject.strategies = JSON.parse(JSON.stringify(response.data.strategizer_StrategyByFb.subStrategies)) - createCollectionItems() + deploydInvestmentPlan() resolve({ strategies: response.data.strategizer_StrategyByFb.subStrategies}) }) .catch(error => { @@ -120,52 +120,19 @@ function newStrategyCollection () { } } - function createCollectionItems () { - const TOP_MARGIN = 100 - const ITEMS_SEPARATION = 90 - - for (let i = 0; i < thisObject.strategies.length; i++) { - let strategy = thisObject.strategies[i] - let collectionItem = newStrategyCollectionItem() - - collectionItem.container.connectToParent(thisObject.container, false, false) - collectionItem.initialize(thisObject.strategies) - collectionItem.container.frame.position.y = i * ITEMS_SEPARATION + TOP_MARGIN - - colletionItems.push(collectionItem) - - /* Load Strategies Icons */ - - let imageIndex = i + 1 - if (imageIndex > 14) { imageIndex = 14 } - - let strategyImage = loadEmoji('Symbols/Emoji Symbols-' + (112 + imageIndex) + '.png') - collectionItem.icon = strategyImage - } + function deploydInvestmentPlan () { + canvas.floatingSpace.makeVisible() + thisObject.strategy = newInvestmentPlan() + thisObject.strategy.initialize(thisObject.strategySource) } function getContainer (point) { let container - for (let i = 0; i < colletionItems.length; i++) { - let item = colletionItems[i] - container = item.getContainer(point) - if (container !== undefined) { - return container - } - } - return undefined } function draw () { - if (colletionItems === undefined) { - return - } - for (let i = 0; i < colletionItems.length; i++) { - let item = colletionItems[i] - item.draw() - } } }