Panel Improvements
This commit is contained in:
1 parent
51f9ca5e48
commit
b78ef674d7
5 files changed
+43
-16
No files matched your search
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user