From 9cf9eab2a6bc5fe9b71a2797f8a557b68a06630b Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 23 Mar 2020 20:14:47 +0100 Subject: [PATCH 01/56] Bug fixed --- FloatingSpace/FloatingLayer.js | 17 ++++++++++++++++- FloatingSpace/FloatingObject.js | 7 +++++++ FloatingSpace/UiObject.js | 5 +++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/FloatingSpace/FloatingLayer.js b/FloatingSpace/FloatingLayer.js index 8be7ec11f..4aa24da3e 100644 --- a/FloatingSpace/FloatingLayer.js +++ b/FloatingSpace/FloatingLayer.js @@ -265,8 +265,24 @@ function newFloatingLayer () { try { makeVisible() makeInvisible() + invisiblePhysics() + visiblePhysics() applyPhysics() + function invisiblePhysics () { + for (let i = 0; i < invisibleFloatingObjects.length; i++) { + let floatingObject = invisibleFloatingObjects[i] + floatingObject.invisiblePhysics() + } + } + + function visiblePhysics () { + for (let i = 0; i < visibleFloatingObjects.length; i++) { + let floatingObject = visibleFloatingObjects[i] + floatingObject.physics() + } + } + function applyPhysics () { /* This function makes all the calculations to apply phisycs on all visible floatingObjects in this layer. */ @@ -276,7 +292,6 @@ function newFloatingLayer () { for (let i = 0; i < visibleFloatingObjects.length; i++) { let floatingObject = visibleFloatingObjects[i] - floatingObject.physics() /* From here on, only if they are not too far. */ if (canvas.floatingSpace.isItFar(floatingObject.payload)) { continue } diff --git a/FloatingSpace/FloatingObject.js b/FloatingSpace/FloatingObject.js index cd4f32a8f..6a4c8ea35 100644 --- a/FloatingSpace/FloatingObject.js +++ b/FloatingSpace/FloatingObject.js @@ -41,6 +41,7 @@ function newFloatingObject () { angleToParentToggle: angleToParentToggle, distanceToParentToggle: distanceToParentToggle, physics: physics, + invisiblePhysics: invisiblePhysics, initializeMass: initializeMass, initializeRadius: initializeRadius, initializeImageSize: initializeImageSize, @@ -220,6 +221,12 @@ function newFloatingObject () { return thisObject.distanceToParent } + function invisiblePhysics () { + if (thisObject.payload.uiObject !== undefined) { + thisObject.payload.uiObject.invisiblePhysics() + } + } + function physics () { frozenPhysics() /* From here on, only if they are not too far. */ diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index 67c1d812f..10fbee7f0 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -36,6 +36,7 @@ function newUiObject () { setPercentage: setPercentage, setStatus: setStatus, physics: physics, + invisiblePhysics: invisiblePhysics, drawBackground: drawBackground, drawMiddleground: drawMiddleground, drawForeground: drawForeground, @@ -256,6 +257,10 @@ function newUiObject () { } } + function invisiblePhysics () { + childrenRunningPhysics() + } + function physics () { thisObject.menu.physics() thisObject.uiObjectTitle.physics() From c88b79cff5e91490d15873707c4833679be25475 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 23 Mar 2020 20:56:04 +0100 Subject: [PATCH 02/56] improvement no ring --- FloatingSpace/CircularProgressBar.js | 5 +++++ FloatingSpace/UiObject.js | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/FloatingSpace/CircularProgressBar.js b/FloatingSpace/CircularProgressBar.js index 5a9c64d8d..07973d7ee 100644 --- a/FloatingSpace/CircularProgressBar.js +++ b/FloatingSpace/CircularProgressBar.js @@ -25,6 +25,8 @@ function newCircularProgressBar () { let eventSubscriptionIdHeartbeat + let needToDrawRing = true + return thisObject function finalize () { @@ -62,6 +64,7 @@ function newCircularProgressBar () { thisObject.payload.uiObject.setPercentage(message.event.percentage, 2000) } if (message.event.status !== undefined) { + needToDrawRing = false thisObject.payload.uiObject.setStatus(message.event.status, 200000) } @@ -95,6 +98,8 @@ function newCircularProgressBar () { function drawBackground (pFloatingObject) { if (canvas.floatingSpace.inMapMode === true) { return } + if (needToDrawRing !== true) { return } + const VISIBLE_RADIUS = thisObject.container.frame.radius * 2 let visiblePosition = { diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index 10fbee7f0..96955b532 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -751,7 +751,7 @@ function newUiObject () { thisObject.circularProgressBar.fitFunction = thisObject.fitFunction thisObject.circularProgressBar.container = thisObject.container - /* We will wait to hear the first onHeartBeat in order to confirm the execution was really started */ + /* We will wait to hear the Running event in order to confirm the execution was really started */ let key = thisObject.payload.node.name + '-' + thisObject.payload.node.type + '-' + thisObject.payload.node.id systemEventHandler.listenToEvent(key, 'Running', undefined, 'UiObject', onResponse, onRunning) @@ -1371,7 +1371,7 @@ function newUiObject () { position = canvas.floatingSpace.transformPointToMap(position) } - let radius = thisObject.container.frame.radius * 1.4 + let radius = thisObject.container.frame.radius * 0.9 /* Label Text */ let labelPoint let fontSize = thisObject.payload.floatingObject.currentFontSize * 6 / 4 / 2 @@ -1389,7 +1389,7 @@ function newUiObject () { labelPoint = { x: position.x - label.length / 2 * fontSize * FONT_ASPECT_RATIO - 10, - y: position.y - radius * 7 / 5 + fontSize * FONT_ASPECT_RATIO + 15 + y: position.y + radius * 7 / 5 + fontSize * FONT_ASPECT_RATIO + 15 } browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY From 144a7f5aa26555dc2d55f49ad0e55763d72504f0 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 24 Mar 2020 16:10:15 +0100 Subject: [PATCH 03/56] Bug fixed --- ChartingSpace/CoordinateSystem.js | 4 ++++ ChartingSpace/TimelineChart.js | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/ChartingSpace/CoordinateSystem.js b/ChartingSpace/CoordinateSystem.js index 4fbfc24bd..4e28a1716 100644 --- a/ChartingSpace/CoordinateSystem.js +++ b/ChartingSpace/CoordinateSystem.js @@ -105,6 +105,10 @@ function newCoordinateSystem () { /* Reseting this to start over at each cycle. */ noXValueReported = true + + if (mustRecalculate === true) { + thisObject.eventHandler.raiseEvent('X-Range Changed') + } } if ((thisObject.autoMinYScale === true || thisObject.autoMaxYScale === true) && noYValueReported === false) { diff --git a/ChartingSpace/TimelineChart.js b/ChartingSpace/TimelineChart.js index f827726c0..44e96a02a 100644 --- a/ChartingSpace/TimelineChart.js +++ b/ChartingSpace/TimelineChart.js @@ -43,6 +43,7 @@ function newTimelineChart () { let timeFrameScaleEventSuscriptionId let timeFrameScaleMouseOverEventSuscriptionId let scaleChangedEventSubscriptionId + let xRangeChangedEventSubscriptionId let drawScales = false let mouse = { @@ -63,6 +64,7 @@ function newTimelineChart () { function finalize () { coordinateSystem.eventHandler.stopListening(scaleChangedEventSubscriptionId) + timelineChartCoordinateSystem.eventHandler.stopListening(xRangeChangedEventSubscriptionId) if (thisObject.layersManager !== undefined) { finalizeLayersManager() @@ -145,6 +147,7 @@ function newTimelineChart () { onMouseOverEventSuscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseOver', onMouseOver) onMouseNotOverEventSuscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseNotOver', onMouseNotOver) scaleChangedEventSubscriptionId = timeMachineCoordinateSystem.eventHandler.listenToEvent('Scale Changed', onScaleChanged) + xRangeChangedEventSubscriptionId = timelineChartCoordinateSystem.eventHandler.listenToEvent('X-Range Changed', xRangeChanged) } function initializeCoordinateSystem () { @@ -231,6 +234,15 @@ function newTimelineChart () { } } + function xRangeChanged (event) { + if (thisObject.rateScale !== undefined) { + /* We need to re trasmit the changes on the x Range of the timelinechart coordinate system to the time machine coordinate system so that its scale is syncronized. */ + timeMachineCoordinateSystem.min.x = timelineChartCoordinateSystem.min.x + timeMachineCoordinateSystem.max.x = timelineChartCoordinateSystem.max.x + timeMachineCoordinateSystem.recalculateScale() + } + } + function onScaleChanged (event) { if (thisObject.rateScale !== undefined) { thisObject.rateScale.onUpstreamScaleChanged(event) From 6512d479b3a87f6a221b9eb59a5bdb589f4cc939 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 24 Mar 2020 16:15:45 +0100 Subject: [PATCH 04/56] bug fixed --- ChartingSpace/Viewport.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ChartingSpace/Viewport.js b/ChartingSpace/Viewport.js index 27f59ef1c..4564b86ac 100644 --- a/ChartingSpace/Viewport.js +++ b/ChartingSpace/Viewport.js @@ -61,7 +61,7 @@ function newViewport () { /* Initial default value */ thisObject.zoomLevel = MIN_ZOOM_LEVEL - thisObject.zoomTargetLevel = MIN_ZOOM_LEVEL + thisObject.zoomTargetLevel = Math.round(MIN_ZOOM_LEVEL) INITIAL_TIME_PERIOD = recalculatePeriod(thisObject.zoomLevel) let overrideMousePositionCounter = 0 @@ -144,7 +144,7 @@ function newViewport () { } function zoomAtCenter (level) { - thisObject.zoomTargetLevel = level + thisObject.zoomTargetLevel = Math.roung(level) overrideMousePositionCounter = 50 ANIMATION_INCREMENT = 0.5 } @@ -220,7 +220,7 @@ function newViewport () { if (thisObject.zoomTargetLevel + amount * morePower < MIN_ZOOM_LEVEL) { return false } - thisObject.zoomTargetLevel = Math.round((thisObject.zoomTargetLevel + amount * morePower) * MAC_AMOUNT_FACTOR) / MAC_AMOUNT_FACTOR + thisObject.zoomTargetLevel = Math.round(Math.round((thisObject.zoomTargetLevel + amount * morePower) * MAC_AMOUNT_FACTOR) / MAC_AMOUNT_FACTOR) ANIMATION_INCREMENT = Math.round(Math.abs(thisObject.zoomTargetLevel - thisObject.zoomLevel) / ANIMATION_STEPS * 100) / 100 @@ -398,7 +398,7 @@ function newViewport () { function newZoomLevel (level) { thisObject.zoomLevel = Math.round(level) - thisObject.zoomTargetLevel = level + thisObject.zoomTargetLevel = Math.round(level) INITIAL_TIME_PERIOD = recalculatePeriod(level) saveObjectState() ANIMATION_INCREMENT = 0 From bd0d1a1751314c870711c0fbd5d38b8dfa7d601c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 24 Mar 2020 21:05:36 +0100 Subject: [PATCH 05/56] Update Viewport.js --- ChartingSpace/Viewport.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChartingSpace/Viewport.js b/ChartingSpace/Viewport.js index 4564b86ac..d51df170b 100644 --- a/ChartingSpace/Viewport.js +++ b/ChartingSpace/Viewport.js @@ -144,7 +144,7 @@ function newViewport () { } function zoomAtCenter (level) { - thisObject.zoomTargetLevel = Math.roung(level) + thisObject.zoomTargetLevel = Math.round(level) overrideMousePositionCounter = 50 ANIMATION_INCREMENT = 0.5 } From 45fcea65e0992ba4ad17dd9467e57381cbc373c2 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 25 Mar 2020 15:34:01 +0100 Subject: [PATCH 06/56] Update PlotterPanel.js --- Panels/PlotterPanel.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Panels/PlotterPanel.js b/Panels/PlotterPanel.js index 9dde50073..93091b1e7 100644 --- a/Panels/PlotterPanel.js +++ b/Panels/PlotterPanel.js @@ -113,18 +113,20 @@ function newPlotterPanel () { } } + printLabel('Indicator Properties', X_AXIS, PANEL_HEIGHT * 17 / 100 / 1.25, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction) + /* Second we go through the panel data. */ if (panelNode.panelData === undefined) { return } for (let i = 0; i < panelNode.panelData.length; i++) { let panelData = panelNode.panelData[i] let labelText = panelData.name - let labelPosition = i * 10 + 10 - let valuePosition = i * 10 + 15 + let labelPosition = i * 10 + 25 + let valuePosition = i * 10 + 30 let value = 'No value defined.' if (valuePosition > 100) { - heightFactor = 2 + heightFactor = 1.25 thisObject.container.frame.height = UI_PANEL.HEIGHT.NORMAL * heightFactor } @@ -154,7 +156,7 @@ function newPlotterPanel () { } printLabel(labelText, X_AXIS, PANEL_HEIGHT * labelPosition / 100 / heightFactor, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction) - printLabel(value, X_AXIS, PANEL_HEIGHT * valuePosition / 100 / heightFactor, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction) + printLabel(value, X_AXIS, PANEL_HEIGHT * valuePosition / 100 / heightFactor, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction) } } } From 2fbd1fd783e5ef888e946988e680e88692f5b702 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 26 Mar 2020 09:39:22 +0100 Subject: [PATCH 07/56] Update FloatingLayer.js --- FloatingSpace/FloatingLayer.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/FloatingSpace/FloatingLayer.js b/FloatingSpace/FloatingLayer.js index 4aa24da3e..4653bd532 100644 --- a/FloatingSpace/FloatingLayer.js +++ b/FloatingSpace/FloatingLayer.js @@ -217,7 +217,7 @@ function newFloatingLayer () { collapsePhysics(floatingObject) - if (floatingObject.isFrozen === false && floatingObject.isParentCollapsed === false) { + if (floatingObject.isParentCollapsed === false) { visibleFloatingObjects.push(floatingObject) invisibleFloatingObjects.splice(i, 1) // Delete item from array. makeVisible() @@ -232,7 +232,7 @@ function newFloatingLayer () { collapsePhysics(floatingObject) - if (floatingObject.isFrozen === true || floatingObject.isParentCollapsed === true) { + if (floatingObject.isParentCollapsed === true) { invisibleFloatingObjects.push(floatingObject) visibleFloatingObjects.splice(i, 1) // Delete item from array. makeInvisible() @@ -292,6 +292,7 @@ function newFloatingLayer () { for (let i = 0; i < visibleFloatingObjects.length; i++) { let floatingObject = visibleFloatingObjects[i] + if (floatingObject.isFrozen === true) { continue } /* From here on, only if they are not too far. */ if (canvas.floatingSpace.isItFar(floatingObject.payload)) { continue } From 5df879121adb782fc4ff8bb46b79797ba75acf22 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 26 Mar 2020 13:54:15 +0100 Subject: [PATCH 08/56] bug fixed --- DesignSpace/Workspace/FunctionLibraries/CCXTFunctions.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DesignSpace/Workspace/FunctionLibraries/CCXTFunctions.js b/DesignSpace/Workspace/FunctionLibraries/CCXTFunctions.js index ced087469..f02a1733a 100644 --- a/DesignSpace/Workspace/FunctionLibraries/CCXTFunctions.js +++ b/DesignSpace/Workspace/FunctionLibraries/CCXTFunctions.js @@ -191,6 +191,8 @@ function newCCXTFunctions () { newMarket.baseAsset.payload.referenceParent = baseAsset newMarket.quotedAsset.payload.referenceParent = quotedAsset + currentMarkets.set(name, newMarket) + let superActions = node.payload.parentNode.payload.parentNode.payload.parentNode.superActions for (let j = 0; j < superActions.superActions.length; j++) { From a174ae009c5c4c0557d80d634bb8e871d84e2ebc Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 26 Mar 2020 15:07:30 +0100 Subject: [PATCH 09/56] Update SessionFunctions.js --- DesignSpace/Workspace/FunctionLibraries/SessionFunctions.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DesignSpace/Workspace/FunctionLibraries/SessionFunctions.js b/DesignSpace/Workspace/FunctionLibraries/SessionFunctions.js index 7257e42ba..f8639c67a 100644 --- a/DesignSpace/Workspace/FunctionLibraries/SessionFunctions.js +++ b/DesignSpace/Workspace/FunctionLibraries/SessionFunctions.js @@ -54,7 +54,8 @@ function newSessionFunctions () { 'Backtesting Session->Paper Trading Session->Fordward Testing Session->Live Trading Session->' + 'Parameters->' + 'Base Asset->Quoted Asset->Time Range->Time Frame->Slippage->Fee Structure->' + - 'Exchange Account Asset->Asset->' + 'Exchange Account Asset->Asset->' + + 'Social Bots->Telegram Bot->' let session = functionLibraryProtocolNode.getProtocolNode(node, false, true, true, false, false, lightingPath) From 8946194346b0807a3a5630d0ad7710d195785764 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 26 Mar 2020 16:36:30 +0100 Subject: [PATCH 10/56] Update SessionFunctions.js --- DesignSpace/Workspace/FunctionLibraries/SessionFunctions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DesignSpace/Workspace/FunctionLibraries/SessionFunctions.js b/DesignSpace/Workspace/FunctionLibraries/SessionFunctions.js index f8639c67a..3d393d8ab 100644 --- a/DesignSpace/Workspace/FunctionLibraries/SessionFunctions.js +++ b/DesignSpace/Workspace/FunctionLibraries/SessionFunctions.js @@ -45,7 +45,7 @@ function newSessionFunctions () { 'Stop->Take Profit->' + 'Phase->Formula->Next Phase Event->' + 'Situation->Condition->Javascript Code->' + - 'Announcement->Telegram Bot->' + + 'Announcement->Telegram Bot->Formula->' + 'Close Stage->Close Execution->' let tradingSystem = functionLibraryProtocolNode.getProtocolNode(node.payload.referenceParent, false, true, true, false, false, lightingPath) From 2d5f03a709dc56477402630e56e51bfd615c7946 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 26 Mar 2020 17:17:04 +0100 Subject: [PATCH 11/56] Deleting UI Object fix --- FloatingSpace/CircularMenuItem.js | 6 +++++- FloatingSpace/CircularProgressBar.js | 4 +++- FloatingSpace/UiObject.js | 9 +++++++-- SystemEventHandler.js | 4 +++- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/FloatingSpace/CircularMenuItem.js b/FloatingSpace/CircularMenuItem.js index ca2d77c7e..ce0cd313e 100644 --- a/FloatingSpace/CircularMenuItem.js +++ b/FloatingSpace/CircularMenuItem.js @@ -279,7 +279,11 @@ function newCircularMenuItem () { /* A Click during confirmation executes the pre-defined action. */ if (temporaryStatus === STATUS_WAITING_CONFIRMATION || temporaryStatus === STATUS_PRIMARY_WORK_DONE) { executeAction() - setStatus(thisObject.workDoneLabel, UI_COLOR.PATINATED_TURQUOISE, 100, STATUS_SECONDARY_WORK_DONE) + if (thisObject.workDoneLabel !== undefined) { + setStatus(thisObject.workDoneLabel, UI_COLOR.PATINATED_TURQUOISE, 100, STATUS_SECONDARY_WORK_DONE) + } else { + setStatus('Done', UI_COLOR.PATINATED_TURQUOISE, 100, STATUS_SECONDARY_WORK_DONE) + } return } } diff --git a/FloatingSpace/CircularProgressBar.js b/FloatingSpace/CircularProgressBar.js index 07973d7ee..a78943473 100644 --- a/FloatingSpace/CircularProgressBar.js +++ b/FloatingSpace/CircularProgressBar.js @@ -31,7 +31,9 @@ function newCircularProgressBar () { function finalize () { let key = thisObject.payload.node.name + '-' + thisObject.payload.node.type + '-' + thisObject.payload.node.id - systemEventHandler.stopListening(key, eventSubscriptionIdHeartbeat) + if (eventSubscriptionIdHeartbeat !== undefined) { + systemEventHandler.stopListening(key, eventSubscriptionIdHeartbeat) + } thisObject.container = undefined thisObject.payload = undefined diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index 96955b532..9f6999404 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -120,8 +120,13 @@ function newUiObject () { function finalize () { let key = thisObject.payload.node.name + '-' + thisObject.payload.node.type + '-' + thisObject.payload.node.id - systemEventHandler.stopListening(key, eventSubscriptionIdOnRunning, 'UiObject') - systemEventHandler.stopListening(key, eventSubscriptionIdOnStopped, 'UiObject') + + if (eventSubscriptionIdOnRunning !== undefined) { + systemEventHandler.stopListening(key, eventSubscriptionIdOnRunning, 'UiObject') + } + if (eventSubscriptionIdOnStopped !== undefined) { + systemEventHandler.stopListening(key, eventSubscriptionIdOnStopped, 'UiObject') + } thisObject.container.eventHandler.stopListening(selfFocusEventSubscriptionId) thisObject.container.eventHandler.stopListening(selfNotFocusEventSubscriptionId) diff --git a/SystemEventHandler.js b/SystemEventHandler.js index 07618cbf8..d8c4b520c 100644 --- a/SystemEventHandler.js +++ b/SystemEventHandler.js @@ -44,7 +44,9 @@ function newSystemEventHandler () { responseWaiters.set(command.callerId, responseCallBack) } - WEB_SOCKETS_CONNECTION.send(JSON.stringify(command)) + if (WEB_SOCKETS_CONNECTION.readyState === 1) { // 1 means connected and ready. + WEB_SOCKETS_CONNECTION.send(JSON.stringify(command)) + } } function createEventHandler (eventHandlerName, callerId, responseCallBack) { From f70ace1feba19872203e4635b436c775bcf68c47 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 27 Mar 2020 16:35:19 +0100 Subject: [PATCH 12/56] Update Viewport.js --- ChartingSpace/Viewport.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChartingSpace/Viewport.js b/ChartingSpace/Viewport.js index d51df170b..ff472c391 100644 --- a/ChartingSpace/Viewport.js +++ b/ChartingSpace/Viewport.js @@ -200,7 +200,7 @@ function newViewport () { if (thisObject.visible === false) { return } if ((event.ctrlKey === true || event.metaKey === true)) { return } let morePower = 1 - let amount = event.delta + let amount = event.delta * MAC_AMOUNT_FACTOR if (event.buttons === 4) { morePower = 2 } // Mouse wheel pressed. /* We adjust the sensitivity for Mac Users */ From df2abdb6449ea6ae3fcadecd9555477a0c36cd01 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 27 Mar 2020 17:41:40 +0100 Subject: [PATCH 13/56] mac bug fixed --- ChartingSpace/Viewport.js | 9 +++++++-- SystemEventHandler.js | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChartingSpace/Viewport.js b/ChartingSpace/Viewport.js index ff472c391..4fd3c840f 100644 --- a/ChartingSpace/Viewport.js +++ b/ChartingSpace/Viewport.js @@ -200,7 +200,12 @@ function newViewport () { if (thisObject.visible === false) { return } if ((event.ctrlKey === true || event.metaKey === true)) { return } let morePower = 1 - let amount = event.delta * MAC_AMOUNT_FACTOR + let amount = event.delta + + if (IS_MAC) { + event.delta = event.delta * MAC_AMOUNT_FACTOR + } + if (event.buttons === 4) { morePower = 2 } // Mouse wheel pressed. /* We adjust the sensitivity for Mac Users */ @@ -220,7 +225,7 @@ function newViewport () { if (thisObject.zoomTargetLevel + amount * morePower < MIN_ZOOM_LEVEL) { return false } - thisObject.zoomTargetLevel = Math.round(Math.round((thisObject.zoomTargetLevel + amount * morePower) * MAC_AMOUNT_FACTOR) / MAC_AMOUNT_FACTOR) + thisObject.zoomTargetLevel = Math.round(thisObject.zoomTargetLevel + amount * morePower) ANIMATION_INCREMENT = Math.round(Math.abs(thisObject.zoomTargetLevel - thisObject.zoomLevel) / ANIMATION_STEPS * 100) / 100 diff --git a/SystemEventHandler.js b/SystemEventHandler.js index d8c4b520c..b200cc1b2 100644 --- a/SystemEventHandler.js +++ b/SystemEventHandler.js @@ -46,6 +46,8 @@ function newSystemEventHandler () { if (WEB_SOCKETS_CONNECTION.readyState === 1) { // 1 means connected and ready. WEB_SOCKETS_CONNECTION.send(JSON.stringify(command)) + } else { + console.log('WebSocket message could not be sent because the connection was not ready. Message = ' + JSON.stringify(command)) } } From 3824e910e2b3f99b23e488117d338824efadd45c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 27 Mar 2020 17:51:17 +0100 Subject: [PATCH 14/56] improvement not showing text --- Globals.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Globals.js b/Globals.js index dfe29698b..c27c27f98 100644 --- a/Globals.js +++ b/Globals.js @@ -38,6 +38,7 @@ const DOUBLE_CLICK_ZOOM_IN_IN_LEVEL = 7 const DEBUG = {} const ZOOM_OUT_THRESHOLD_FOR_NOT_HIDDING_PANELS = 12 const ZOOM_OUT_THRESHOLD_FOR_HIDDING_PANELS = 7 +const ZOOM_OUT_THRESHOLD_FOR_HIDDING_CHARTS_LABELS = 7 const ZOOM_OUT_THRESHOLD_FOR_CHANGING_TIME_FRAME = 3 // This help regulate when to change the Time Frame base on the level of zoom out. const ZOOM_OUT_THRESHOLD_FOR_PACKING_OBJECTS_AT_THE_BOTTOM_OR_TOP_OF_VIEWPORT = 2 const ZOOM_OUT_THRESHOLD_FOR_PLOTTING_IN_LOW_RESOLUTION = 3 From 6322a5c0029f828445c3320b745e401b2fcee6e7 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 27 Mar 2020 18:09:42 +0100 Subject: [PATCH 15/56] Saving with CTRL S --- Canvas.js | 6 ++++++ DesignSpace/Workspace/Workspace.js | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Canvas.js b/Canvas.js index 70bda0737..170ba0c4a 100644 --- a/Canvas.js +++ b/Canvas.js @@ -274,6 +274,12 @@ function newCanvas () { return } + if (event.shiftKey === true && (event.ctrlKey === true || event.metaKey === true) && (event.key === 'S' || event.key === 's')) { + canvas.designSpace.workspace.save() + event.preventDefault() + return + } + let nodeOnFocus = canvas.designSpace.workspace.getNodeThatIsOnFocus() if (nodeOnFocus !== undefined) { if (nodeOnFocus.payload.uiObject.codeEditor !== undefined) { diff --git a/DesignSpace/Workspace/Workspace.js b/DesignSpace/Workspace/Workspace.js index 48e48b21c..5b7510b2d 100644 --- a/DesignSpace/Workspace/Workspace.js +++ b/DesignSpace/Workspace/Workspace.js @@ -11,6 +11,7 @@ function newWorkspace () { container: undefined, enabled: false, nodeChildren: undefined, + save: saveWorkspace, getHierarchyHeads: getHierarchyHeads, getNodeThatIsOnFocus: getNodeThatIsOnFocus, getNodeByShortcutKey: getNodeByShortcutKey, @@ -90,7 +91,7 @@ function newWorkspace () { functionLibraryUiObjectsFromNodes.recreateWorkspace(thisObject.workspaceNode) thisObject.enabled = true - setInterval(saveWorkspace, 10000) + setInterval(saveWorkspace, 60000) } catch (err) { if (ERROR_LOG === true) { logger.write('[ERROR] initialize -> err = ' + err.stack) } } From 9888ae6ba76d8096d33e3c83d4974cd50ed5e460 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 27 Mar 2020 18:13:52 +0100 Subject: [PATCH 16/56] Update Workspace.js --- DesignSpace/Workspace/Workspace.js | 1 - 1 file changed, 1 deletion(-) diff --git a/DesignSpace/Workspace/Workspace.js b/DesignSpace/Workspace/Workspace.js index 5b7510b2d..b60758468 100644 --- a/DesignSpace/Workspace/Workspace.js +++ b/DesignSpace/Workspace/Workspace.js @@ -7,7 +7,6 @@ function newWorkspace () { let thisObject = { workspaceNode: undefined, - tradingSystem: undefined, container: undefined, enabled: false, nodeChildren: undefined, From 3b0dd95a7bd9d109b49e8b5b85db43de1f280942 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 27 Mar 2020 18:38:27 +0100 Subject: [PATCH 17/56] status bar implementation --- Spaces/CockpitSpace.js | 21 +++++++++++++++++++-- SystemEventHandler.js | 9 +++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/Spaces/CockpitSpace.js b/Spaces/CockpitSpace.js index 3291428ec..a70fa8c73 100644 --- a/Spaces/CockpitSpace.js +++ b/Spaces/CockpitSpace.js @@ -195,9 +195,18 @@ zeroPoint = thisObject.container.frame.frameThisPoint(zeroPoint) + let barColor + let statusText + if (systemEventHandler.isConnected()) { + barColor = UI_COLOR.DARK_TURQUOISE + } else { + barColor = UI_COLOR.RED + statusText = 'Lost connection with the local backend. Please check that all localhost servers are running.' + } + browserCanvasContext.beginPath() browserCanvasContext.rect(zeroPoint.x, zeroPoint.y, thisObject.container.frame.width, thisObject.container.frame.height) - browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK_TURQUOISE + ', ' + opacity + ')' + browserCanvasContext.fillStyle = 'rgba(' + barColor + ', ' + opacity + ')' browserCanvasContext.closePath() browserCanvasContext.fill() @@ -213,7 +222,15 @@ browserCanvasContext.closePath() browserCanvasContext.fill() - if (canvas.designSpace.workspace.enabled === true) { + if (statusText !== undefined) { + let position = { + x: thisObject.container.frame.width / 2, + y: thisObject.container.frame.height / 2 + 5 + } + printLabel(statusText, position.x, position.y, 1, 15, UI_COLOR.TITANIUM_YELLOW, true, thisObject.container) + } + + if (canvas.designSpace.workspace.enabled === true && statusText === undefined) { arrow() } } diff --git a/SystemEventHandler.js b/SystemEventHandler.js index b200cc1b2..e6fd960fc 100644 --- a/SystemEventHandler.js +++ b/SystemEventHandler.js @@ -12,6 +12,7 @@ function newSystemEventHandler () { let WEB_SOCKETS_CONNECTION let thisObject = { + isConnected: isConnected, initialize: initialize, physics: physics, createEventHandler: createEventHandler, @@ -30,6 +31,14 @@ function newSystemEventHandler () { setuptWebSockets(callBackFunction) } + function isConnected () { + if (WEB_SOCKETS_CONNECTION.readyState === 1) { + return true + } else { + return false + } + } + function sendCommand (command, responseCallBack, eventsCallBack) { if (command.action === 'listenToEvent') { let key From b311378b44f06f3ffc3f97d2d3de829be5dfd4f1 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 27 Mar 2020 18:58:11 +0100 Subject: [PATCH 18/56] saving with satus bar notification --- Canvas.js | 1 + Spaces/CockpitSpace.js | 49 ++++++++++++++++++++++++++++++++++++------ 2 files changed, 43 insertions(+), 7 deletions(-) diff --git a/Canvas.js b/Canvas.js index 170ba0c4a..e75a97714 100644 --- a/Canvas.js +++ b/Canvas.js @@ -276,6 +276,7 @@ function newCanvas () { if (event.shiftKey === true && (event.ctrlKey === true || event.metaKey === true) && (event.key === 'S' || event.key === 's')) { canvas.designSpace.workspace.save() + canvas.cockpitSpace.setStatus('Workspace Saved.', 50, canvas.cockpitSpace.statusTypes.ALL_GOOD) event.preventDefault() return } diff --git a/Spaces/CockpitSpace.js b/Spaces/CockpitSpace.js index a70fa8c73..8b9a3c8e4 100644 --- a/Spaces/CockpitSpace.js +++ b/Spaces/CockpitSpace.js @@ -1,11 +1,15 @@ function newCockpitSpace () { const MODULE_NAME = 'CockpitSpace' - + const STATUS_TYPES = { + ALL_GOOD: 1 + } let thisObject = { container: undefined, status: 'BOTTOM', fullscreen: undefined, + statusTypes: STATUS_TYPES, + setStatus: setStatus, toTop: toTop, toBottom: toBottom, toMiddle: toMiddle, @@ -31,6 +35,10 @@ let selfMouseClickEventSubscriptionId let canvasBrowserResizedEventSubscriptionId + let statusCounter = 0 + let statusText + let statusType + return thisObject function finalize () { @@ -72,6 +80,12 @@ } + function setStatus (text, counter, type) { + statusCounter = counter + statusText = text + statusType = type + } + function resize () { thisObject.container.frame.width = browserCanvas.width thisObject.container.frame.height = COCKPIT_SPACE_HEIGHT @@ -114,9 +128,19 @@ } } + function statusPhysics () { + statusCounter-- + if (statusCounter < 0) { + statusCounter = 0 + statusText = undefined, + statusType = undefined + } + } + function physics () { thisObjectPhysics() childrenPhysics() + statusPhysics() } function childrenPhysics () { @@ -195,13 +219,24 @@ zeroPoint = thisObject.container.frame.frameThisPoint(zeroPoint) - let barColor - let statusText - if (systemEventHandler.isConnected()) { - barColor = UI_COLOR.DARK_TURQUOISE - } else { + let barColor = UI_COLOR.DARK_TURQUOISE // default + let textColor + + if (statusType !== undefined) { + switch (statusType) { + case STATUS_TYPES.ALL_GOOD: + { + barColor = UI_COLOR.PATINATED_TURQUOISE + textColor = UI_COLOR.WHITE + break + } + } + } + + if (systemEventHandler.isConnected() !== true) { barColor = UI_COLOR.RED statusText = 'Lost connection with the local backend. Please check that all localhost servers are running.' + textColor = UI_COLOR.TITANIUM_YELLOW } browserCanvasContext.beginPath() @@ -227,7 +262,7 @@ x: thisObject.container.frame.width / 2, y: thisObject.container.frame.height / 2 + 5 } - printLabel(statusText, position.x, position.y, 1, 15, UI_COLOR.TITANIUM_YELLOW, true, thisObject.container) + printLabel(statusText, position.x, position.y, 1, 15, textColor, true, thisObject.container) } if (canvas.designSpace.workspace.enabled === true && statusText === undefined) { From 6cf4572595f021e4fbc89f34dd41edeeacd26604 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 27 Mar 2020 19:26:18 +0100 Subject: [PATCH 19/56] Protection against more than one instance of UI --- Canvas.js | 7 +++++-- DesignSpace/Workspace/Workspace.js | 14 ++++++++++++-- Spaces/CockpitSpace.js | 15 ++++++++------- SystemEventHandler.js | 4 ++++ 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/Canvas.js b/Canvas.js index e75a97714..29d8cc855 100644 --- a/Canvas.js +++ b/Canvas.js @@ -275,8 +275,11 @@ function newCanvas () { } if (event.shiftKey === true && (event.ctrlKey === true || event.metaKey === true) && (event.key === 'S' || event.key === 's')) { - canvas.designSpace.workspace.save() - canvas.cockpitSpace.setStatus('Workspace Saved.', 50, canvas.cockpitSpace.statusTypes.ALL_GOOD) + let saved = canvas.designSpace.workspace.save() + if (saved === true) { + canvas.cockpitSpace.setStatus('Workspace Saved.', 50, canvas.cockpitSpace.statusTypes.ALL_GOOD) + } + event.preventDefault() return } diff --git a/DesignSpace/Workspace/Workspace.js b/DesignSpace/Workspace/Workspace.js index b60758468..9762c19fc 100644 --- a/DesignSpace/Workspace/Workspace.js +++ b/DesignSpace/Workspace/Workspace.js @@ -66,6 +66,9 @@ function newWorkspace () { let circularProgressBar = newBusyProgressBar() circularProgressBar.fitFunction = canvas.floatingSpace.fitIntoVisibleArea let droppedNode + let sessionTimestamp = (new Date()).valueOf() + window.localStorage.setItem('Session Timestamp', sessionTimestamp) + console.log(sessionTimestamp) return thisObject @@ -113,8 +116,15 @@ function newWorkspace () { } function saveWorkspace () { - let textToSave = stringifyWorkspace() - window.localStorage.setItem(CANVAS_APP_NAME + '.' + 'Workspace', textToSave) + let savedSessionTimestamp = window.localStorage.getItem('Session Timestamp') + if (Number(savedSessionTimestamp) !== sessionTimestamp) { + canvas.cockpitSpace.setStatus('Could not save the Workspace. You have more that one instance of the Superlagos User Interface open at the same time. Plese close this instance as it is older than the others.', 150, canvas.cockpitSpace.statusTypes.WARNING) + } else { + let textToSave = stringifyWorkspace() + window.localStorage.setItem(CANVAS_APP_NAME + '.' + 'Workspace', textToSave) + window.localStorage.setItem('Session Timestamp', sessionTimestamp) + return true + } } function physics () { diff --git a/Spaces/CockpitSpace.js b/Spaces/CockpitSpace.js index 8b9a3c8e4..248e07c39 100644 --- a/Spaces/CockpitSpace.js +++ b/Spaces/CockpitSpace.js @@ -2,7 +2,8 @@ function newCockpitSpace () { const MODULE_NAME = 'CockpitSpace' const STATUS_TYPES = { - ALL_GOOD: 1 + ALL_GOOD: 1, + WARNING: 2 } let thisObject = { container: undefined, @@ -230,15 +231,15 @@ textColor = UI_COLOR.WHITE break } + case STATUS_TYPES.WARNING: + { + barColor = UI_COLOR.RED + textColor = UI_COLOR.TITANIUM_YELLOW + break + } } } - if (systemEventHandler.isConnected() !== true) { - barColor = UI_COLOR.RED - statusText = 'Lost connection with the local backend. Please check that all localhost servers are running.' - textColor = UI_COLOR.TITANIUM_YELLOW - } - browserCanvasContext.beginPath() browserCanvasContext.rect(zeroPoint.x, zeroPoint.y, thisObject.container.frame.width, thisObject.container.frame.height) browserCanvasContext.fillStyle = 'rgba(' + barColor + ', ' + opacity + ')' diff --git a/SystemEventHandler.js b/SystemEventHandler.js index e6fd960fc..dfc1de006 100644 --- a/SystemEventHandler.js +++ b/SystemEventHandler.js @@ -119,6 +119,10 @@ function newSystemEventHandler () { } } } + + if (thisObject.isConnected() !== true) { + canvas.cockpitSpace.setStatus('Lost connection with the local backend. Please check that all localhost servers are running.', 100, canvas.cockpitSpace.statusTypes.WARNING) + } } function setuptWebSockets (callBackFunction) { From 6c94160155a3405f2f4ae1754c311bafd684eccf Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 28 Mar 2020 09:38:05 +0100 Subject: [PATCH 20/56] Bug panels dissapearing --- Panels/LayersPanel.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Panels/LayersPanel.js b/Panels/LayersPanel.js index b5bed93e9..1d50fc947 100644 --- a/Panels/LayersPanel.js +++ b/Panels/LayersPanel.js @@ -227,7 +227,7 @@ function newLayersPanel () { } function panelSizePhysics () { - if (isInitialized === false || thisObject.visible === false || thisObject.isHidden === true) { return } + if (isInitialized === false || thisObject.isHidden === true) { return } let viewPortHeight = canvas.chartingSpace.viewport.visibleArea.bottomLeft.y - canvas.chartingSpace.viewport.visibleArea.topLeft.y @@ -237,6 +237,8 @@ function newLayersPanel () { thisObject.visible = true } + if (thisObject.visible === false) { return } + if (desiredPanelHeight > viewPortHeight) { posibleVisibleLayers = Math.trunc((viewPortHeight - headerHeight - footerHeight) / (layerHeight + LAYER_SEPARATION)) } else { From 7ee5692d0a783f14166414acc3c9f430bf08f32e Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 28 Mar 2020 12:17:19 +0100 Subject: [PATCH 21/56] Panels heigth bug fixed --- DesignSpace/Workspace/Workspace.js | 1 - Panels/PlotterPanel.js | 30 +++++++++++++++++++++++------- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/DesignSpace/Workspace/Workspace.js b/DesignSpace/Workspace/Workspace.js index 9762c19fc..45fbf03d7 100644 --- a/DesignSpace/Workspace/Workspace.js +++ b/DesignSpace/Workspace/Workspace.js @@ -68,7 +68,6 @@ function newWorkspace () { let droppedNode let sessionTimestamp = (new Date()).valueOf() window.localStorage.setItem('Session Timestamp', sessionTimestamp) - console.log(sessionTimestamp) return thisObject diff --git a/Panels/PlotterPanel.js b/Panels/PlotterPanel.js index 93091b1e7..8d68bb727 100644 --- a/Panels/PlotterPanel.js +++ b/Panels/PlotterPanel.js @@ -96,7 +96,8 @@ function newPlotterPanel () { const X_AXIS = thisObject.container.frame.width / 2 const Y_AXIS = frameTitleHeight + frameBodyHeight / 2 - const PANEL_HEIGHT = frameTitleHeight + frameBodyHeight + + const PANEL_HEIGHT = UI_PANEL.HEIGHT.NORMAL if (currentRecord === undefined) { return } if (currentRecord.data === undefined) { return } @@ -113,7 +114,7 @@ function newPlotterPanel () { } } - printLabel('Indicator Properties', X_AXIS, PANEL_HEIGHT * 17 / 100 / 1.25, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction) + printLabel('Indicator Properties', X_AXIS, UI_PANEL.HEIGHT.NORMAL * 17 / 100, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction) /* Second we go through the panel data. */ if (panelNode.panelData === undefined) { return } @@ -126,8 +127,19 @@ function newPlotterPanel () { let value = 'No value defined.' if (valuePosition > 100) { - heightFactor = 1.25 - thisObject.container.frame.height = UI_PANEL.HEIGHT.NORMAL * heightFactor + thisObject.container.frame.height = UI_PANEL.HEIGHT.NORMAL * 1.25 + } + + if (valuePosition > 125) { + thisObject.container.frame.height = UI_PANEL.HEIGHT.NORMAL * 1.50 + } + + if (valuePosition > 150) { + thisObject.container.frame.height = UI_PANEL.HEIGHT.NORMAL * 1.75 + } + + if (valuePosition > 175) { + thisObject.container.frame.height = UI_PANEL.HEIGHT.NORMAL * 2.00 } if (panelData.dataFormula !== undefined) { @@ -140,7 +152,11 @@ function newPlotterPanel () { } if (panelData.code.valueDecimals !== undefined) { - value = value.toFixed(panelData.code.valueDecimals) + if (value !== undefined) { + if (isNaN(value) === false) { + value = value.toFixed(panelData.code.valueDecimals) + } + } } if (panelData.code.labelText !== undefined) { @@ -155,8 +171,8 @@ function newPlotterPanel () { valuePosition = panelData.code.valuePosition } - printLabel(labelText, X_AXIS, PANEL_HEIGHT * labelPosition / 100 / heightFactor, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction) - printLabel(value, X_AXIS, PANEL_HEIGHT * valuePosition / 100 / heightFactor, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction) + printLabel(labelText, X_AXIS, UI_PANEL.HEIGHT.NORMAL * labelPosition / 100 / heightFactor, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction) + printLabel(value, X_AXIS, UI_PANEL.HEIGHT.NORMAL * valuePosition / 100 / heightFactor, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction) } } } From 12568602aa29c194264e3cd7530ac3063ac7e4ef Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 28 Mar 2020 17:40:32 +0100 Subject: [PATCH 22/56] Data Mines Includes --- .../FunctionLibraries/UiObjectsFromNodes.js | 75 +++++++++++++++---- DesignSpace/Workspace/Workspace.js | 16 +++- Spaces/ChartingSpace.js | 10 ++- 3 files changed, 83 insertions(+), 18 deletions(-) diff --git a/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 772681f5c..df7391fee 100644 --- a/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -19,26 +19,69 @@ function newUiObjectsFromNodes () { tasksToRun = [] sessionsToRun = [] - /* Create the workspace UI OBject and then continue with the root nodes. */ - createUiObject(false, 'Workspace', node.name, node, undefined, undefined, 'Workspace') - if (node.rootNodes !== undefined) { - for (let i = 0; i < node.rootNodes.length; i++) { - let rootNode = node.rootNodes[i] - createUiObjectFromNode(rootNode, undefined, undefined) + addIncludedNodes() + + function addIncludedNodes () { + blobService = newFileStorage() + + if (node.code === undefined) { + node.code = '{ \n"includeDataMines": ["Masters", "Sparta", "TradingEngines"]\n}' + } + + let code = JSON.parse(node.code) + let includeDataMines = code.includeDataMines + + let totalIncluded = 0 + + for (let i = 0; i < includeDataMines.length; i++) { + let dataMine = includeDataMines[i] + blobService.getBlobToText('DataMines' + '/' + dataMine, undefined, onFileReceived, true) + function onFileReceived (err, text, response) { + if (err && err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) { + console.log('Cannot load included Data Mine ' + dataMine + '. The workspace can not be loaded.') + return + } + let includedDataMine = JSON.parse(text) + for (let i = 0; i < node.rootNodes.length; i++) { + let rootNode = node.rootNodes[i] + if (rootNode.type === 'Data Mine') { + let code = JSON.parse(rootNode.code) + if (code.name === dataMine) { + rootNodes.splice(i, 1) + } + } + } + node.rootNodes.push(includedDataMine) + totalIncluded++ + if (totalIncluded === includeDataMines.length) { + addUserDefinedNodes() + } + } } } - tryToConnectChildrenWithReferenceParents() + function addUserDefinedNodes () { + /* Create the workspace UI OBject and then continue with the root nodes. */ + createUiObject(false, 'Workspace', node.name, node, undefined, undefined, 'Workspace') + if (node.rootNodes !== undefined) { + for (let i = 0; i < node.rootNodes.length; i++) { + let rootNode = node.rootNodes[i] + createUiObjectFromNode(rootNode, undefined, undefined) + } + } - if (replacingCurrentWorkspace === true) { - // We need to wait all tasks that were potentially running to stop - setTimeout(runTasks, 70000) - // We give a few seconds for the tasks to start - setTimeout(runSessions, 80000) - } else { - runTasks() - // We give a few seconds for the tasks to start - setTimeout(runSessions, 10000) + tryToConnectChildrenWithReferenceParents() + + if (replacingCurrentWorkspace === true) { + // We need to wait all tasks that were potentially running to stop + setTimeout(runTasks, 70000) + // We give a few seconds for the tasks to start + setTimeout(runSessions, 80000) + } else { + runTasks() + // We give a few seconds for the tasks to start + setTimeout(runSessions, 10000) + } } } diff --git a/DesignSpace/Workspace/Workspace.js b/DesignSpace/Workspace/Workspace.js index 45fbf03d7..debbc7ed2 100644 --- a/DesignSpace/Workspace/Workspace.js +++ b/DesignSpace/Workspace/Workspace.js @@ -169,12 +169,26 @@ function newWorkspace () { } function stringifyWorkspace (removePersonalData) { + let code + if (thisObject.workspaceNode.code === undefined) { + thisObject.workspaceNode.code = '{ \n"includeDataMines": ["Masters", "Sparta", "TradingEngines"]\n}' + } + code = JSON.parse(thisObject.workspaceNode.code) + let includeDataMines = code.includeDataMines + let stringifyReadyNodes = [] for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) { let rootNode = thisObject.workspaceNode.rootNodes[i] let node = functionLibraryProtocolNode.getProtocolNode(rootNode, removePersonalData, false, true, true, true) if (node) { - stringifyReadyNodes.push(node) + if (node.type !== 'Data Mine') { + stringifyReadyNodes.push(node) + } else { + code = JSON.parse(node.code) + if (includeDataMines.includes(code.codeName) === false) { + stringifyReadyNodes.push(node) + } + } } } let workspace = { diff --git a/Spaces/ChartingSpace.js b/Spaces/ChartingSpace.js index dba998962..b120852e0 100644 --- a/Spaces/ChartingSpace.js +++ b/Spaces/ChartingSpace.js @@ -41,6 +41,9 @@ function newChartingSpace () { const PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT = 25 initialSetup() + + let isInitialized = false + return thisObject function reset () { @@ -87,6 +90,8 @@ function newChartingSpace () { } function initialize () { + if (isInitialized === true) { return } + let rootNodes = canvas.designSpace.workspace.workspaceNode.rootNodes for (let i = 0; i < rootNodes.length; i++) { let rootNode = rootNodes[i] @@ -96,7 +101,7 @@ function newChartingSpace () { } if (thisObject.payload === undefined) { - if (ERROR_LOG === true) { logger.write('[WARN] initialize -> There must exist a Charting Space at the Design Space in order to enable Charts. PLease create one and refreash your browser. ') } + // if (ERROR_LOG === true) { logger.write('[WARN] initialize -> There must exist a Charting Space at the Design Space in order to enable Charts. PLease create one and refreash your browser. ') } return } @@ -111,6 +116,8 @@ function newChartingSpace () { thisObject.viewport.initialize() canvasBrowserResizedEventSubscriptionId = canvas.eventHandler.listenToEvent('Browser Resized', resize) + + isInitialized = true } function getContainer (point, purpose) { @@ -263,6 +270,7 @@ function newChartingSpace () { } function physics () { + initialize() thisObjectPhysics() if (thisObject.visible !== true) { return } if (thisObject.viewport !== undefined) { From 51fcc0446adb9c54785e58a2a8c484d5910aadd6 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 29 Mar 2020 08:53:12 +0200 Subject: [PATCH 23/56] Mac bug refixed --- ChartingSpace/Viewport.js | 3 ++- Spaces/ChartingSpace.js | 1 + SystemEventHandler.js | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ChartingSpace/Viewport.js b/ChartingSpace/Viewport.js index 4fd3c840f..229baa6d2 100644 --- a/ChartingSpace/Viewport.js +++ b/ChartingSpace/Viewport.js @@ -200,12 +200,13 @@ function newViewport () { if (thisObject.visible === false) { return } if ((event.ctrlKey === true || event.metaKey === true)) { return } let morePower = 1 - let amount = event.delta if (IS_MAC) { event.delta = event.delta * MAC_AMOUNT_FACTOR } + let amount = event.delta + if (event.buttons === 4) { morePower = 2 } // Mouse wheel pressed. /* We adjust the sensitivity for Mac Users */ diff --git a/Spaces/ChartingSpace.js b/Spaces/ChartingSpace.js index b120852e0..ae4d6fee0 100644 --- a/Spaces/ChartingSpace.js +++ b/Spaces/ChartingSpace.js @@ -49,6 +49,7 @@ function newChartingSpace () { function reset () { finalize() initialSetup() + isInitialized = false initialize() } diff --git a/SystemEventHandler.js b/SystemEventHandler.js index dfc1de006..d9385f237 100644 --- a/SystemEventHandler.js +++ b/SystemEventHandler.js @@ -121,7 +121,7 @@ function newSystemEventHandler () { } if (thisObject.isConnected() !== true) { - canvas.cockpitSpace.setStatus('Lost connection with the local backend. Please check that all localhost servers are running.', 100, canvas.cockpitSpace.statusTypes.WARNING) + canvas.cockpitSpace.setStatus('Connection with the local backend lost. Please check that all localhost servers are running.', 100, canvas.cockpitSpace.statusTypes.WARNING) } } From ceea65e633af42ae2dacc741184396ee5eb91f8b Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 29 Mar 2020 12:23:44 +0200 Subject: [PATCH 24/56] Bug fixed re starting a task manager --- FloatingSpace/CircularMenu.js | 8 ++++++++ FloatingSpace/CircularMenuItem.js | 31 ++++++++++++++++++++----------- FloatingSpace/UiObject.js | 2 +- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/FloatingSpace/CircularMenu.js b/FloatingSpace/CircularMenu.js index 93a940068..12b10a3b0 100644 --- a/FloatingSpace/CircularMenu.js +++ b/FloatingSpace/CircularMenu.js @@ -7,6 +7,7 @@ function newCircularMenu () { isDeployed: undefined, internalClick: internalClick, physics: physics, + invisiblePhysics: invisiblePhysics, drawBackground: drawBackground, drawForeground: drawForeground, getContainer: getContainer, @@ -171,6 +172,13 @@ function newCircularMenu () { } } + function invisiblePhysics () { + for (let i = 0; i < menuItems.length; i++) { + let menuItem = menuItems[i] + menuItem.invisiblePhysics() + } + } + function physics () { for (let i = 0; i < menuItems.length; i++) { let menuItem = menuItems[i] diff --git a/FloatingSpace/CircularMenuItem.js b/FloatingSpace/CircularMenuItem.js index ce0cd313e..ecebc02f7 100644 --- a/FloatingSpace/CircularMenuItem.js +++ b/FloatingSpace/CircularMenuItem.js @@ -41,6 +41,7 @@ function newCircularMenuItem () { isEnabled: true, internalClick: internalClick, physics: physics, + invisiblePhysics: invisiblePhysics, drawBackground: drawBackground, drawForeground: drawForeground, getContainer: getContainer, @@ -133,6 +134,24 @@ function newCircularMenuItem () { } } + function invisiblePhysics () { + temporaryStatusPhysics() + } + + function temporaryStatusPhysics () { + /* Temporary Status impacts on the label to use and the background of that label */ + if (temporaryStatusCounter > 0) { + temporaryStatusCounter-- + } + + if (temporaryStatusCounter === 0) { + temporaryStatus = STATUS_NO_ACTION_TAKEN_YET + labelToPrint = thisObject.label + backgroundColorToUse = defaultBackgroudColor + thisObject.nextAction = thisObject.action + } + } + function physics () { if (thisObject.dontShowAtFullscreen === true && AT_FULL_SCREEN_MODE === true) { return } @@ -173,17 +192,7 @@ function newCircularMenuItem () { thisObject.container.frame.position.x = thisObject.container.frame.radius * radiusGrowthFactor / 7 * Math.cos(toRadians(thisObject.angle)) - thisObject.currentRadius * 1.5 thisObject.container.frame.position.y = thisObject.container.frame.radius * radiusGrowthFactor / 7 * Math.sin(toRadians(thisObject.angle)) - thisObject.container.frame.height / 2 - /* Temporary Status impacts on the label to use and the background of that label */ - if (temporaryStatusCounter > 0) { - temporaryStatusCounter-- - } - - if (temporaryStatusCounter === 0) { - temporaryStatus = STATUS_NO_ACTION_TAKEN_YET - labelToPrint = thisObject.label - backgroundColorToUse = defaultBackgroudColor - thisObject.nextAction = thisObject.action - } + temporaryStatusPhysics() /* Here we will check if we need to monitor a property that influences the status of the Menu Item. */ if (thisObject.disableIfPropertyIsDefined === true) { diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index 9f6999404..86c66d73c 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -263,6 +263,7 @@ function newUiObject () { } function invisiblePhysics () { + thisObject.menu.invisiblePhysics() childrenRunningPhysics() } @@ -1723,4 +1724,3 @@ function newUiObject () { } } } - From 3ce664c31b338f8460e4d75c9552502f1cb10705 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 29 Mar 2020 17:29:36 +0200 Subject: [PATCH 25/56] Trading Systems included --- .../FunctionLibraries/UiObjectsFromNodes.js | 70 ++++++++++++++++--- DesignSpace/Workspace/Workspace.js | 32 +++++++-- 2 files changed, 87 insertions(+), 15 deletions(-) diff --git a/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index df7391fee..c65b37a19 100644 --- a/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -25,35 +25,89 @@ function newUiObjectsFromNodes () { blobService = newFileStorage() if (node.code === undefined) { - node.code = '{ \n"includeDataMines": ["Masters", "Sparta", "TradingEngines"]\n}' + node.code = '{ \n"includeDataMines": ["Masters", "Sparta", "TradingEngines"],\n"includeTradingSystems": ["WHB-BTC-USDT", "WHB-ETH-USDT", "BRR-BTC-USDT"],\n"includeSuperScripts": ["Superalgos"]\n }' } let code = JSON.parse(node.code) let includeDataMines = code.includeDataMines + let includeTradingSystems = code.includeTradingSystems + let includeSuperScripts = code.includeSuperScripts let totalIncluded = 0 for (let i = 0; i < includeDataMines.length; i++) { - let dataMine = includeDataMines[i] - blobService.getBlobToText('DataMines' + '/' + dataMine, undefined, onFileReceived, true) + let name = includeDataMines[i] + blobService.getBlobToText('DataMines' + '/' + name, undefined, onFileReceived, true) function onFileReceived (err, text, response) { if (err && err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) { - console.log('Cannot load included Data Mine ' + dataMine + '. The workspace can not be loaded.') + console.log('Cannot load included Data Mine ' + name + '. The workspace can not be loaded.') return } - let includedDataMine = JSON.parse(text) + let receivedNode = JSON.parse(text) for (let i = 0; i < node.rootNodes.length; i++) { let rootNode = node.rootNodes[i] if (rootNode.type === 'Data Mine') { let code = JSON.parse(rootNode.code) - if (code.name === dataMine) { + if (code.name === name) { rootNodes.splice(i, 1) } } } - node.rootNodes.push(includedDataMine) + node.rootNodes.push(receivedNode) totalIncluded++ - if (totalIncluded === includeDataMines.length) { + if (totalIncluded === includeDataMines.length + includeTradingSystems.length + includeSuperScripts.length) { + addUserDefinedNodes() + } + } + } + + for (let i = 0; i < includeTradingSystems.length; i++) { + let name = includeTradingSystems[i] + blobService.getBlobToText('TradingSystems' + '/' + name, undefined, onFileReceived, true) + function onFileReceived (err, text, response) { + if (err && err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) { + console.log('Cannot load included Data Mine ' + name + '. The workspace can not be loaded.') + return + } + let receivedNode = JSON.parse(text) + for (let i = 0; i < node.rootNodes.length; i++) { + let rootNode = node.rootNodes[i] + if (rootNode.type === 'Trading System') { + let code = JSON.parse(rootNode.code) + if (code.name === name) { + rootNodes.splice(i, 1) + } + } + } + node.rootNodes.push(receivedNode) + totalIncluded++ + if (totalIncluded === includeDataMines.length + includeTradingSystems.length + includeSuperScripts.length) { + addUserDefinedNodes() + } + } + } + + for (let i = 0; i < includeSuperScripts.length; i++) { + let name = includeSuperScripts[i] + blobService.getBlobToText('SuperScripts' + '/' + name, undefined, onFileReceived, true) + function onFileReceived (err, text, response) { + if (err && err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) { + console.log('Cannot load included Data Mine ' + name + '. The workspace can not be loaded.') + return + } + let receivedNode = JSON.parse(text) + for (let i = 0; i < node.rootNodes.length; i++) { + let rootNode = node.rootNodes[i] + if (rootNode.type === 'Super Scripts') { + let code = JSON.parse(rootNode.code) + if (code.name === name) { + rootNodes.splice(i, 1) + } + } + } + node.rootNodes.push(receivedNode) + totalIncluded++ + if (totalIncluded === includeDataMines.length + includeTradingSystems.length + includeSuperScripts.length) { addUserDefinedNodes() } } diff --git a/DesignSpace/Workspace/Workspace.js b/DesignSpace/Workspace/Workspace.js index debbc7ed2..2941cfea0 100644 --- a/DesignSpace/Workspace/Workspace.js +++ b/DesignSpace/Workspace/Workspace.js @@ -171,23 +171,41 @@ function newWorkspace () { function stringifyWorkspace (removePersonalData) { let code if (thisObject.workspaceNode.code === undefined) { - thisObject.workspaceNode.code = '{ \n"includeDataMines": ["Masters", "Sparta", "TradingEngines"]\n}' + thisObject.workspaceNode.code = '{ \n"includeDataMines": ["Masters", "Sparta", "TradingEngines"],\n"includeTradingSystems": ["WHB-BTC-USDT", "WHB-ETH-USDT", "BRR-BTC-USDT"],\n"includeSuperScripts": ["Superalgos"]\n }' } code = JSON.parse(thisObject.workspaceNode.code) let includeDataMines = code.includeDataMines + let includeTradingSystems = code.includeTradingSystems + let includeSuperScripts = code.includeSuperScripts let stringifyReadyNodes = [] for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) { let rootNode = thisObject.workspaceNode.rootNodes[i] let node = functionLibraryProtocolNode.getProtocolNode(rootNode, removePersonalData, false, true, true, true) if (node) { - if (node.type !== 'Data Mine') { - stringifyReadyNodes.push(node) - } else { - code = JSON.parse(node.code) - if (includeDataMines.includes(code.codeName) === false) { - stringifyReadyNodes.push(node) + switch (node.type) { + case 'Data Mine': { + code = JSON.parse(node.code) + if (includeDataMines.includes(code.codeName) === false) { + stringifyReadyNodes.push(node) + } + break } + case 'Trading System': { + code = JSON.parse(node.code) + if (includeTradingSystems.includes(code.codeName) === false) { + stringifyReadyNodes.push(node) + } + break + } + case 'Super Scripts': { + code = JSON.parse(node.code) + if (includeSuperScripts.includes(code.codeName) === false) { + stringifyReadyNodes.push(node) + } + break + } + default: stringifyReadyNodes.push(node) } } } From 50b481c723cfda08f176df092315bfde6fccfa3c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 30 Mar 2020 08:32:53 +0200 Subject: [PATCH 26/56] bug fixes --- .../FunctionLibraries/UiObjectsFromNodes.js | 24 ++++++++++++------- DesignSpace/Workspace/Workspace.js | 6 ++--- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index c65b37a19..62bf533f6 100644 --- a/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -47,9 +47,11 @@ function newUiObjectsFromNodes () { for (let i = 0; i < node.rootNodes.length; i++) { let rootNode = node.rootNodes[i] if (rootNode.type === 'Data Mine') { - let code = JSON.parse(rootNode.code) - if (code.name === name) { - rootNodes.splice(i, 1) + if (rootNode.code !== undefined) { + let code = JSON.parse(rootNode.code) + if (code.name === name) { + rootNodes.splice(i, 1) + } } } } @@ -73,9 +75,11 @@ function newUiObjectsFromNodes () { for (let i = 0; i < node.rootNodes.length; i++) { let rootNode = node.rootNodes[i] if (rootNode.type === 'Trading System') { - let code = JSON.parse(rootNode.code) - if (code.name === name) { - rootNodes.splice(i, 1) + if (rootNode.code !== undefined) { + let code = JSON.parse(rootNode.code) + if (code.name === name) { + rootNodes.splice(i, 1) + } } } } @@ -99,9 +103,11 @@ function newUiObjectsFromNodes () { for (let i = 0; i < node.rootNodes.length; i++) { let rootNode = node.rootNodes[i] if (rootNode.type === 'Super Scripts') { - let code = JSON.parse(rootNode.code) - if (code.name === name) { - rootNodes.splice(i, 1) + if (rootNode.code !== undefined) { + let code = JSON.parse(rootNode.code) + if (code.name === name) { + rootNodes.splice(i, 1) + } } } } diff --git a/DesignSpace/Workspace/Workspace.js b/DesignSpace/Workspace/Workspace.js index 2941cfea0..14321b3f3 100644 --- a/DesignSpace/Workspace/Workspace.js +++ b/DesignSpace/Workspace/Workspace.js @@ -225,15 +225,15 @@ function newWorkspace () { if (rootNode.networkNodes !== undefined) { for (let j = 0; j < rootNode.networkNodes.length; j++) { let networkNode = rootNode.networkNodes[j] - if (networkNode.dataMining !== undefined) { + if (networkNode.dataMining !== undefined && networkNode.dataMining.payload !== undefined) { networkNode.dataMining.payload.uiObject.menu.internalClick('Stop All Exchange Tasks') networkNode.dataMining.payload.uiObject.menu.internalClick('Stop All Exchange Tasks') } - if (networkNode.testingEnvironment !== undefined) { + if (networkNode.testingEnvironment !== undefined && networkNode.testingEnvironment.payload !== undefined) { networkNode.testingEnvironment.payload.uiObject.menu.internalClick('Stop All Exchange Tasks') networkNode.testingEnvironment.payload.uiObject.menu.internalClick('Stop All Exchange Tasks') } - if (networkNode.productionEnvironment !== undefined) { + if (networkNode.productionEnvironment !== undefined && networkNode.productionEnvironment.payload !== undefined) { networkNode.productionEnvironment.payload.uiObject.menu.internalClick('Stop All Exchange Tasks') networkNode.productionEnvironment.payload.uiObject.menu.internalClick('Stop All Exchange Tasks') } From 248418ceecd4a2c80441f6b9a6a46cef51574021 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 30 Mar 2020 08:42:40 +0200 Subject: [PATCH 27/56] Update Utilities.js --- Utilities.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Utilities.js b/Utilities.js index 48750b49b..e9c85a67b 100644 --- a/Utilities.js +++ b/Utilities.js @@ -245,6 +245,7 @@ function removeTime (datetime) { } function printLabel (labelToPrint, x, y, opacity, fontSize, color, center, container, fitFunction, noDecimals) { + if (labelToPrint === undefined) { return } let labelPoint if (color === undefined) { color = UI_COLOR.DARK } if (fontSize === undefined) { fontSize = 10 }; From 709353da7ca370922dde5484f37d8d0475b6bf06 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 30 Mar 2020 09:07:52 +0200 Subject: [PATCH 28/56] Includes Improved --- .../FunctionLibraries/UiObjectsFromNodes.js | 3 ++ DesignSpace/Workspace/Workspace.js | 39 ++----------------- FloatingSpace/UiObject.js | 6 ++- 3 files changed, 12 insertions(+), 36 deletions(-) diff --git a/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 62bf533f6..b2dfc641c 100644 --- a/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -55,6 +55,7 @@ function newUiObjectsFromNodes () { } } } + receivedNode.isIncluded = true node.rootNodes.push(receivedNode) totalIncluded++ if (totalIncluded === includeDataMines.length + includeTradingSystems.length + includeSuperScripts.length) { @@ -83,6 +84,7 @@ function newUiObjectsFromNodes () { } } } + receivedNode.isIncluded = true node.rootNodes.push(receivedNode) totalIncluded++ if (totalIncluded === includeDataMines.length + includeTradingSystems.length + includeSuperScripts.length) { @@ -111,6 +113,7 @@ function newUiObjectsFromNodes () { } } } + receivedNode.isIncluded = true node.rootNodes.push(receivedNode) totalIncluded++ if (totalIncluded === includeDataMines.length + includeTradingSystems.length + includeSuperScripts.length) { diff --git a/DesignSpace/Workspace/Workspace.js b/DesignSpace/Workspace/Workspace.js index 14321b3f3..928a8679d 100644 --- a/DesignSpace/Workspace/Workspace.js +++ b/DesignSpace/Workspace/Workspace.js @@ -169,44 +169,13 @@ function newWorkspace () { } function stringifyWorkspace (removePersonalData) { - let code - if (thisObject.workspaceNode.code === undefined) { - thisObject.workspaceNode.code = '{ \n"includeDataMines": ["Masters", "Sparta", "TradingEngines"],\n"includeTradingSystems": ["WHB-BTC-USDT", "WHB-ETH-USDT", "BRR-BTC-USDT"],\n"includeSuperScripts": ["Superalgos"]\n }' - } - code = JSON.parse(thisObject.workspaceNode.code) - let includeDataMines = code.includeDataMines - let includeTradingSystems = code.includeTradingSystems - let includeSuperScripts = code.includeSuperScripts - let stringifyReadyNodes = [] for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) { let rootNode = thisObject.workspaceNode.rootNodes[i] - let node = functionLibraryProtocolNode.getProtocolNode(rootNode, removePersonalData, false, true, true, true) - if (node) { - switch (node.type) { - case 'Data Mine': { - code = JSON.parse(node.code) - if (includeDataMines.includes(code.codeName) === false) { - stringifyReadyNodes.push(node) - } - break - } - case 'Trading System': { - code = JSON.parse(node.code) - if (includeTradingSystems.includes(code.codeName) === false) { - stringifyReadyNodes.push(node) - } - break - } - case 'Super Scripts': { - code = JSON.parse(node.code) - if (includeSuperScripts.includes(code.codeName) === false) { - stringifyReadyNodes.push(node) - } - break - } - default: stringifyReadyNodes.push(node) - } + + if (rootNode.isIncluded !== true) { + let node = functionLibraryProtocolNode.getProtocolNode(rootNode, removePersonalData, false, true, true, true) + stringifyReadyNodes.push(node) } } let workspace = { diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index 86c66d73c..875fe2ecf 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -1537,7 +1537,11 @@ function newUiObject () { browserCanvasContext.closePath() browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.LIGHT_GREY + ', ' + OPACITY + ')' browserCanvasContext.lineWidth = 1 - browserCanvasContext.setLineDash([20, 20]) + if (thisObject.payload.node.isIncluded === true) { + browserCanvasContext.setLineDash([0, 0]) + } else { + browserCanvasContext.setLineDash([20, 20]) + } browserCanvasContext.stroke() } } From 6268679b95a5cf1ce83666fb8f0425d8ad91418d Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 30 Mar 2020 10:58:42 +0200 Subject: [PATCH 29/56] Update EdgeEditor.js --- ChartingSpace/EdgeEditor.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ChartingSpace/EdgeEditor.js b/ChartingSpace/EdgeEditor.js index 43329b0c0..55f237163 100644 --- a/ChartingSpace/EdgeEditor.js +++ b/ChartingSpace/EdgeEditor.js @@ -185,25 +185,25 @@ function newEdgeEditor () { function onKeyPressed (event) { const STEP = 10 - if (event.shiftKey === false && event.code === 'ArrowLeft') { + if (event.shiftKey === false && event.ctrlKey === false && event.code === 'ArrowLeft') { thisObject.container.frame.position.x = thisObject.container.frame.position.x + STEP whatHappened = 'left or right arrow key pressed' return } - if (event.shiftKey === false && event.code === 'ArrowRight') { + if (event.shiftKey === false && event.ctrlKey === false && event.code === 'ArrowRight') { thisObject.container.frame.position.x = thisObject.container.frame.position.x - STEP whatHappened = 'left or right arrow key pressed' return } - if (event.shiftKey === false && event.code === 'ArrowUp') { + if (event.shiftKey === false && event.ctrlKey === false && event.code === 'ArrowUp') { thisObject.container.frame.position.y = thisObject.container.frame.position.y + STEP whatHappened = 'up or down arrow key pressed' return } - if (event.shiftKey === false && event.code === 'ArrowDown') { + if (event.shiftKey === false && event.ctrlKey === false && event.code === 'ArrowDown') { thisObject.container.frame.position.y = thisObject.container.frame.position.y - STEP whatHappened = 'up or down arrow key pressed' return From e978cd396b8160522879fe0c82cdaf1cac6d321a Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 30 Mar 2020 12:38:43 +0200 Subject: [PATCH 30/56] Menues Animation Improved --- Animation.js | 6 ++++++ FloatingSpace/CircularMenuItem.js | 4 ++-- FloatingSpace/FloatingObject.js | 28 ++++++++++++++++------------ Globals.js | 2 +- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/Animation.js b/Animation.js index b06c4eb6d..1e06c4849 100644 --- a/Animation.js +++ b/Animation.js @@ -111,6 +111,10 @@ function newAnimation () { } } + /* Frame per Seconds */ + + ANIMATION_FRAME_PER_SECONDS = Math.trunc(1000 / totalTimeConsumed) + /* Performance Check */ if (SHOW_ANIMATION_PERFORMACE === true) { row = 0 @@ -132,6 +136,8 @@ function newAnimation () { printLabel(DEBUG.variable3, 300, 100 + row * 30, 1, 20, UI_COLOR.RED) row++ printLabel(DEBUG.variable4, 300, 100 + row * 30, 1, 20, UI_COLOR.RED) + row++ + printLabel('Animation Frame Per Seconds: ' + ANIMATION_FRAME_PER_SECONDS, 300, 100 + row * 30, 1, 20, UI_COLOR.TITANIUM_YELLOW) } } else { browserCanvas.width = 1 diff --git a/FloatingSpace/CircularMenuItem.js b/FloatingSpace/CircularMenuItem.js index ecebc02f7..ab741b23a 100644 --- a/FloatingSpace/CircularMenuItem.js +++ b/FloatingSpace/CircularMenuItem.js @@ -189,8 +189,8 @@ function newCircularMenuItem () { radiusGrowthFactor = 4 } - thisObject.container.frame.position.x = thisObject.container.frame.radius * radiusGrowthFactor / 7 * Math.cos(toRadians(thisObject.angle)) - thisObject.currentRadius * 1.5 - thisObject.container.frame.position.y = thisObject.container.frame.radius * radiusGrowthFactor / 7 * Math.sin(toRadians(thisObject.angle)) - thisObject.container.frame.height / 2 + thisObject.container.frame.position.x = thisObject.payload.floatingObject.targetRadius * radiusGrowthFactor / 7 * Math.cos(toRadians(thisObject.angle)) - thisObject.currentRadius * 1.5 + thisObject.container.frame.position.y = thisObject.payload.floatingObject.targetRadius * radiusGrowthFactor / 7 * Math.sin(toRadians(thisObject.angle)) - thisObject.container.frame.height / 2 temporaryStatusPhysics() diff --git a/FloatingSpace/FloatingObject.js b/FloatingSpace/FloatingObject.js index 6a4c8ea35..daa01b74d 100644 --- a/FloatingSpace/FloatingObject.js +++ b/FloatingSpace/FloatingObject.js @@ -345,41 +345,45 @@ function newFloatingObject () { function thisObjectPhysics () { // The radius also have a target. + let ANIMATION_STEP = Math.abs(thisObject.targetRadius - thisObject.rawRadius) / 5 - if (Math.abs(thisObject.container.frame.radius - thisObject.targetRadius) >= 10) { + if (ANIMATION_STEP === 0) { ANIMATION_STEP = 10 } + + if (Math.abs(thisObject.container.frame.radius - thisObject.targetRadius) >= ANIMATION_STEP) { if (thisObject.container.frame.radius < thisObject.targetRadius) { - thisObject.container.frame.radius = thisObject.container.frame.radius + 10 + thisObject.container.frame.radius = thisObject.container.frame.radius + ANIMATION_STEP } else { - thisObject.container.frame.radius = thisObject.container.frame.radius - 10 + thisObject.container.frame.radius = thisObject.container.frame.radius - ANIMATION_STEP } + thisObject.container.eventHandler.raiseEvent('Dimmensions Changed', event) } // The imageSize also have a target. - if (Math.abs(thisObject.currentImageSize - thisObject.targetImageSize) >= 10) { + if (Math.abs(thisObject.currentImageSize - thisObject.targetImageSize) >= ANIMATION_STEP) { if (thisObject.currentImageSize < thisObject.targetImageSize) { - thisObject.currentImageSize = thisObject.currentImageSize + 10 + thisObject.currentImageSize = thisObject.currentImageSize + ANIMATION_STEP } else { - thisObject.currentImageSize = thisObject.currentImageSize - 10 + thisObject.currentImageSize = thisObject.currentImageSize - ANIMATION_STEP } } // The fontSize also have a target. - if (Math.abs(thisObject.currentFontSize - thisObject.targetFontSize) >= 1) { + if (Math.abs(thisObject.currentFontSize - thisObject.targetFontSize) >= ANIMATION_STEP / 10) { if (thisObject.currentFontSize < thisObject.targetFontSize) { - thisObject.currentFontSize = thisObject.currentFontSize + 1 + thisObject.currentFontSize = thisObject.currentFontSize + ANIMATION_STEP / 10 } else { - thisObject.currentFontSize = thisObject.currentFontSize - 1 + thisObject.currentFontSize = thisObject.currentFontSize - ANIMATION_STEP / 10 } } - if (Math.abs(thisObject.currentHierarchyRing - thisObject.targetHierarchyRing) >= 10) { + if (Math.abs(thisObject.currentHierarchyRing - thisObject.targetHierarchyRing) >= ANIMATION_STEP) { if (thisObject.currentHierarchyRing < thisObject.targetHierarchyRing) { - thisObject.currentHierarchyRing = thisObject.currentHierarchyRing + 10 + thisObject.currentHierarchyRing = thisObject.currentHierarchyRing + ANIMATION_STEP } else { - thisObject.currentHierarchyRing = thisObject.currentHierarchyRing - 10 + thisObject.currentHierarchyRing = thisObject.currentHierarchyRing - ANIMATION_STEP } } diff --git a/Globals.js b/Globals.js index c27c27f98..ef291cca2 100644 --- a/Globals.js +++ b/Globals.js @@ -46,7 +46,7 @@ const ZOOM_OUT_THRESHOLD_FOR_DISPLAYING_TIME_MACHINES_ICONIZED = 5 const ZOOM_OUT_THRESHOLD_FOR_DISPLAYING_SCALES = 3 let FONT_ASPECT_RATIO = 0.32; - +let ANIMATION_FRAME_PER_SECONDS const GET_CONTAINER_PURPOSE = { MOUSE_OVER: 1, From 1edaadd71eadf79f02bc886729f310a113e92429 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 30 Mar 2020 13:14:33 +0200 Subject: [PATCH 31/56] Improves on Focus --- FloatingSpace/CircularMenuItem.js | 8 +++---- FloatingSpace/FloatingObject.js | 2 +- Spaces/FloatingSpace.js | 37 +++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 5 deletions(-) diff --git a/FloatingSpace/CircularMenuItem.js b/FloatingSpace/CircularMenuItem.js index ab741b23a..febc111e8 100644 --- a/FloatingSpace/CircularMenuItem.js +++ b/FloatingSpace/CircularMenuItem.js @@ -169,19 +169,19 @@ function newCircularMenuItem () { if (thisObject.type === 'Icon Only') { switch (thisObject.ring) { case 1: { - radiusGrowthFactor = 6.5 + radiusGrowthFactor = 5.5 break } case 2: { - radiusGrowthFactor = 5.0 + radiusGrowthFactor = 4.0 break } case 3: { - radiusGrowthFactor = 3.5 + radiusGrowthFactor = 3.0 break } case 4: { - radiusGrowthFactor = 2.5 + radiusGrowthFactor = 2.0 break } } diff --git a/FloatingSpace/FloatingObject.js b/FloatingSpace/FloatingObject.js index daa01b74d..f7d2c65b7 100644 --- a/FloatingSpace/FloatingObject.js +++ b/FloatingSpace/FloatingObject.js @@ -433,7 +433,7 @@ function newFloatingObject () { thisObject.targetFontSize = thisObject.rawFontSize * 1 thisObject.targetHierarchyRing = thisObject.rawHierarchyRing * 1 - thisObject.payload.uiObject.container.eventHandler.raiseEvent('onNotFocus') + thisObject.payload.uiObject.container.eventHandler.raiseEvent('onNotFocus', thisObject.container) if (thisObject.isPinned !== true) { thisObject.positionLocked = false diff --git a/Spaces/FloatingSpace.js b/Spaces/FloatingSpace.js index f04a22767..ea6ac13ba 100644 --- a/Spaces/FloatingSpace.js +++ b/Spaces/FloatingSpace.js @@ -57,14 +57,21 @@ function newFloatingSpace () { thisObject.container.frame.position.y = browserCanvas.height / 2 - thisObject.container.frame.height / 2 let visible = false + let containerOnFocus const PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT = 25 let onDragStartedEventSubscriptionId + let spaceFocusAquiredEventSubscriptionId + let containerOnFocusEventSubscriptionId return thisObject function finalize () { thisObject.container.eventHandler.stopListening(onDragStartedEventSubscriptionId) + canvas.floatingSpace.container.eventHandler.stopListening(spaceFocusAquiredEventSubscriptionId) + if (containerOnFocus !== undefined) { + containerOnFocus.eventHandler.stopListening(containerOnFocusEventSubscriptionId) + } thisObject.floatingLayer.finalize() thisObject.uiObjectConstructor.finalize() @@ -73,6 +80,8 @@ function newFloatingSpace () { thisObject.floatingLayer = undefined thisObject.uiObjectConstructor = undefined thisObject.container = undefined + + containerOnFocus = undefined } function initialize (callBackFunction) { @@ -83,6 +92,26 @@ function newFloatingSpace () { thisObject.uiObjectConstructor.initialize(thisObject.floatingLayer) onDragStartedEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onDragStarted', onDragStarted) + spaceFocusAquiredEventSubscriptionId = canvas.floatingSpace.container.eventHandler.listenToEvent('onFocusAquired', someoneAquiredFocus) + } + + function someoneAquiredFocus (container) { + if (container === undefined) { + return + } + containerOnFocus = container + containerOnFocusEventSubscriptionId = containerOnFocus.eventHandler.listenToEvent('onNotFocus', onNotFocus) + } + + function onNotFocus (container) { + if (container !== undefined) { + container.eventHandler.stopListening(containerOnFocusEventSubscriptionId) + } + if (containerOnFocus !== undefined) { + if (containerOnFocus.id === container.id) { + containerOnFocus = undefined + } + } } function toggleDrawReferenceLines () { @@ -347,8 +376,16 @@ function newFloatingSpace () { function getContainer (point) { if (visible === false) { return } + let container + if (containerOnFocus !== undefined) { + if (containerOnFocus.frame.isThisScreenPointHere(point) === true) { + containerOnFocus.space = 'Floating Space' + return containerOnFocus + } + } + container = thisObject.floatingLayer.getContainer(point) if (container !== undefined) { container.space = 'Floating Space' From dba1318352a8dab11d2145e0814ecde12c2d1cc7 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 30 Mar 2020 13:24:58 +0200 Subject: [PATCH 32/56] Bug fixed --- FloatingSpace/FloatingObject.js | 6 +++--- Spaces/FloatingSpace.js | 35 +++++++++++++++++---------------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/FloatingSpace/FloatingObject.js b/FloatingSpace/FloatingObject.js index f7d2c65b7..553477a81 100644 --- a/FloatingSpace/FloatingObject.js +++ b/FloatingSpace/FloatingObject.js @@ -413,14 +413,14 @@ function newFloatingObject () { removeFocus() } - function someoneAquiredFocus (container) { - if (container === undefined) { + function someoneAquiredFocus (floatingObject) { + if (floatingObject === undefined || floatingObject.container === undefined) { return } if (thisObject.container === undefined) { return } - if (container.id !== thisObject.container.id) { + if (floatingObject.container.id !== thisObject.container.id) { removeFocus() } } diff --git a/Spaces/FloatingSpace.js b/Spaces/FloatingSpace.js index ea6ac13ba..2ae63bbf9 100644 --- a/Spaces/FloatingSpace.js +++ b/Spaces/FloatingSpace.js @@ -57,20 +57,20 @@ function newFloatingSpace () { thisObject.container.frame.position.y = browserCanvas.height / 2 - thisObject.container.frame.height / 2 let visible = false - let containerOnFocus + let floatingObjetOnFocus const PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT = 25 let onDragStartedEventSubscriptionId let spaceFocusAquiredEventSubscriptionId - let containerOnFocusEventSubscriptionId + let floatingObjetOnFocusEventSubscriptionId return thisObject function finalize () { thisObject.container.eventHandler.stopListening(onDragStartedEventSubscriptionId) canvas.floatingSpace.container.eventHandler.stopListening(spaceFocusAquiredEventSubscriptionId) - if (containerOnFocus !== undefined) { - containerOnFocus.eventHandler.stopListening(containerOnFocusEventSubscriptionId) + if (floatingObjetOnFocus !== undefined) { + floatingObjetOnFocus.eventHandler.stopListening(floatingObjetOnFocusEventSubscriptionId) } thisObject.floatingLayer.finalize() @@ -81,7 +81,7 @@ function newFloatingSpace () { thisObject.uiObjectConstructor = undefined thisObject.container = undefined - containerOnFocus = undefined + floatingObjetOnFocus = undefined } function initialize (callBackFunction) { @@ -95,21 +95,21 @@ function newFloatingSpace () { spaceFocusAquiredEventSubscriptionId = canvas.floatingSpace.container.eventHandler.listenToEvent('onFocusAquired', someoneAquiredFocus) } - function someoneAquiredFocus (container) { - if (container === undefined) { + function someoneAquiredFocus (floatingObject) { + if (floatingObject === undefined || floatingObject.container === undefined) { return } - containerOnFocus = container - containerOnFocusEventSubscriptionId = containerOnFocus.eventHandler.listenToEvent('onNotFocus', onNotFocus) + floatingObjetOnFocus = floatingObject + floatingObjetOnFocusEventSubscriptionId = floatingObjetOnFocus.container.eventHandler.listenToEvent('onNotFocus', onNotFocus) } function onNotFocus (container) { if (container !== undefined) { - container.eventHandler.stopListening(containerOnFocusEventSubscriptionId) + container.eventHandler.stopListening(floatingObjetOnFocusEventSubscriptionId) } - if (containerOnFocus !== undefined) { - if (containerOnFocus.id === container.id) { - containerOnFocus = undefined + if (floatingObjetOnFocus !== undefined) { + if (floatingObjetOnFocus.container.id === container.id) { + floatingObjetOnFocus = undefined } } } @@ -379,10 +379,11 @@ function newFloatingSpace () { let container - if (containerOnFocus !== undefined) { - if (containerOnFocus.frame.isThisScreenPointHere(point) === true) { - containerOnFocus.space = 'Floating Space' - return containerOnFocus + if (floatingObjetOnFocus !== undefined) { + container = floatingObjetOnFocus.getContainer(point) + if (container !== undefined) { + container.space = 'Floating Space' + return container } } From f8593e8cd937f1902282e66185c705df515bce11 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 30 Mar 2020 14:05:37 +0200 Subject: [PATCH 33/56] on focus fixed --- FloatingSpace/FloatingObject.js | 2 +- Spaces/FloatingSpace.js | 16 ---------------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/FloatingSpace/FloatingObject.js b/FloatingSpace/FloatingObject.js index 553477a81..aedac3068 100644 --- a/FloatingSpace/FloatingObject.js +++ b/FloatingSpace/FloatingObject.js @@ -404,7 +404,7 @@ function newFloatingObject () { thisObject.positionLocked = true - canvas.floatingSpace.container.eventHandler.raiseEvent('onFocusAquired', thisObject.container) + canvas.floatingSpace.container.eventHandler.raiseEvent('onFocusAquired', thisObject) thisObject.isOnFocus = true } } diff --git a/Spaces/FloatingSpace.js b/Spaces/FloatingSpace.js index 2ae63bbf9..7664b7fc5 100644 --- a/Spaces/FloatingSpace.js +++ b/Spaces/FloatingSpace.js @@ -62,16 +62,12 @@ function newFloatingSpace () { const PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT = 25 let onDragStartedEventSubscriptionId let spaceFocusAquiredEventSubscriptionId - let floatingObjetOnFocusEventSubscriptionId return thisObject function finalize () { thisObject.container.eventHandler.stopListening(onDragStartedEventSubscriptionId) canvas.floatingSpace.container.eventHandler.stopListening(spaceFocusAquiredEventSubscriptionId) - if (floatingObjetOnFocus !== undefined) { - floatingObjetOnFocus.eventHandler.stopListening(floatingObjetOnFocusEventSubscriptionId) - } thisObject.floatingLayer.finalize() thisObject.uiObjectConstructor.finalize() @@ -100,18 +96,6 @@ function newFloatingSpace () { return } floatingObjetOnFocus = floatingObject - floatingObjetOnFocusEventSubscriptionId = floatingObjetOnFocus.container.eventHandler.listenToEvent('onNotFocus', onNotFocus) - } - - function onNotFocus (container) { - if (container !== undefined) { - container.eventHandler.stopListening(floatingObjetOnFocusEventSubscriptionId) - } - if (floatingObjetOnFocus !== undefined) { - if (floatingObjetOnFocus.container.id === container.id) { - floatingObjetOnFocus = undefined - } - } } function toggleDrawReferenceLines () { From a006868f495be51015360b3a08904584c0180b90 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 30 Mar 2020 15:37:14 +0200 Subject: [PATCH 34/56] Aspect Ratio Improved --- ChartingSpace/EdgeEditor.js | 2 +- ChartingSpace/Viewport.js | 4 ++-- FloatingSpace/FloatingObject.js | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ChartingSpace/EdgeEditor.js b/ChartingSpace/EdgeEditor.js index 55f237163..02af47f99 100644 --- a/ChartingSpace/EdgeEditor.js +++ b/ChartingSpace/EdgeEditor.js @@ -109,7 +109,7 @@ function newEdgeEditor () { /* Resize the Time Machine to match the current screen aspect ration */ thisObject.container.parentContainer.frame.width = browserCanvas.width / TIME_MACHINE_WIDTH - thisObject.container.parentContainer.frame.height = (browserCanvas.height - TOP_SPACE_HEIGHT - COCKPIT_SPACE_HEIGHT) / TIME_MACHINE_HEIGHT + thisObject.container.parentContainer.frame.height = (COCKPIT_SPACE_POSITION - TOP_SPACE_HEIGHT) / TIME_MACHINE_HEIGHT coordinateSystem.maxHeight = thisObject.container.parentContainer.frame.height coordinateSystem.maxWidth = thisObject.container.parentContainer.frame.width coordinateSystem.recalculateScale() diff --git a/ChartingSpace/Viewport.js b/ChartingSpace/Viewport.js index 229baa6d2..4f60172be 100644 --- a/ChartingSpace/Viewport.js +++ b/ChartingSpace/Viewport.js @@ -140,7 +140,7 @@ function newViewport () { y: -container.frame.position.y - container.frame.height / 2 } position.x = targetPoint.x + browserCanvas.width / 2 - position.y = targetPoint.y + (browserCanvas.height - COCKPIT_SPACE_HEIGHT - TOP_SPACE_HEIGHT) / 2 + TOP_SPACE_HEIGHT + position.y = targetPoint.y + (COCKPIT_SPACE_POSITION - TOP_SPACE_HEIGHT) / 2 + TOP_SPACE_HEIGHT } function zoomAtCenter (level) { @@ -152,7 +152,7 @@ function newViewport () { function mousePositionPhysics () { if (overrideMousePositionCounter > 0) { thisObject.mousePosition.x = browserCanvas.width / 2 - thisObject.mousePosition.y = (browserCanvas.height - TOP_SPACE_HEIGHT - COCKPIT_SPACE_HEIGHT) / 2 + TOP_SPACE_HEIGHT + thisObject.mousePosition.y = (COCKPIT_SPACE_POSITION - TOP_SPACE_HEIGHT) / 2 + TOP_SPACE_HEIGHT overrideMousePositionCounter-- if (overrideMousePositionCounter < 0) { diff --git a/FloatingSpace/FloatingObject.js b/FloatingSpace/FloatingObject.js index aedac3068..a57cbefec 100644 --- a/FloatingSpace/FloatingObject.js +++ b/FloatingSpace/FloatingObject.js @@ -108,6 +108,7 @@ function newFloatingObject () { } function getContainer (point) { + if (thisObject.payload === undefined) { return } if ((thisObject.isCollapsed === true && thisObject.collapsedManually === false) || thisObject.isParentCollapsed === true) { return } if (canvas.floatingSpace.inMapMode === true) { return } let container From 703ef3e2fdb7002bb50ca8da97dc2d876c7a0426 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 30 Mar 2020 15:52:57 +0200 Subject: [PATCH 35/56] Editors at better size --- FloatingSpace/CodeEditor.js | 7 ++++--- FloatingSpace/FormulaEditor.js | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/FloatingSpace/CodeEditor.js b/FloatingSpace/CodeEditor.js index e88d72a87..eb62d64e0 100644 --- a/FloatingSpace/CodeEditor.js +++ b/FloatingSpace/CodeEditor.js @@ -34,6 +34,7 @@ function newCodeEditor () { thisObject.container.frame.position.y = 0 let isMouseOver = false + let SIZE_FACTOR = 1.4 return thisObject @@ -129,8 +130,8 @@ function newCodeEditor () { thisObject.container.frame.position.x = 0 thisObject.container.frame.position.y = 0 - thisObject.container.frame.width = thisObject.container.frame.radius * 1.8 * 1.5 - thisObject.container.frame.height = thisObject.container.frame.radius * 1 * 1.4 + thisObject.container.frame.width = thisObject.container.frame.radius * 1.8 * SIZE_FACTOR + thisObject.container.frame.height = thisObject.container.frame.radius * 1 * SIZE_FACTOR let textAreaPosition = { x: 0 - thisObject.container.frame.width / 2, @@ -162,7 +163,7 @@ function newCodeEditor () { position = thisObject.container.frame.frameThisPoint(position) - let radius = thisObject.container.frame.radius * 1.5 + let radius = thisObject.container.frame.radius * SIZE_FACTOR if (radius > 0.5) { browserCanvasContext.beginPath() diff --git a/FloatingSpace/FormulaEditor.js b/FloatingSpace/FormulaEditor.js index 42f599b77..e03dbdc1e 100644 --- a/FloatingSpace/FormulaEditor.js +++ b/FloatingSpace/FormulaEditor.js @@ -34,6 +34,7 @@ function newFormulaEditor () { thisObject.container.frame.position.y = 0 let isMouseOver = false + let SIZE_FACTOR = 1.2 return thisObject @@ -129,8 +130,8 @@ function newFormulaEditor () { thisObject.container.frame.position.x = 0 thisObject.container.frame.position.y = 0 - thisObject.container.frame.width = thisObject.container.frame.radius * 1.8 * 2 - thisObject.container.frame.height = thisObject.container.frame.radius * 1 * 2 + thisObject.container.frame.width = thisObject.container.frame.radius * 1.8 * SIZE_FACTOR + thisObject.container.frame.height = thisObject.container.frame.radius * 1 * SIZE_FACTOR let textAreaPosition = { x: 0 - thisObject.container.frame.width / 2, @@ -162,7 +163,7 @@ function newFormulaEditor () { position = thisObject.container.frame.frameThisPoint(position) - let radius = thisObject.container.frame.radius * 2 + let radius = thisObject.container.frame.radius * SIZE_FACTOR if (radius > 0.5) { browserCanvasContext.beginPath() From 0185b90b36d961144675ccf03cb6ced5a7f8cb6b Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 30 Mar 2020 18:53:02 +0200 Subject: [PATCH 36/56] Faster Menues --- FloatingSpace/CircularMenu.js | 2 +- FloatingSpace/CircularMenuItem.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/FloatingSpace/CircularMenu.js b/FloatingSpace/CircularMenu.js index 12b10a3b0..0ac7ccad9 100644 --- a/FloatingSpace/CircularMenu.js +++ b/FloatingSpace/CircularMenu.js @@ -198,7 +198,7 @@ function newCircularMenu () { function onNotFocus () { for (let i = 0; i < menuItems.length; i++) { let menuItem = menuItems[i] - menuItem.targetRadius = menuItem.rawRadius * 0 - i * 4 + menuItem.targetRadius = menuItem.rawRadius * 0 - i * 1.5 menuItem.isDeployed = false } thisObject.isDeployed = false diff --git a/FloatingSpace/CircularMenuItem.js b/FloatingSpace/CircularMenuItem.js index febc111e8..fa75c524a 100644 --- a/FloatingSpace/CircularMenuItem.js +++ b/FloatingSpace/CircularMenuItem.js @@ -155,7 +155,8 @@ function newCircularMenuItem () { function physics () { if (thisObject.dontShowAtFullscreen === true && AT_FULL_SCREEN_MODE === true) { return } - const INCREASE_STEP = 2 + let INCREASE_STEP = 2 // (thisObject.targetRadius - thisObject.rawRadius) / 4 + // if (INCREASE_STEP === 0) { INCREASE_STEP = 2 } if (Math.abs(thisObject.currentRadius - thisObject.targetRadius) >= INCREASE_STEP) { if (thisObject.currentRadius < thisObject.targetRadius) { From b4475efc5dea9ec912d3222d76adf5bfb4207d01 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 30 Mar 2020 20:04:24 +0200 Subject: [PATCH 37/56] numbers shorcuts --- Canvas.js | 22 ++++++++++++++++++++++ FloatingSpace/CircularMenuItem.js | 15 ++++++++++++++- Globals.js | 1 + 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/Canvas.js b/Canvas.js index 29d8cc855..473851549 100644 --- a/Canvas.js +++ b/Canvas.js @@ -40,6 +40,7 @@ function newCanvas () { designSpace: undefined, animation: undefined, mouse: undefined, + shorcutNumbers: new Map(), initialize: initialize, finalize: finalize } @@ -57,12 +58,14 @@ function newCanvas () { }, action: '' } + return thisObject function finalize () { try { thisObject.chartingSpace.finalize() thisObject.floatingSpace.finalize() + thisObject.shorcutNumbers = undefined browserCanvas.removeEventListener('mousedown', onMouseDown, false) browserCanvas.removeEventListener('mouseup', onMouseUp, false) @@ -252,6 +255,24 @@ function newCanvas () { checkMediaRecording(event) canvas.chartingSpace.onKeyPressed(event) + /* Shourcuts to Menu Items */ + if ((event.keyCode >= 48 && event.keyCode <= 57)) { + let number = event.key + if (MENU_ITEM_ON_FOCUS !== undefined) { + let menuItem = thisObject.shorcutNumbers.get(number) + if (menuItem !== undefined) { + menuItem.shorcutNumber = undefined + } + thisObject.shorcutNumbers.set(number, MENU_ITEM_ON_FOCUS) + MENU_ITEM_ON_FOCUS.shorcutNumber = number + } else { + let menuItem = thisObject.shorcutNumbers.get(number) + if (menuItem !== undefined) { + menuItem.internalClick() + } + } + } + if (event.key === 'Escape' && canvas.floatingSpace.inMapMode === true) { canvas.floatingSpace.exitMapMode() } @@ -409,6 +430,7 @@ function newCanvas () { } if ((event.ctrlKey === true || event.metaKey === true) && event.altKey === true) { + /* Shortcuts to nodes */ if ((event.keyCode >= 48 && event.keyCode <= 57) || (event.keyCode >= 65 && event.keyCode <= 90)) { /* From here we prevent the default behaviour. Putting it earlier prevents imput box and text area to receive keystrokes */ event.preventDefault() diff --git a/FloatingSpace/CircularMenuItem.js b/FloatingSpace/CircularMenuItem.js index fa75c524a..e344d69fc 100644 --- a/FloatingSpace/CircularMenuItem.js +++ b/FloatingSpace/CircularMenuItem.js @@ -39,6 +39,7 @@ function newCircularMenuItem () { relatedUiObject: undefined, dontShowAtFullscreen: undefined, isEnabled: true, + shorcutNumber: undefined, internalClick: internalClick, physics: physics, invisiblePhysics: invisiblePhysics, @@ -255,13 +256,20 @@ function newCircularMenuItem () { } else { isMouseOver = false } + MENU_ITEM_ON_FOCUS = thisObject } function onMouseNotOver (point) { isMouseOver = false + MENU_ITEM_ON_FOCUS = undefined } function internalClick () { + if (thisObject.shorcutNumber !== undefined) { + let label = thisObject.payload.node.name + ' ' + labelToPrint + canvas.cockpitSpace.setStatus(label, 50, canvas.cockpitSpace.statusTypes.ALL_GOOD) + } + onMouseClick() } @@ -435,6 +443,11 @@ function newCircularMenuItem () { /* Menu Label */ if (thisObject.type === 'Icon & Text') { + label = labelToPrint + if (thisObject.shorcutNumber !== undefined) { + label = '' + thisObject.shorcutNumber + '- ' + labelToPrint + } + let labelPoint let fontSize = 15 @@ -448,7 +461,7 @@ function newCircularMenuItem () { browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 1)' - browserCanvasContext.fillText(labelToPrint, labelPoint.x, labelPoint.y) + browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y) } } } diff --git a/Globals.js b/Globals.js index ef291cca2..1eea3dd41 100644 --- a/Globals.js +++ b/Globals.js @@ -121,6 +121,7 @@ let dailyFilePeriods = dailyFilePeriods = JSON.parse(dailyFilePeriods); let SHOW_ANIMATION_PERFORMACE = false; +let MENU_ITEM_ON_FOCUS let testUser = window.localStorage.getItem("test_user") let LOGGED_IN_USER_LOCAL_STORAGE_KEY From 7f84ce40efbca71994e991ad6d24b09dad966ba0 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 30 Mar 2020 20:49:03 +0200 Subject: [PATCH 38/56] bug fixed with shorcut numbers --- Canvas.js | 1 + FloatingSpace/CodeEditor.js | 2 ++ Globals.js | 1 + 3 files changed, 4 insertions(+) diff --git a/Canvas.js b/Canvas.js index 473851549..b50e017af 100644 --- a/Canvas.js +++ b/Canvas.js @@ -249,6 +249,7 @@ function newCanvas () { } function onKeyDown (event) { + if (EDITOR_ON_FOCUS === true) { return } thisObject.mouse.event = event thisObject.mouse.action = 'key down' diff --git a/FloatingSpace/CodeEditor.js b/FloatingSpace/CodeEditor.js index eb62d64e0..89bce2189 100644 --- a/FloatingSpace/CodeEditor.js +++ b/FloatingSpace/CodeEditor.js @@ -73,6 +73,7 @@ function newCodeEditor () { textArea.style.display = 'none' thisObject.payload.node.code = textArea.value } + EDITOR_ON_FOCUS = false } function activate (payload) { @@ -98,6 +99,7 @@ function newCodeEditor () { 'height: ' + thisObject.container.frame.height + 'px' textArea.style.display = 'block' textArea.focus() + EDITOR_ON_FOCUS = true } function getContainer (point) { diff --git a/Globals.js b/Globals.js index 1eea3dd41..4c4fd5ecc 100644 --- a/Globals.js +++ b/Globals.js @@ -122,6 +122,7 @@ dailyFilePeriods = JSON.parse(dailyFilePeriods); let SHOW_ANIMATION_PERFORMACE = false; let MENU_ITEM_ON_FOCUS +let EDITOR_ON_FOCUS let testUser = window.localStorage.getItem("test_user") let LOGGED_IN_USER_LOCAL_STORAGE_KEY From 0ab21075be178efe2f61ffb5d5f14aa45bddf71d Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 1 Apr 2020 09:33:18 +0200 Subject: [PATCH 39/56] editors fix --- FloatingSpace/ConditionEditor.js | 2 ++ FloatingSpace/ConfigEditor.js | 2 ++ FloatingSpace/FormulaEditor.js | 2 ++ 3 files changed, 6 insertions(+) diff --git a/FloatingSpace/ConditionEditor.js b/FloatingSpace/ConditionEditor.js index b1b66d599..d7a16f968 100644 --- a/FloatingSpace/ConditionEditor.js +++ b/FloatingSpace/ConditionEditor.js @@ -72,6 +72,7 @@ function newConditionEditor () { textArea.style.display = 'none' thisObject.payload.node.code = textArea.value } + EDITOR_ON_FOCUS = false } function activate (payload) { @@ -97,6 +98,7 @@ function newConditionEditor () { 'height: ' + thisObject.container.frame.height + 'px' textArea.style.display = 'block' textArea.focus() + EDITOR_ON_FOCUS = true } function getContainer (point) { diff --git a/FloatingSpace/ConfigEditor.js b/FloatingSpace/ConfigEditor.js index 920c90a76..3136045c5 100644 --- a/FloatingSpace/ConfigEditor.js +++ b/FloatingSpace/ConfigEditor.js @@ -79,6 +79,7 @@ function newConfigEditor () { thisObject.payload.uiObject.setErrorMessage(err.message, 10) } } + EDITOR_ON_FOCUS = false } function activate (payload) { @@ -104,6 +105,7 @@ function newConfigEditor () { 'height: ' + thisObject.container.frame.height + 'px' textArea.style.display = 'block' textArea.focus() + EDITOR_ON_FOCUS = true } function getContainer (point) { diff --git a/FloatingSpace/FormulaEditor.js b/FloatingSpace/FormulaEditor.js index e03dbdc1e..0872f1b5f 100644 --- a/FloatingSpace/FormulaEditor.js +++ b/FloatingSpace/FormulaEditor.js @@ -73,6 +73,7 @@ function newFormulaEditor () { textArea.style.display = 'none' thisObject.payload.node.code = textArea.value } + EDITOR_ON_FOCUS = false } function activate (payload) { @@ -98,6 +99,7 @@ function newFormulaEditor () { 'height: ' + thisObject.container.frame.height + 'px' textArea.style.display = 'block' textArea.focus() + EDITOR_ON_FOCUS = true } function getContainer (point) { From 771d4ff34b16c68a95a1b8f523271696f2b02b48 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 1 Apr 2020 09:52:56 +0200 Subject: [PATCH 40/56] automatic scales fixed --- Scales/AutoScaleButton.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/Scales/AutoScaleButton.js b/Scales/AutoScaleButton.js index 1034443ca..597f1c2b2 100644 --- a/Scales/AutoScaleButton.js +++ b/Scales/AutoScaleButton.js @@ -85,10 +85,10 @@ function newAutoScaleButton () { currentStatus = 2 } if (thisObject.autoMinScale === false && thisObject.autoMaxScale === true) { - currentStatus = 3 + currentStatus = 4 } if (thisObject.autoMinScale === true && thisObject.autoMaxScale === true) { - currentStatus = 4 + currentStatus = 6 } } function onMouseWheel (event) { @@ -100,8 +100,8 @@ function newAutoScaleButton () { delta = 1 } currentStatus = currentStatus + delta - if (currentStatus === 5) { currentStatus = 1 } - if (currentStatus === 0) { currentStatus = 4 } + if (currentStatus === 7) { currentStatus = 1 } + if (currentStatus === 0) { currentStatus = 6 } switch (currentStatus) { case 1: { @@ -118,11 +118,23 @@ function newAutoScaleButton () { } case 3: { thisObject.autoMinScale = false - thisObject.autoMaxScale = true + thisObject.autoMaxScale = false update() return } case 4: { + thisObject.autoMinScale = false + thisObject.autoMaxScale = true + update() + return + } + case 5: { + thisObject.autoMinScale = false + thisObject.autoMaxScale = false + update() + return + } + case 6: { thisObject.autoMinScale = true thisObject.autoMaxScale = true update() From 4fc824ac2d9d563a77436539876b84e3b7166c2c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 1 Apr 2020 12:01:42 +0200 Subject: [PATCH 41/56] Improving in coordinate System with Margins --- ChartingSpace/CoordinateSystem.js | 24 ++++++++++++++---------- ChartingSpace/EdgeEditor.js | 5 +++-- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/ChartingSpace/CoordinateSystem.js b/ChartingSpace/CoordinateSystem.js index 4e28a1716..653004e23 100644 --- a/ChartingSpace/CoordinateSystem.js +++ b/ChartingSpace/CoordinateSystem.js @@ -19,6 +19,10 @@ function newCoordinateSystem () { autoMaxXScale: true, autoMinYScale: true, autoMaxYScale: true, + HORIZONTAL_MARGIN_FACTOR: 0.80, + VERTICAL_MARGIN_FACTOR: 0.90, + HORIZONTAL_MARGIN_INVERSE_FACTOR: 0.20, + VERTICAL_MARGIN_INVERSE_FACTOR: 0.10, physics: physics, reportXValue: reportXValue, reportYValue: reportYValue, @@ -193,8 +197,8 @@ function newCoordinateSystem () { } function recalculateScale (event) { - thisObject.scale.x = thisObject.maxWidth / (thisObject.max.x - thisObject.min.x) - thisObject.scale.y = thisObject.maxHeight / (thisObject.max.y - thisObject.min.y) + thisObject.scale.x = thisObject.maxWidth * thisObject.HORIZONTAL_MARGIN_FACTOR / (thisObject.max.x - thisObject.min.x) + thisObject.scale.y = thisObject.maxHeight * thisObject.VERTICAL_MARGIN_FACTOR / (thisObject.max.y - thisObject.min.y) thisObject.eventHandler.raiseEvent('Scale Changed', event) } @@ -230,8 +234,8 @@ function newCoordinateSystem () { */ point = { - x: (point.x - thisObject.min.x) * thisObject.scale.x, - y: thisObject.maxHeight - (point.y - thisObject.min.y) * thisObject.scale.y + x: (point.x - thisObject.min.x) * thisObject.scale.x + thisObject.maxWidth * thisObject.HORIZONTAL_MARGIN_INVERSE_FACTOR / 2, + y: thisObject.maxHeight - (point.y - thisObject.min.y) * thisObject.scale.y - thisObject.maxHeight * thisObject.VERTICAL_MARGIN_INVERSE_FACTOR / 2 } return point @@ -239,8 +243,8 @@ function newCoordinateSystem () { function transformThisPoint2 (point) { point = { - x: (point.x - thisObject.min.x) * thisObject.scale.x, - y: (thisObject.maxHeight - point.y - thisObject.min.y) * thisObject.scale.y + x: (point.x - thisObject.min.x) * thisObject.scale.x + thisObject.maxWidth * thisObject.HORIZONTAL_MARGIN_INVERSE_FACTOR / 2, + y: (thisObject.maxHeight - point.y - thisObject.min.y) * thisObject.scale.y - thisObject.maxHeight * thisObject.VERTICAL_MARGIN_INVERSE_FACTOR / 2 } return point @@ -248,8 +252,8 @@ function newCoordinateSystem () { function unInverseTransform (point, inverseY) { point = { - x: (point.x / thisObject.scale.x) + thisObject.min.x, - y: (inverseY - point.y) / thisObject.scale.y + thisObject.min.y + x: ((point.x - thisObject.maxWidth * thisObject.HORIZONTAL_MARGIN_INVERSE_FACTOR / 2) / thisObject.scale.x) + thisObject.min.x, + y: (inverseY * thisObject.VERTICAL_MARGIN_FACTOR - point.y + thisObject.maxHeight * thisObject.VERTICAL_MARGIN_INVERSE_FACTOR / 2) / thisObject.scale.y + thisObject.min.y } return point @@ -257,8 +261,8 @@ function newCoordinateSystem () { function inverseTransformUncappedY (point, inverseY) { point = { - x: (point.x - thisObject.min.x) * thisObject.scale.x, - y: (inverseY - point.y) * thisObject.scale.y + x: (point.x - thisObject.min.x) * thisObject.scale.x + thisObject.maxWidth * thisObject.HORIZONTAL_MARGIN_INVERSE_FACTOR / 2, + y: (inverseY * thisObject.VERTICAL_MARGIN_FACTOR - point.y) * thisObject.scale.y - thisObject.maxHeight * thisObject.VERTICAL_MARGIN_INVERSE_FACTOR / 2 } return point diff --git a/ChartingSpace/EdgeEditor.js b/ChartingSpace/EdgeEditor.js index 02af47f99..df338ece4 100644 --- a/ChartingSpace/EdgeEditor.js +++ b/ChartingSpace/EdgeEditor.js @@ -268,6 +268,7 @@ function newEdgeEditor () { } function draggingPhysics () { + if (coordinateSystemWhenDragStarted === undefined) { return } if (thisObject.container.frame.position.x === 0 && thisObject.container.frame.position.y === 0) { return } let mouseNoZoom = canvas.chartingSpace.viewport.unTransformThisPoint(mouse.position) @@ -324,7 +325,7 @@ function newEdgeEditor () { break case 'left or right arrow key pressed': { let point = { - x: -dragVector.x, + x: -dragVector.x + thisObject.container.frame.width * coordinateSystem.HORIZONTAL_MARGIN_INVERSE_FACTOR / 2, y: 0 } @@ -342,7 +343,7 @@ function newEdgeEditor () { case 'up or down arrow key pressed': { let point = { x: 0, - y: -dragVector.y + y: -dragVector.y + thisObject.container.frame.height * coordinateSystem.VERTICAL_MARGIN_INVERSE_FACTOR / 2 } let newMaxRate = getRateFromPointAtContainer(point, thisObject.container.parentContainer, coordinateSystem) From d0d7155d2525ce0040d3055ae1b4121ced48124e Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 1 Apr 2020 12:56:40 +0200 Subject: [PATCH 42/56] Update UiObjectTitle.js --- FloatingSpace/UiObjectTitle.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/FloatingSpace/UiObjectTitle.js b/FloatingSpace/UiObjectTitle.js index cb723a0b0..cc3dd557a 100644 --- a/FloatingSpace/UiObjectTitle.js +++ b/FloatingSpace/UiObjectTitle.js @@ -12,6 +12,7 @@ function newUiObjectTitle () { editMode: undefined, container: undefined, payload: undefined, + isDefault: undefined, enterEditMode: enterEditMode, exitEditMode: exitEditMode, physics: physics, @@ -81,6 +82,19 @@ function newUiObjectTitle () { } function physics () { + inheritancePhysics() + defaultPhysics() + } + + function defaultPhysics () { + if (thisObject.payload.title !== 'New ' + thisObject.payload.node.type && thisObject.payload.title !== 'My ' + thisObject.payload.node.type) { + thisObject.isDefault = false + } else { + thisObject.isDefault = true + } + } + + function inheritancePhysics () { if (thisObject.payload.title === undefined) { return } /* It is possible to override the default title by setting the APP SCHEMA property 'title' */ @@ -255,7 +269,7 @@ function newUiObjectTitle () { } function draw () { - if (thisObject.isOnFocus === true || thisObject.allwaysVisible === true) { + if (thisObject.isOnFocus === true || thisObject.allwaysVisible === true || thisObject.isDefault === false) { if (thisObject.payload.uiObject.codeEditor !== undefined) { if (thisObject.payload.uiObject.codeEditor.visible !== true) { drawTitleBackground() @@ -291,7 +305,7 @@ function newUiObjectTitle () { let fontSize = thisObject.payload.floatingObject.currentFontSize let label - if (radius > 6 && (thisObject.isOnFocus === true || thisObject.allwaysVisible === true)) { + if (radius > 6 && (thisObject.isOnFocus === true || thisObject.allwaysVisible === true || thisObject.isDefault === false)) { browserCanvasContext.strokeStyle = thisObject.payload.floatingObject.labelStrokeStyle browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY From c55df928e84025df549990bf72d6a12b9547398c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 1 Apr 2020 17:16:57 +0200 Subject: [PATCH 43/56] Announcements Improved --- DesignSpace/Workspace/FunctionLibraries/SessionFunctions.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DesignSpace/Workspace/FunctionLibraries/SessionFunctions.js b/DesignSpace/Workspace/FunctionLibraries/SessionFunctions.js index 3d393d8ab..33542151d 100644 --- a/DesignSpace/Workspace/FunctionLibraries/SessionFunctions.js +++ b/DesignSpace/Workspace/FunctionLibraries/SessionFunctions.js @@ -37,7 +37,7 @@ function newSessionFunctions () { 'Exchange Account Asset->Asset->' + 'Strategy->' + 'Trigger Stage->Trigger On Event->Trigger Off Event->Take Position Event->' + - 'Announcement->Telegram Bot->' + + 'Announcement->Formula->' + 'Open Stage->Initial Definition->Open Execution->' + 'Position Size->Position Rate->Formula->' + 'Initial Stop->Initial Take Profit->' + @@ -45,8 +45,8 @@ function newSessionFunctions () { 'Stop->Take Profit->' + 'Phase->Formula->Next Phase Event->' + 'Situation->Condition->Javascript Code->' + - 'Announcement->Telegram Bot->Formula->' + - 'Close Stage->Close Execution->' + 'Close Stage->Close Execution->' + + 'Announcement->Formula->' let tradingSystem = functionLibraryProtocolNode.getProtocolNode(node.payload.referenceParent, false, true, true, false, false, lightingPath) From 29fe67a46696d30fe75969f7e888520cdb3e3e07 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 2 Apr 2020 11:53:36 +0200 Subject: [PATCH 44/56] Update EventHandler.js --- EventHandler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EventHandler.js b/EventHandler.js index da29745a9..d387e2b68 100644 --- a/EventHandler.js +++ b/EventHandler.js @@ -17,7 +17,7 @@ function newEventHandler () { } function listenToEvent (eventType, handler, extraData) { - let eventSubscriptionId = Math.trunc(Math.random() * 1000000) + let eventSubscriptionId = newUniqueId() eventHandlers.push([eventType, handler, extraData, eventSubscriptionId]) return eventSubscriptionId } From c74e5ef080e7d86a199412c8cc58eabca5610e96 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 2 Apr 2020 12:16:32 +0200 Subject: [PATCH 45/56] bug fixed when drag started --- ChartingSpace/EdgeEditor.js | 4 ++++ Container.js | 2 +- Spaces/PanelsSpace.js | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChartingSpace/EdgeEditor.js b/ChartingSpace/EdgeEditor.js index df338ece4..ed34a50f4 100644 --- a/ChartingSpace/EdgeEditor.js +++ b/ChartingSpace/EdgeEditor.js @@ -186,24 +186,28 @@ function newEdgeEditor () { const STEP = 10 if (event.shiftKey === false && event.ctrlKey === false && event.code === 'ArrowLeft') { + onDragStarted(event) thisObject.container.frame.position.x = thisObject.container.frame.position.x + STEP whatHappened = 'left or right arrow key pressed' return } if (event.shiftKey === false && event.ctrlKey === false && event.code === 'ArrowRight') { + onDragStarted(event) thisObject.container.frame.position.x = thisObject.container.frame.position.x - STEP whatHappened = 'left or right arrow key pressed' return } if (event.shiftKey === false && event.ctrlKey === false && event.code === 'ArrowUp') { + onDragStarted(event) thisObject.container.frame.position.y = thisObject.container.frame.position.y + STEP whatHappened = 'up or down arrow key pressed' return } if (event.shiftKey === false && event.ctrlKey === false && event.code === 'ArrowDown') { + onDragStarted(event) thisObject.container.frame.position.y = thisObject.container.frame.position.y - STEP whatHappened = 'up or down arrow key pressed' return diff --git a/Container.js b/Container.js index a4a0b5901..56cf14085 100644 --- a/Container.js +++ b/Container.js @@ -1,7 +1,7 @@ function newContainer () { let thisObject = { - id: Math.trunc(Math.random() * 10000000), + id: newUniqueId(), type: 'Rectangle', frame: undefined, eventHandler: undefined, diff --git a/Spaces/PanelsSpace.js b/Spaces/PanelsSpace.js index fbfb144f6..28ffa303f 100644 --- a/Spaces/PanelsSpace.js +++ b/Spaces/PanelsSpace.js @@ -71,7 +71,7 @@ function newPanelsSpace () { panel.owner = pOwner thisObject.panels.push(panel) - panel.handle = Math.floor((Math.random() * 10000000) + 1) + panel.handle = newUniqueId() return panel.handle } From 9698533f9e3956b70eccd5ae4b1fb2a129464693 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 2 Apr 2020 13:22:19 +0200 Subject: [PATCH 46/56] taking position of siblings --- FloatingSpace/FloatingObject.js | 4 +-- FloatingSpace/UiObjectConstructor.js | 54 ++++++++++++++++++++++++++-- 2 files changed, 53 insertions(+), 5 deletions(-) diff --git a/FloatingSpace/FloatingObject.js b/FloatingSpace/FloatingObject.js index a57cbefec..54d7544fc 100644 --- a/FloatingSpace/FloatingObject.js +++ b/FloatingSpace/FloatingObject.js @@ -22,8 +22,8 @@ function newFloatingObject () { targetRadius: 0, // This is the target radius of the floating object with zoom applied. It should be animated until reaching this value. isPinned: false, isFrozen: false, - angleToParent: ANGLE_TO_PARENT.RANGE_90, - distanceToParent: DISTANCE_TO_PARENT.PARENT_100X, + angleToParent: undefined, + distanceToParent: undefined, isCollapsed: false, isParentCollapsed: false, frozenManually: false, diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index 4fe03a6bd..276e3e167 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -65,10 +65,58 @@ function newUiObjectConstructor () { } } - /* For brand new objects being created directly by the user, we will make them inherit some properties from their parents. */ + /* + For brand new objects being created directly by the user, we will make them inherit some properties + from their closest siblings, and if they don't have, from their parents. + */ + if (userAddingNew === true) { - floatingObject.angleToParent = payload.parentNode.payload.floatingObject.angleToParent - floatingObject.distanceToParent = payload.parentNode.payload.floatingObject.distanceToParent + let definition = APP_SCHEMA_MAP.get(payload.parentNode.type) + for (let i = 0; i < definition.properties.length; i++) { + let property = definition.properties[i] + if (property.childType === payload.node.type) { + if (property.type === 'array') { + let parentNode = payload.parentNode + let parentNodeArray = parentNode[property.name] + if (parentNodeArray.length > 1) { // the new node was already added + let closestSibling = parentNodeArray[parentNodeArray.length - 2] + if (closestSibling !== undefined) { + floatingObject.angleToParent = closestSibling.payload.floatingObject.angleToParent + floatingObject.distanceToParent = closestSibling.payload.floatingObject.distanceToParent + break + } + } + } + if (floatingObject.angleToParent === undefined) { + for (let j = i - 1; j >= 0; j--) { + let siblingProperty = definition.properties[j] + let parentNode = payload.parentNode + let parentNodeProperty = parentNode[siblingProperty.name] + if (siblingProperty.type === 'array') { + if (parentNodeProperty.length > 0) { + let closestSibling = parentNodeProperty[parentNodeProperty.length - 1] + if (closestSibling !== undefined) { + floatingObject.angleToParent = closestSibling.payload.floatingObject.angleToParent + floatingObject.distanceToParent = closestSibling.payload.floatingObject.distanceToParent + break + } + } + } else { + let closestSibling = parentNodeProperty + if (closestSibling !== undefined) { + floatingObject.angleToParent = closestSibling.payload.floatingObject.angleToParent + floatingObject.distanceToParent = closestSibling.payload.floatingObject.distanceToParent + break + } + } + } + } + } + } + if (floatingObject.angleToParent === undefined) { + floatingObject.angleToParent = payload.parentNode.payload.floatingObject.angleToParent + floatingObject.distanceToParent = payload.parentNode.payload.floatingObject.distanceToParent + } } let uiObject = newUiObject() From 2eafd93c4df9ec7d5c2586e3fb537f81885bdd9d Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 2 Apr 2020 13:29:36 +0200 Subject: [PATCH 47/56] Update UiObjectConstructor.js --- FloatingSpace/UiObjectConstructor.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index 276e3e167..38da1216d 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -110,6 +110,28 @@ function newUiObjectConstructor () { } } } + for (let j = i + 1; j < definition.properties.length; j++) { + let siblingProperty = definition.properties[j] + let parentNode = payload.parentNode + let parentNodeProperty = parentNode[siblingProperty.name] + if (siblingProperty.type === 'array') { + if (parentNodeProperty.length > 0) { + let closestSibling = parentNodeProperty[parentNodeProperty.length - 1] + if (closestSibling !== undefined) { + floatingObject.angleToParent = closestSibling.payload.floatingObject.angleToParent + floatingObject.distanceToParent = closestSibling.payload.floatingObject.distanceToParent + break + } + } + } else { + let closestSibling = parentNodeProperty + if (closestSibling !== undefined) { + floatingObject.angleToParent = closestSibling.payload.floatingObject.angleToParent + floatingObject.distanceToParent = closestSibling.payload.floatingObject.distanceToParent + break + } + } + } } } } From 187ed77fc029025604fd9f44b570fcc3f1d16244 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 2 Apr 2020 15:34:04 +0200 Subject: [PATCH 48/56] Arrangement Style Icon Added --- .../FunctionLibraries/CCXTFunctions.js | 7 ++++++ .../FunctionLibraries/NodeCloning.js | 3 ++- .../FunctionLibraries/ProtocolNode.js | 3 ++- FloatingSpace/FloatingObject.js | 23 ++++++++++++++++++ FloatingSpace/UiObjectConstructor.js | 24 +++++++++++++++++++ Globals.js | 6 +++++ 6 files changed, 64 insertions(+), 2 deletions(-) diff --git a/DesignSpace/Workspace/FunctionLibraries/CCXTFunctions.js b/DesignSpace/Workspace/FunctionLibraries/CCXTFunctions.js index f02a1733a..d09957234 100644 --- a/DesignSpace/Workspace/FunctionLibraries/CCXTFunctions.js +++ b/DesignSpace/Workspace/FunctionLibraries/CCXTFunctions.js @@ -52,6 +52,9 @@ function newCCXTFunctions () { newExchange.exchangeAssets.payload.floatingObject.distanceToParent = DISTANCE_TO_PARENT.PARENT_050X newExchange.exchangeMarkets.payload.floatingObject.distanceToParent = DISTANCE_TO_PARENT.PARENT_100X newExchange.exchangeAccounts.payload.floatingObject.distanceToParent = DISTANCE_TO_PARENT.PARENT_025X + newExchange.exchangeAssets.payload.floatingObject.arrangementStyle = ARRANGEMENT_STYLE.CIRCULAR + newExchange.exchangeMarkets.payload.floatingObject.arrangementStyle = ARRANGEMENT_STYLE.CIRCULAR + newExchange.exchangeAccounts.payload.floatingObject.arrangementStyle = ARRANGEMENT_STYLE.CIRCULAR } } } @@ -114,6 +117,7 @@ function newCCXTFunctions () { newAsseet.code = '{ \n\"codeName\": \"' + name + '\"\n}' newAsseet.payload.floatingObject.angleToParent = ANGLE_TO_PARENT.RANGE_360 newAsseet.payload.floatingObject.distanceToParent = DISTANCE_TO_PARENT.PARENT_200X + newAsseet.payload.floatingObject.arrangementStyle = ARRANGEMENT_STYLE.CIRCULAR } } } @@ -184,10 +188,13 @@ function newCCXTFunctions () { newMarket.code = '{ \n\"codeName\": \"' + name + '\"\n}' newMarket.payload.floatingObject.angleToParent = ANGLE_TO_PARENT.RANGE_180 newMarket.payload.floatingObject.distanceToParent = DISTANCE_TO_PARENT.PARENT_050X + newMarket.payload.floatingObject.arrangementStyle = ARRANGEMENT_STYLE.CIRCULAR newMarket.baseAsset.payload.floatingObject.angleToParent = ANGLE_TO_PARENT.RANGE_45 newMarket.quotedAsset.payload.floatingObject.angleToParent = ANGLE_TO_PARENT.RANGE_45 newMarket.baseAsset.payload.floatingObject.distanceToParent = DISTANCE_TO_PARENT.PARENT_100X newMarket.quotedAsset.payload.floatingObject.distanceToParent = DISTANCE_TO_PARENT.PARENT_150X + newMarket.baseAsset.payload.floatingObject.arrangementStyle = ARRANGEMENT_STYLE.CIRCULAR + newMarket.quotedAsset.payload.floatingObject.arrangementStyle = ARRANGEMENT_STYLE.CIRCULAR newMarket.baseAsset.payload.referenceParent = baseAsset newMarket.quotedAsset.payload.referenceParent = quotedAsset diff --git a/DesignSpace/Workspace/FunctionLibraries/NodeCloning.js b/DesignSpace/Workspace/FunctionLibraries/NodeCloning.js index 72d458dcf..fce49b44f 100644 --- a/DesignSpace/Workspace/FunctionLibraries/NodeCloning.js +++ b/DesignSpace/Workspace/FunctionLibraries/NodeCloning.js @@ -146,7 +146,8 @@ function newNodeCloning () { isFrozen: (node.payload.floatingObject.isFrozen && node.payload.floatingObject.frozenManually), isCollapsed: (node.payload.floatingObject.isCollapsed && node.payload.floatingObject.collapsedManually), angleToParent: (node.payload.floatingObject.angleToParent), - distanceToParent: (node.payload.floatingObject.distanceToParent) + distanceToParent: (node.payload.floatingObject.distanceToParent), + arrangementStyle: (node.payload.floatingObject.arrangementStyle) }, uiObject: { isRunning: node.payload.uiObject.isRunning, diff --git a/DesignSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignSpace/Workspace/FunctionLibraries/ProtocolNode.js index 4eaf8ec8c..3fff812a4 100644 --- a/DesignSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -149,7 +149,8 @@ function newProtocolNode () { isFrozen: (node.payload.floatingObject.isFrozen && node.payload.floatingObject.frozenManually), isCollapsed: (node.payload.floatingObject.isCollapsed && node.payload.floatingObject.collapsedManually), angleToParent: (node.payload.floatingObject.angleToParent), - distanceToParent: (node.payload.floatingObject.distanceToParent) + distanceToParent: (node.payload.floatingObject.distanceToParent), + arrangementStyle: (node.payload.floatingObject.arrangementStyle) }, uiObject: { isRunning: node.payload.uiObject.isRunning, diff --git a/FloatingSpace/FloatingObject.js b/FloatingSpace/FloatingObject.js index 54d7544fc..cb96ec369 100644 --- a/FloatingSpace/FloatingObject.js +++ b/FloatingSpace/FloatingObject.js @@ -24,6 +24,7 @@ function newFloatingObject () { isFrozen: false, angleToParent: undefined, distanceToParent: undefined, + arrangementStyle: ARRANGEMENT_STYLE.CIRCULAR, isCollapsed: false, isParentCollapsed: false, frozenManually: false, @@ -33,6 +34,7 @@ function newFloatingObject () { getCollapseStatus: getCollapseStatus, getAngleToParent: getAngleToParent, getDistanceToParent: getDistanceToParent, + getArrangementStyle: getArrangementStyle, nearbyFloatingObjects: [], setPosition: setPosition, pinToggle: pinToggle, @@ -40,6 +42,7 @@ function newFloatingObject () { collapseToggle: collapseToggle, angleToParentToggle: angleToParentToggle, distanceToParentToggle: distanceToParentToggle, + arrangementStyleToggle: arrangementStyleToggle, physics: physics, invisiblePhysics: invisiblePhysics, initializeMass: initializeMass, @@ -153,6 +156,10 @@ function newFloatingObject () { return thisObject.distanceToParent } + function getArrangementStyle () { + return thisObject.arrangementStyle + } + function freezeToggle () { if (thisObject.isFrozen !== true) { thisObject.isFrozen = true @@ -222,6 +229,22 @@ function newFloatingObject () { return thisObject.distanceToParent } + function arrangementStyleToggle () { + switch (thisObject.arrangementStyle) { + case ARRANGEMENT_STYLE.CIRCULAR: + thisObject.arrangementStyle = ARRANGEMENT_STYLE.VERTICAL + break + case ARRANGEMENT_STYLE.VERTICAL: + thisObject.arrangementStyle = ARRANGEMENT_STYLE.HORIZONTAL + break + case ARRANGEMENT_STYLE.HORIZONTAL: + thisObject.arrangementStyle = ARRANGEMENT_STYLE.CIRCULAR + break + } + + return thisObject.arrangementStyle + } + function invisiblePhysics () { if (thisObject.payload.uiObject !== undefined) { thisObject.payload.uiObject.invisiblePhysics() diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index 38da1216d..450aef2a5 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -63,6 +63,9 @@ function newUiObjectConstructor () { if (payload.node.savedPayload.floatingObject.distanceToParent !== undefined) { floatingObject.distanceToParent = payload.node.savedPayload.floatingObject.distanceToParent } + if (payload.node.savedPayload.floatingObject.arrangementStyle !== undefined) { + floatingObject.arrangementStyle = payload.node.savedPayload.floatingObject.arrangementStyle + } } /* @@ -83,6 +86,7 @@ function newUiObjectConstructor () { if (closestSibling !== undefined) { floatingObject.angleToParent = closestSibling.payload.floatingObject.angleToParent floatingObject.distanceToParent = closestSibling.payload.floatingObject.distanceToParent + floatingObject.arrangementStyle = closestSibling.payload.floatingObject.arrangementStyle break } } @@ -98,6 +102,7 @@ function newUiObjectConstructor () { if (closestSibling !== undefined) { floatingObject.angleToParent = closestSibling.payload.floatingObject.angleToParent floatingObject.distanceToParent = closestSibling.payload.floatingObject.distanceToParent + floatingObject.arrangementStyle = closestSibling.payload.floatingObject.arrangementStyle break } } @@ -106,6 +111,7 @@ function newUiObjectConstructor () { if (closestSibling !== undefined) { floatingObject.angleToParent = closestSibling.payload.floatingObject.angleToParent floatingObject.distanceToParent = closestSibling.payload.floatingObject.distanceToParent + floatingObject.arrangementStyle = closestSibling.payload.floatingObject.arrangementStyle break } } @@ -120,6 +126,7 @@ function newUiObjectConstructor () { if (closestSibling !== undefined) { floatingObject.angleToParent = closestSibling.payload.floatingObject.angleToParent floatingObject.distanceToParent = closestSibling.payload.floatingObject.distanceToParent + floatingObject.arrangementStyle = closestSibling.payload.floatingObject.arrangementStyle break } } @@ -128,6 +135,7 @@ function newUiObjectConstructor () { if (closestSibling !== undefined) { floatingObject.angleToParent = closestSibling.payload.floatingObject.angleToParent floatingObject.distanceToParent = closestSibling.payload.floatingObject.distanceToParent + floatingObject.arrangementStyle = closestSibling.payload.floatingObject.arrangementStyle break } } @@ -138,6 +146,7 @@ function newUiObjectConstructor () { if (floatingObject.angleToParent === undefined) { floatingObject.angleToParent = payload.parentNode.payload.floatingObject.angleToParent floatingObject.distanceToParent = payload.parentNode.payload.floatingObject.distanceToParent + floatingObject.arrangementStyle = closestSibling.payload.floatingObject.arrangementStyle } } @@ -240,6 +249,21 @@ function newUiObjectConstructor () { ring: 1 } ) + menuItemsInitialValues.push( + { + action: 'change Arrangement Style', + actionFunction: floatingObject.arrangementStyleToggle, + actionStatus: floatingObject.getArrangementStyle, + currentStatus: true, + label: undefined, + visible: true, + icons: ['shapes-polygon', 'shapes-polygon-body', 'shapes-polygon-border'], + rawRadius: 12, + targetRadius: 0, + currentRadius: 0, + ring: 1 + } + ) menuItemsInitialValues.push( { action: 'Freeze / Unfreeze', diff --git a/Globals.js b/Globals.js index 4c4fd5ecc..341f9475e 100644 --- a/Globals.js +++ b/Globals.js @@ -72,6 +72,12 @@ const DISTANCE_TO_PARENT = { PARENT_200X: 5 } +const ARRANGEMENT_STYLE = { + CIRCULAR: 0, + VERTICAL: 1, + HORIZONTAL: 2 +} + /* User Interface Panels */ const UI_PANEL = { From 26194bee1e7c71bdb498e9934d11da24bfc753cc Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 2 Apr 2020 17:52:18 +0200 Subject: [PATCH 49/56] arrangementStyle 2 --- .../FunctionLibraries/CCXTFunctions.js | 14 ++-- FloatingSpace/FloatingObject.js | 70 ++++++++++++++++--- FloatingSpace/UiObjectConstructor.js | 4 +- Globals.js | 13 ++-- 4 files changed, 77 insertions(+), 24 deletions(-) diff --git a/DesignSpace/Workspace/FunctionLibraries/CCXTFunctions.js b/DesignSpace/Workspace/FunctionLibraries/CCXTFunctions.js index d09957234..96ce572f7 100644 --- a/DesignSpace/Workspace/FunctionLibraries/CCXTFunctions.js +++ b/DesignSpace/Workspace/FunctionLibraries/CCXTFunctions.js @@ -52,9 +52,9 @@ function newCCXTFunctions () { newExchange.exchangeAssets.payload.floatingObject.distanceToParent = DISTANCE_TO_PARENT.PARENT_050X newExchange.exchangeMarkets.payload.floatingObject.distanceToParent = DISTANCE_TO_PARENT.PARENT_100X newExchange.exchangeAccounts.payload.floatingObject.distanceToParent = DISTANCE_TO_PARENT.PARENT_025X - newExchange.exchangeAssets.payload.floatingObject.arrangementStyle = ARRANGEMENT_STYLE.CIRCULAR - newExchange.exchangeMarkets.payload.floatingObject.arrangementStyle = ARRANGEMENT_STYLE.CIRCULAR - newExchange.exchangeAccounts.payload.floatingObject.arrangementStyle = ARRANGEMENT_STYLE.CIRCULAR + newExchange.exchangeAssets.payload.floatingObject.arrangementStyle = ARRANGEMENT_STYLE.CONCAVE + newExchange.exchangeMarkets.payload.floatingObject.arrangementStyle = ARRANGEMENT_STYLE.CONCAVE + newExchange.exchangeAccounts.payload.floatingObject.arrangementStyle = ARRANGEMENT_STYLE.CONCAVE } } } @@ -117,7 +117,7 @@ function newCCXTFunctions () { newAsseet.code = '{ \n\"codeName\": \"' + name + '\"\n}' newAsseet.payload.floatingObject.angleToParent = ANGLE_TO_PARENT.RANGE_360 newAsseet.payload.floatingObject.distanceToParent = DISTANCE_TO_PARENT.PARENT_200X - newAsseet.payload.floatingObject.arrangementStyle = ARRANGEMENT_STYLE.CIRCULAR + newAsseet.payload.floatingObject.arrangementStyle = ARRANGEMENT_STYLE.CONCAVE } } } @@ -188,13 +188,13 @@ function newCCXTFunctions () { newMarket.code = '{ \n\"codeName\": \"' + name + '\"\n}' newMarket.payload.floatingObject.angleToParent = ANGLE_TO_PARENT.RANGE_180 newMarket.payload.floatingObject.distanceToParent = DISTANCE_TO_PARENT.PARENT_050X - newMarket.payload.floatingObject.arrangementStyle = ARRANGEMENT_STYLE.CIRCULAR + newMarket.payload.floatingObject.arrangementStyle = ARRANGEMENT_STYLE.CONCAVE newMarket.baseAsset.payload.floatingObject.angleToParent = ANGLE_TO_PARENT.RANGE_45 newMarket.quotedAsset.payload.floatingObject.angleToParent = ANGLE_TO_PARENT.RANGE_45 newMarket.baseAsset.payload.floatingObject.distanceToParent = DISTANCE_TO_PARENT.PARENT_100X newMarket.quotedAsset.payload.floatingObject.distanceToParent = DISTANCE_TO_PARENT.PARENT_150X - newMarket.baseAsset.payload.floatingObject.arrangementStyle = ARRANGEMENT_STYLE.CIRCULAR - newMarket.quotedAsset.payload.floatingObject.arrangementStyle = ARRANGEMENT_STYLE.CIRCULAR + newMarket.baseAsset.payload.floatingObject.arrangementStyle = ARRANGEMENT_STYLE.CONCAVE + newMarket.quotedAsset.payload.floatingObject.arrangementStyle = ARRANGEMENT_STYLE.CONCAVE newMarket.baseAsset.payload.referenceParent = baseAsset newMarket.quotedAsset.payload.referenceParent = quotedAsset diff --git a/FloatingSpace/FloatingObject.js b/FloatingSpace/FloatingObject.js index cb96ec369..661e6ae01 100644 --- a/FloatingSpace/FloatingObject.js +++ b/FloatingSpace/FloatingObject.js @@ -24,7 +24,7 @@ function newFloatingObject () { isFrozen: false, angleToParent: undefined, distanceToParent: undefined, - arrangementStyle: ARRANGEMENT_STYLE.CIRCULAR, + arrangementStyle: ARRANGEMENT_STYLE.CONCAVE, isCollapsed: false, isParentCollapsed: false, frozenManually: false, @@ -231,14 +231,23 @@ function newFloatingObject () { function arrangementStyleToggle () { switch (thisObject.arrangementStyle) { - case ARRANGEMENT_STYLE.CIRCULAR: - thisObject.arrangementStyle = ARRANGEMENT_STYLE.VERTICAL + case ARRANGEMENT_STYLE.CONCAVE: + thisObject.arrangementStyle = ARRANGEMENT_STYLE.CONVEX break - case ARRANGEMENT_STYLE.VERTICAL: - thisObject.arrangementStyle = ARRANGEMENT_STYLE.HORIZONTAL + case ARRANGEMENT_STYLE.CONVEX: + thisObject.arrangementStyle = ARRANGEMENT_STYLE.VERTICAL_RIGHT break - case ARRANGEMENT_STYLE.HORIZONTAL: - thisObject.arrangementStyle = ARRANGEMENT_STYLE.CIRCULAR + case ARRANGEMENT_STYLE.VERTICAL_RIGHT: + thisObject.arrangementStyle = ARRANGEMENT_STYLE.VERTICAL_LEFT + break + case ARRANGEMENT_STYLE.VERTICAL_LEFT: + thisObject.arrangementStyle = ARRANGEMENT_STYLE.HORIZONTAL_BOTTOM + break + case ARRANGEMENT_STYLE.HORIZONTAL_BOTTOM: + thisObject.arrangementStyle = ARRANGEMENT_STYLE.HORIZONTAL_TOP + break + case ARRANGEMENT_STYLE.HORIZONTAL_TOP: + thisObject.arrangementStyle = ARRANGEMENT_STYLE.CONCAVE break } @@ -354,10 +363,51 @@ function newFloatingObject () { if (distanceToParent > 3000 || thisObject.isPinned === true) { return } // this is introduced to avoid edges cases when importing workspaces. - newPosition = { - x: parent.payload.position.x + distanceToParent * Math.cos(toRadians(thisObject.payload.angle)), - y: parent.payload.position.y + distanceToParent * Math.sin(toRadians(thisObject.payload.angle)) + switch (thisObject.arrangementStyle) { + case ARRANGEMENT_STYLE.CONCAVE: { + newPosition = { + x: parent.payload.position.x + distanceToParent * Math.cos(toRadians(thisObject.payload.angle)), + y: parent.payload.position.y + distanceToParent * Math.sin(toRadians(thisObject.payload.angle)) + } + break + } + case ARRANGEMENT_STYLE.CONVEX: { + newPosition = { + x: parent.payload.position.x + 2 * distanceToParent * Math.cos(toRadians(lastParentAngle)) + distanceToParent * Math.cos(toRadians(thisObject.payload.angle + 180)), + y: parent.payload.position.y + 2 * distanceToParent * Math.sin(toRadians(lastParentAngle)) + distanceToParent * Math.sin(toRadians(thisObject.payload.angle + 180)) + } + break + } + case ARRANGEMENT_STYLE.HORIZONTAL_BOTTOM: { + newPosition = { + x: parent.payload.position.x + distanceToParent * Math.tan(toRadians(thisObject.payload.angle)), + y: parent.payload.position.y + distanceToParent + } + break + } + case ARRANGEMENT_STYLE.HORIZONTAL_TOP: { + newPosition = { + x: parent.payload.position.x - distanceToParent * Math.tan(toRadians(thisObject.payload.angle)), + y: parent.payload.position.y - distanceToParent + } + break + } + case ARRANGEMENT_STYLE.VERTICAL_RIGHT: { + newPosition = { + x: parent.payload.position.x + distanceToParent, + y: parent.payload.position.y + distanceToParent * Math.tan(toRadians(thisObject.payload.angle)) + } + break + } + case ARRANGEMENT_STYLE.VERTICAL_LEFT: { + newPosition = { + x: parent.payload.position.x - distanceToParent, + y: parent.payload.position.y - distanceToParent * Math.tan(toRadians(thisObject.payload.angle)) + } + break + } } + if (isNaN(newPosition.x) === false) { thisObject.container.frame.position.x = newPosition.x } diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index 450aef2a5..b5ad3a8ec 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -146,7 +146,7 @@ function newUiObjectConstructor () { if (floatingObject.angleToParent === undefined) { floatingObject.angleToParent = payload.parentNode.payload.floatingObject.angleToParent floatingObject.distanceToParent = payload.parentNode.payload.floatingObject.distanceToParent - floatingObject.arrangementStyle = closestSibling.payload.floatingObject.arrangementStyle + floatingObject.arrangementStyle = payload.parentNode.payload.floatingObject.arrangementStyle } } @@ -257,7 +257,7 @@ function newUiObjectConstructor () { currentStatus: true, label: undefined, visible: true, - icons: ['shapes-polygon', 'shapes-polygon-body', 'shapes-polygon-border'], + icons: ['shapes-polygon', 'shapes-polygon-body', 'shapes-polygon-border', 'clone', 'layer-manager', 'process'], rawRadius: 12, targetRadius: 0, currentRadius: 0, diff --git a/Globals.js b/Globals.js index 341f9475e..cc1ec296a 100644 --- a/Globals.js +++ b/Globals.js @@ -37,8 +37,8 @@ const DOUBLE_CLICK_ZOOM_IN_IN_LEVEL = 7 const DEBUG = {} const ZOOM_OUT_THRESHOLD_FOR_NOT_HIDDING_PANELS = 12 -const ZOOM_OUT_THRESHOLD_FOR_HIDDING_PANELS = 7 -const ZOOM_OUT_THRESHOLD_FOR_HIDDING_CHARTS_LABELS = 7 +const ZOOM_OUT_THRESHOLD_FOR_HIDDING_PANELS = 7 +const ZOOM_OUT_THRESHOLD_FOR_HIDDING_CHARTS_LABELS = 7 const ZOOM_OUT_THRESHOLD_FOR_CHANGING_TIME_FRAME = 3 // This help regulate when to change the Time Frame base on the level of zoom out. const ZOOM_OUT_THRESHOLD_FOR_PACKING_OBJECTS_AT_THE_BOTTOM_OR_TOP_OF_VIEWPORT = 2 const ZOOM_OUT_THRESHOLD_FOR_PLOTTING_IN_LOW_RESOLUTION = 3 @@ -73,9 +73,12 @@ const DISTANCE_TO_PARENT = { } const ARRANGEMENT_STYLE = { - CIRCULAR: 0, - VERTICAL: 1, - HORIZONTAL: 2 + CONCAVE: 0, + CONVEX: 1, + VERTICAL_RIGHT: 2, + VERTICAL_LEFT: 3, + HORIZONTAL_BOTTOM: 4, + HORIZONTAL_TOP: 5 } /* User Interface Panels */ From bba470b0758bd242c3d22cfb573e1b7c53995ba3 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 3 Apr 2020 09:27:34 +0200 Subject: [PATCH 50/56] Update FloatingObject.js --- FloatingSpace/FloatingObject.js | 72 ++++++++++++++++++++++++--------- 1 file changed, 53 insertions(+), 19 deletions(-) diff --git a/FloatingSpace/FloatingObject.js b/FloatingSpace/FloatingObject.js index 661e6ae01..0b20a6a08 100644 --- a/FloatingSpace/FloatingObject.js +++ b/FloatingSpace/FloatingObject.js @@ -285,6 +285,8 @@ function newFloatingObject () { } function positionContraintsPhysics () { + const MAX_DISTANCE_TO_PARENT = 3000 + if (thisObject.angleToParent !== ANGLE_TO_PARENT.NOT_FIXED && thisObject.isOnFocus !== true) { let parent = thisObject.payload.chainParent if (parent === undefined) { return } @@ -318,6 +320,10 @@ function newFloatingObject () { } } + if (distanceToParent > MAX_DISTANCE_TO_PARENT) { + distanceToParent = MAX_DISTANCE_TO_PARENT + } + switch (thisObject.angleToParent) { case ANGLE_TO_PARENT.RANGE_360: angleToParentAngle = 360 @@ -361,53 +367,81 @@ function newFloatingObject () { thisObject.payload.distance = distanceToParent - if (distanceToParent > 3000 || thisObject.isPinned === true) { return } // this is introduced to avoid edges cases when importing workspaces. + if (thisObject.isPinned === true) { + /* When an object is pinned, its angle to its parent needs to be calculated since it depends on where the user places the node. */ + if (thisObject.payload.chainParent !== undefined) { + let x = thisObject.container.frame.position.x - thisObject.payload.chainParent.payload.floatingObject.container.frame.position.x + let y = thisObject.container.frame.position.y - thisObject.payload.chainParent.payload.floatingObject.container.frame.position.y + + thisObject.payload.angle = Math.atan(y / x) + } + + return + } + + let newPosition = { + x: parent.payload.position.x, + y: parent.payload.position.y + } + + let displacement switch (thisObject.arrangementStyle) { case ARRANGEMENT_STYLE.CONCAVE: { - newPosition = { - x: parent.payload.position.x + distanceToParent * Math.cos(toRadians(thisObject.payload.angle)), - y: parent.payload.position.y + distanceToParent * Math.sin(toRadians(thisObject.payload.angle)) + displacement = { + x: distanceToParent * Math.cos(toRadians(thisObject.payload.angle)), + y: distanceToParent * Math.sin(toRadians(thisObject.payload.angle)) } + break } case ARRANGEMENT_STYLE.CONVEX: { - newPosition = { - x: parent.payload.position.x + 2 * distanceToParent * Math.cos(toRadians(lastParentAngle)) + distanceToParent * Math.cos(toRadians(thisObject.payload.angle + 180)), - y: parent.payload.position.y + 2 * distanceToParent * Math.sin(toRadians(lastParentAngle)) + distanceToParent * Math.sin(toRadians(thisObject.payload.angle + 180)) + displacement = { + x: 2 * distanceToParent * Math.cos(toRadians(lastParentAngle)) + distanceToParent * Math.cos(toRadians(thisObject.payload.angle + 180)), + y: 2 * distanceToParent * Math.sin(toRadians(lastParentAngle)) + distanceToParent * Math.sin(toRadians(thisObject.payload.angle + 180)) } break } case ARRANGEMENT_STYLE.HORIZONTAL_BOTTOM: { - newPosition = { - x: parent.payload.position.x + distanceToParent * Math.tan(toRadians(thisObject.payload.angle)), - y: parent.payload.position.y + distanceToParent + displacement = { + x: distanceToParent * Math.tan(toRadians(thisObject.payload.angle)), + y: distanceToParent } break } case ARRANGEMENT_STYLE.HORIZONTAL_TOP: { - newPosition = { - x: parent.payload.position.x - distanceToParent * Math.tan(toRadians(thisObject.payload.angle)), - y: parent.payload.position.y - distanceToParent + displacement = { + x: -distanceToParent * Math.tan(toRadians(thisObject.payload.angle)), + y: -distanceToParent } break } case ARRANGEMENT_STYLE.VERTICAL_RIGHT: { - newPosition = { - x: parent.payload.position.x + distanceToParent, - y: parent.payload.position.y + distanceToParent * Math.tan(toRadians(thisObject.payload.angle)) + displacement = { + x: distanceToParent, + y: distanceToParent * Math.tan(toRadians(thisObject.payload.angle)) } break } case ARRANGEMENT_STYLE.VERTICAL_LEFT: { - newPosition = { - x: parent.payload.position.x - distanceToParent, - y: parent.payload.position.y - distanceToParent * Math.tan(toRadians(thisObject.payload.angle)) + displacement = { + x: -distanceToParent, + y: -distanceToParent * Math.tan(toRadians(thisObject.payload.angle)) } break } } + if (displacement.x > MAX_DISTANCE_TO_PARENT) { + displacement.x = MAX_DISTANCE_TO_PARENT + } + if (displacement.y > MAX_DISTANCE_TO_PARENT) { + displacement.y = MAX_DISTANCE_TO_PARENT + } + + newPosition.x = newPosition.x + displacement.x + newPosition.y = newPosition.y + displacement.y + if (isNaN(newPosition.x) === false) { thisObject.container.frame.position.x = newPosition.x } From 970b9745f299c2838a02368e8718ed446ee0af3f Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 3 Apr 2020 11:46:06 +0200 Subject: [PATCH 51/56] Update FloatingObject.js --- FloatingSpace/FloatingObject.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/FloatingSpace/FloatingObject.js b/FloatingSpace/FloatingObject.js index 0b20a6a08..c9c08020b 100644 --- a/FloatingSpace/FloatingObject.js +++ b/FloatingSpace/FloatingObject.js @@ -369,13 +369,14 @@ function newFloatingObject () { if (thisObject.isPinned === true) { /* When an object is pinned, its angle to its parent needs to be calculated since it depends on where the user places the node. */ + /* if (thisObject.payload.chainParent !== undefined) { let x = thisObject.container.frame.position.x - thisObject.payload.chainParent.payload.floatingObject.container.frame.position.x let y = thisObject.container.frame.position.y - thisObject.payload.chainParent.payload.floatingObject.container.frame.position.y thisObject.payload.angle = Math.atan(y / x) } - + */ return } From 971e2ea515650f4136319a60a14d2f87c935ce35 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 3 Apr 2020 11:58:00 +0200 Subject: [PATCH 52/56] name changes --- DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index b2dfc641c..fb5ccdcfe 100644 --- a/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -25,7 +25,7 @@ function newUiObjectsFromNodes () { blobService = newFileStorage() if (node.code === undefined) { - node.code = '{ \n"includeDataMines": ["Masters", "Sparta", "TradingEngines"],\n"includeTradingSystems": ["WHB-BTC-USDT", "WHB-ETH-USDT", "BRR-BTC-USDT"],\n"includeSuperScripts": ["Superalgos"]\n }' + node.code = '{ \n"includeDataMines": ["Masters", "Sparta", "TradingEngines"],\n"includeTradingSystems": ["Sparta-WHB-BTC-USDT", "Masters-WHB-ETH-USDT", "Sparta-BRR-BTC-USDT"],\n"includeSuperScripts": ["Masters"]\n }' } let code = JSON.parse(node.code) From 918ffd531ae0d295d0cb915f062da5fe7984ba4c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 3 Apr 2020 12:39:20 +0200 Subject: [PATCH 53/56] new icons --- FloatingSpace/UiObjectConstructor.js | 2 +- Spaces/DesignSpace.js | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index b5ad3a8ec..0d5d00afd 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -257,7 +257,7 @@ function newUiObjectConstructor () { currentStatus: true, label: undefined, visible: true, - icons: ['shapes-polygon', 'shapes-polygon-body', 'shapes-polygon-border', 'clone', 'layer-manager', 'process'], + icons: ['arrangement-concave', 'arrangement-convex', 'arrangement-vertical-right', 'arrangement-vertical-left', 'arrangement-horizontal-bottom', 'arrangement-horizontal-top'], rawRadius: 12, targetRadius: 0, currentRadius: 0, diff --git a/Spaces/DesignSpace.js b/Spaces/DesignSpace.js index 55b345426..cbf9fedb2 100644 --- a/Spaces/DesignSpace.js +++ b/Spaces/DesignSpace.js @@ -278,7 +278,13 @@ function newDesignSpace () { 'help', 'key-a', 'key-m', - 'key-r' + 'key-r', + 'arrangement-horizontal-top', + 'arrangement-convex', + 'arrangement-horizontal-bottom', + 'arrangement-vertical-right', + 'arrangement-vertical-left', + 'arrangement-concave' ] for (let i = 0; i < iconsNames.length; i++) { From a37da2a044b2379c38176075467ae0519c25f28a Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 3 Apr 2020 12:44:38 +0200 Subject: [PATCH 54/56] Update UiObjectsFromNodes.js --- .../Workspace/FunctionLibraries/UiObjectsFromNodes.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index fb5ccdcfe..751a3d846 100644 --- a/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -24,9 +24,9 @@ function newUiObjectsFromNodes () { function addIncludedNodes () { blobService = newFileStorage() - if (node.code === undefined) { - node.code = '{ \n"includeDataMines": ["Masters", "Sparta", "TradingEngines"],\n"includeTradingSystems": ["Sparta-WHB-BTC-USDT", "Masters-WHB-ETH-USDT", "Sparta-BRR-BTC-USDT"],\n"includeSuperScripts": ["Masters"]\n }' - } + // if (node.code === undefined) { + node.code = '{ \n"includeDataMines": ["Masters", "Sparta", "TradingEngines"],\n"includeTradingSystems": ["Sparta-WHB-BTC-USDT", "Masters-WHB-ETH-USDT", "Sparta-BRR-BTC-USDT"],\n"includeSuperScripts": ["Masters"]\n }' + // } let code = JSON.parse(node.code) let includeDataMines = code.includeDataMines From abb523d84a1fd5c6ebc66f0ce62cae0f001207a8 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 3 Apr 2020 12:50:26 +0200 Subject: [PATCH 55/56] Update UiObjectConstructor.js --- FloatingSpace/UiObjectConstructor.js | 109 ++++++++++++++------------- 1 file changed, 58 insertions(+), 51 deletions(-) diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index 0d5d00afd..03f80b2ac 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -75,39 +75,15 @@ function newUiObjectConstructor () { if (userAddingNew === true) { let definition = APP_SCHEMA_MAP.get(payload.parentNode.type) - for (let i = 0; i < definition.properties.length; i++) { - let property = definition.properties[i] - if (property.childType === payload.node.type) { - if (property.type === 'array') { - let parentNode = payload.parentNode - let parentNodeArray = parentNode[property.name] - if (parentNodeArray.length > 1) { // the new node was already added - let closestSibling = parentNodeArray[parentNodeArray.length - 2] - if (closestSibling !== undefined) { - floatingObject.angleToParent = closestSibling.payload.floatingObject.angleToParent - floatingObject.distanceToParent = closestSibling.payload.floatingObject.distanceToParent - floatingObject.arrangementStyle = closestSibling.payload.floatingObject.arrangementStyle - break - } - } - } - if (floatingObject.angleToParent === undefined) { - for (let j = i - 1; j >= 0; j--) { - let siblingProperty = definition.properties[j] + if (definition.properties !== undefined) { + for (let i = 0; i < definition.properties.length; i++) { + let property = definition.properties[i] + if (property.childType === payload.node.type) { + if (property.type === 'array') { let parentNode = payload.parentNode - let parentNodeProperty = parentNode[siblingProperty.name] - if (siblingProperty.type === 'array') { - if (parentNodeProperty.length > 0) { - let closestSibling = parentNodeProperty[parentNodeProperty.length - 1] - if (closestSibling !== undefined) { - floatingObject.angleToParent = closestSibling.payload.floatingObject.angleToParent - floatingObject.distanceToParent = closestSibling.payload.floatingObject.distanceToParent - floatingObject.arrangementStyle = closestSibling.payload.floatingObject.arrangementStyle - break - } - } - } else { - let closestSibling = parentNodeProperty + let parentNodeArray = parentNode[property.name] + if (parentNodeArray.length > 1) { // the new node was already added + let closestSibling = parentNodeArray[parentNodeArray.length - 2] if (closestSibling !== undefined) { floatingObject.angleToParent = closestSibling.payload.floatingObject.angleToParent floatingObject.distanceToParent = closestSibling.payload.floatingObject.distanceToParent @@ -116,33 +92,64 @@ function newUiObjectConstructor () { } } } - for (let j = i + 1; j < definition.properties.length; j++) { - let siblingProperty = definition.properties[j] - let parentNode = payload.parentNode - let parentNodeProperty = parentNode[siblingProperty.name] - if (siblingProperty.type === 'array') { - if (parentNodeProperty.length > 0) { - let closestSibling = parentNodeProperty[parentNodeProperty.length - 1] - if (closestSibling !== undefined) { - floatingObject.angleToParent = closestSibling.payload.floatingObject.angleToParent - floatingObject.distanceToParent = closestSibling.payload.floatingObject.distanceToParent - floatingObject.arrangementStyle = closestSibling.payload.floatingObject.arrangementStyle - break + if (floatingObject.angleToParent === undefined) { + for (let j = i - 1; j >= 0; j--) { + let siblingProperty = definition.properties[j] + let parentNode = payload.parentNode + let parentNodeProperty = parentNode[siblingProperty.name] + if (parentNodeProperty !== undefined) { + if (siblingProperty.type === 'array') { + if (parentNodeProperty.length > 0) { + let closestSibling = parentNodeProperty[parentNodeProperty.length - 1] + if (closestSibling !== undefined) { + floatingObject.angleToParent = closestSibling.payload.floatingObject.angleToParent + floatingObject.distanceToParent = closestSibling.payload.floatingObject.distanceToParent + floatingObject.arrangementStyle = closestSibling.payload.floatingObject.arrangementStyle + break + } + } + } else { + let closestSibling = parentNodeProperty + if (closestSibling !== undefined) { + floatingObject.angleToParent = closestSibling.payload.floatingObject.angleToParent + floatingObject.distanceToParent = closestSibling.payload.floatingObject.distanceToParent + floatingObject.arrangementStyle = closestSibling.payload.floatingObject.arrangementStyle + break + } } } - } else { - let closestSibling = parentNodeProperty - if (closestSibling !== undefined) { - floatingObject.angleToParent = closestSibling.payload.floatingObject.angleToParent - floatingObject.distanceToParent = closestSibling.payload.floatingObject.distanceToParent - floatingObject.arrangementStyle = closestSibling.payload.floatingObject.arrangementStyle - break + } + for (let j = i + 1; j < definition.properties.length; j++) { + let siblingProperty = definition.properties[j] + let parentNode = payload.parentNode + let parentNodeProperty = parentNode[siblingProperty.name] + if (parentNodeProperty !== undefined) { + if (siblingProperty.type === 'array') { + if (parentNodeProperty.length > 0) { + let closestSibling = parentNodeProperty[parentNodeProperty.length - 1] + if (closestSibling !== undefined) { + floatingObject.angleToParent = closestSibling.payload.floatingObject.angleToParent + floatingObject.distanceToParent = closestSibling.payload.floatingObject.distanceToParent + floatingObject.arrangementStyle = closestSibling.payload.floatingObject.arrangementStyle + break + } + } + } else { + let closestSibling = parentNodeProperty + if (closestSibling !== undefined) { + floatingObject.angleToParent = closestSibling.payload.floatingObject.angleToParent + floatingObject.distanceToParent = closestSibling.payload.floatingObject.distanceToParent + floatingObject.arrangementStyle = closestSibling.payload.floatingObject.arrangementStyle + break + } + } } } } } } } + if (floatingObject.angleToParent === undefined) { floatingObject.angleToParent = payload.parentNode.payload.floatingObject.angleToParent floatingObject.distanceToParent = payload.parentNode.payload.floatingObject.distanceToParent From a6be25ea1786af965ef69aff249edda055ace1bc Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 3 Apr 2020 16:06:07 +0200 Subject: [PATCH 56/56] Update ConfigEditor.js --- FloatingSpace/ConfigEditor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FloatingSpace/ConfigEditor.js b/FloatingSpace/ConfigEditor.js index 3136045c5..5ddb74eac 100644 --- a/FloatingSpace/ConfigEditor.js +++ b/FloatingSpace/ConfigEditor.js @@ -34,7 +34,7 @@ function newConfigEditor () { thisObject.container.frame.position.y = 0 let isMouseOver = false - let SIZE_FACTOR = 0.8 + let SIZE_FACTOR = 1 return thisObject