diff --git a/Projects/Superalgos/Function-Libraries/NodeDeleter.js b/Projects/Superalgos/Function-Libraries/NodeDeleter.js index e1ea53cc4..ef4d0762e 100644 --- a/Projects/Superalgos/Function-Libraries/NodeDeleter.js +++ b/Projects/Superalgos/Function-Libraries/NodeDeleter.js @@ -24,6 +24,7 @@ function newNodeDeleter() { } function deleteUIObject(node, rootNodes) { + console.log('Deleting Node: ' + node.type + ' ' + node.name) /* First we restore the reference parent to its default state */ if (node.payload !== undefined && node.payload.referenceParent !== undefined && node.payload.referenceParent.payload !== undefined && node.payload.referenceParent.payload.uiObject !== undefined) { node.payload.referenceParent.payload.uiObject.isShowing = false diff --git a/Projects/Superalgos/Spaces/Cockpit-Space/CockpitSpace.js b/Projects/Superalgos/Spaces/Cockpit-Space/CockpitSpace.js index 715ae1a91..6b6673706 100644 --- a/Projects/Superalgos/Spaces/Cockpit-Space/CockpitSpace.js +++ b/Projects/Superalgos/Spaces/Cockpit-Space/CockpitSpace.js @@ -266,7 +266,7 @@ function newSuperalgosCockpitSpace() { x: thisObject.container.frame.width / 2, y: thisObject.container.frame.height / 2 + 5 } - UI.projects.superalgos.utilities.drawPrint.printLabel(statusText, position.x, position.y, 1, 15, textColor, true, thisObject.container) + UI.projects.superalgos.utilities.drawPrint.printLabel(statusText, position.x, position.y, 1, 15, textColor, 'Center', thisObject.container) } if (UI.projects.superalgos.spaces.designSpace !== undefined) { diff --git a/Projects/Superalgos/Spaces/Design-Space/Workspace.js b/Projects/Superalgos/Spaces/Design-Space/Workspace.js index e40b8c9cc..60dba2c21 100644 --- a/Projects/Superalgos/Spaces/Design-Space/Workspace.js +++ b/Projects/Superalgos/Spaces/Design-Space/Workspace.js @@ -237,26 +237,32 @@ function newWorkspace() { switch (workingAtTask) { case 1: + console.log('Replacing Workspace Procedure Started') + console.log('Deleting Workspace') UI.projects.superalgos.spaces.tutorialSpace.stop() executeAction({ node: thisObject.workspaceNode, name: 'Delete Workspace', project: 'Superalgos' }) workingAtTask++ break case 2: + console.log('Closing Events Server') finalizeEventsServerClients() thisObject.eventsServerClients = new Map() workingAtTask++ break case 3: + console.log('Stopping Automatic Saving') clearInterval(savingWorkspaceIntervalId) workingAtTask++ break case 4: + console.log('Loading new Workspace') thisObject.workspaceNode = loadedWorkspaceNode thisObject.workspaceNode.project = 'Superalgos' loadedWorkspaceNode = undefined workingAtTask++ break case 5: + console.log('Setting up Workspace') executeAction({ node: thisObject.workspaceNode, name: 'Recreate Workspace', project: 'Superalgos', callBackFunction: finishInitialization }) function finishInitialization() { setupEventsServerClients() @@ -265,10 +271,12 @@ function newWorkspace() { workingAtTask++ break case 6: + console.log('Resetting Spaces') UI.projects.superalgos.spaces.chartingSpace.reset() workingAtTask++ break case 7: + console.log('Replacing Workspace Procedure Finished') workingAtTask = 0 circularProgressBar.visible = false break diff --git a/Projects/Superalgos/Spaces/Panel-Space/PlotterPanel.js b/Projects/Superalgos/Spaces/Panel-Space/PlotterPanel.js index 87b5829d6..b8c15c0b4 100644 --- a/Projects/Superalgos/Spaces/Panel-Space/PlotterPanel.js +++ b/Projects/Superalgos/Spaces/Panel-Space/PlotterPanel.js @@ -93,7 +93,8 @@ function newPlotterPanel() { const frameBodyHeight = thisObject.container.frame.getBodyHeight() const frameTitleHeight = thisObject.container.frame.height - frameBodyHeight - const X_AXIS = thisObject.container.frame.width / 2 + const X_AXIS_A = thisObject.container.frame.width * 7 / 8 + const X_AXIS_B = thisObject.container.frame.width * 7 / 8 const Y_AXIS = frameTitleHeight + frameBodyHeight / 2 const PANEL_HEIGHT = UI_PANEL.HEIGHT.NORMAL @@ -168,7 +169,7 @@ function newPlotterPanel() { let opacity = '1.00' let fontSize = 14 - let paletteColor + let paletteColor if (panelData.textStyle !== undefined) { if (panelData.textStyle.config.fontSize !== undefined) { fontSize = panelData.textStyle.config.fontSize } @@ -176,8 +177,8 @@ function newPlotterPanel() { if (panelData.textStyle.config.paletteColor !== undefined) { paletteColor = eval(panelData.textStyle.config.paletteColor) } } - UI.projects.superalgos.utilities.drawPrint.printLabel(labelText, X_AXIS, UI_PANEL.HEIGHT.NORMAL * labelPosition / 100 / heightFactor, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction) - UI.projects.superalgos.utilities.drawPrint.printLabel(value, X_AXIS, UI_PANEL.HEIGHT.NORMAL * valuePosition / 100 / heightFactor, opacity, fontSize, paletteColor, true, thisObject.container, thisObject.fitFunction, false, true) + UI.projects.superalgos.utilities.drawPrint.printLabel(labelText, X_AXIS_A, UI_PANEL.HEIGHT.NORMAL * labelPosition / 100 / heightFactor, '0.60', undefined, undefined, 'Right', thisObject.container, thisObject.fitFunction) + UI.projects.superalgos.utilities.drawPrint.printLabel(value, X_AXIS_B, UI_PANEL.HEIGHT.NORMAL * valuePosition / 100 / heightFactor, opacity, fontSize, paletteColor, 'Right', thisObject.container, thisObject.fitFunction, false, true) } } } diff --git a/Projects/Superalgos/Utilities/DrawPrint.js b/Projects/Superalgos/Utilities/DrawPrint.js index 7f85025b4..78a08427b 100644 --- a/Projects/Superalgos/Utilities/DrawPrint.js +++ b/Projects/Superalgos/Utilities/DrawPrint.js @@ -186,13 +186,14 @@ function newSuperalgosUtilitiesDrawPrint() { browserCanvasContext.fill() } - function printLabel(labelToPrint, x, y, opacity, fontSize, color, center, container, fitFunction, noDecimals, fixedDecimals, minDecimals) { + function printLabel(labelToPrint, x, y, opacity, fontSize, color, align, container, fitFunction, noDecimals, fixedDecimals, minDecimals) { if (labelToPrint === undefined) { return } let labelPoint if (color === undefined) { color = UI_COLOR.DARK } if (fontSize === undefined) { fontSize = 10 }; browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY + let label = labelToPrint if (isNaN(label) === false && label !== '') { if (fixedDecimals !== true) { @@ -204,17 +205,33 @@ function newSuperalgosUtilitiesDrawPrint() { } } - let xOffset = label.length / 2 * fontSize * FONT_ASPECT_RATIO - - if (center === true) { - labelPoint = { - x: x - xOffset, - y: y + switch (align) { + case 'Center': { + labelPoint = { + x: x - getTextWidth(label) / 2, + y: y + } + break } - } else { - labelPoint = { - x: x, - y: y + case 'Left': { + labelPoint = { + x: x, + y: y + } + break + } + case 'Right': { + labelPoint = { + x: x - getTextWidth(label), + y: y + } + break + } + default: { + labelPoint = { + x: x, + y: y + } } }