From 8f158999a27efb77e69e15ce855c9dd9eed7a5f1 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 24 Sep 2020 13:12:10 +0200 Subject: [PATCH] Text Style to panels --- AppSchema.json | 16 +++++++++++++++- CanvasApp/Panels/Layer.js | 2 +- CanvasApp/Panels/PlotterPanel.js | 12 +++++++++++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/AppSchema.json b/AppSchema.json index f7feffd6d..924d1e769 100644 --- a/AppSchema.json +++ b/AppSchema.json @@ -499,6 +499,12 @@ "type": "node", "childType": "Data Formula", "autoAdd": true + }, + { + "name": "textStyle", + "type": "node", + "childType": "Text Style", + "autoAdd": true } ], "menuItems": [ @@ -517,6 +523,14 @@ "label": "Add Data Formula", "relatedUiObject": "Data Formula" }, + { + "action": "Add UI Object", + "disableIfPropertyIsDefined": true, + "propertyToCheckFor": "textStyle", + "actionFunction": "payload.onMenuItemClick", + "label": "Add Text Style", + "relatedUiObject": "Text Style" + }, { "action": "Delete UI Object", "askConfirmation": true, @@ -918,7 +932,7 @@ "level": 4, "propertyNameAtParent": "textStyle", "chainAttachesTo": { - "compatibleTypes": "->Text->" + "compatibleTypes": "->Text->Panel Data->" }, "editors": { "config": true diff --git a/CanvasApp/Panels/Layer.js b/CanvasApp/Panels/Layer.js index db36f4226..ccc6163f2 100644 --- a/CanvasApp/Panels/Layer.js +++ b/CanvasApp/Panels/Layer.js @@ -187,7 +187,7 @@ function newLayer() { 'Polygon Vertex->Point->' + 'Image->Image Condition->Image Position->Point->' + 'Text->Text Condition->Text Position->Point->Text Formula->Text Style->' + - 'Plotter Panel->Javascript Code->Panel Data->Data Formula->' + + 'Plotter Panel->Javascript Code->Panel Data->Data Formula->Text Style->' + 'Nodes Highlights->Nodes Values->Nodes Errors->Nodes Warnings->Nodes Infos->Nodes Status->Nodes Progress->Nodes Running->Nodes Announcements->Record Values->' thisObject.definition = functionLibraryProtocolNode.getProtocolNode(thisObject.payload.node, false, true, true, false, false, lightingPath) diff --git a/CanvasApp/Panels/PlotterPanel.js b/CanvasApp/Panels/PlotterPanel.js index 2b02913b5..65e873eac 100644 --- a/CanvasApp/Panels/PlotterPanel.js +++ b/CanvasApp/Panels/PlotterPanel.js @@ -167,8 +167,18 @@ function newPlotterPanel() { valuePosition = panelData.config.valuePosition } + let opacity = '1.00' + let fontSize = 14 + let paletteColor + + if (panelData.textStyle !== undefined) { + if (panelData.textStyle.config.fontSize !== undefined) { fontSize = panelData.textStyle.config.fontSize } + if (panelData.textStyle.config.opacity !== undefined) { opacity = panelData.textStyle.config.opacity } + if (panelData.textStyle.config.paletteColor !== undefined) { paletteColor = eval(panelData.textStyle.config.paletteColor) } + } + 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, false, true) + printLabel(value, X_AXIS, UI_PANEL.HEIGHT.NORMAL * valuePosition / 100 / heightFactor, opacity, fontSize, paletteColor, true, thisObject.container, thisObject.fitFunction, false, true) } } }