From 4a6777f6379a919a0cbe447d960094ee0199df21 Mon Sep 17 00:00:00 2001 From: Ad5001 Date: Fri, 28 Jan 2022 11:50:57 +0100 Subject: [PATCH] Adding new enum for Text positioning to allow center. --- .../qml/eu/ad5001/LogarithmPlotter/js/objs/text.js | 8 +------- .../qml/eu/ad5001/LogarithmPlotter/js/parameters.js | 12 ++++++++++++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/text.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/text.js index b58f26d..edb9bde 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/text.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/text.js @@ -36,7 +36,7 @@ class Text extends Common.DrawableObject { static properties() {return { [QT_TRANSLATE_NOOP('prop','x')]: 'Expression', [QT_TRANSLATE_NOOP('prop','y')]: 'Expression', - [QT_TRANSLATE_NOOP('prop','labelPosition')]: P.Enum.Position, + [QT_TRANSLATE_NOOP('prop','labelPosition')]: P.Enum.Positioning, [QT_TRANSLATE_NOOP('prop','text')]: 'string' }} @@ -70,11 +70,9 @@ class Text extends Common.DrawableObject { canvas.drawVisibleText(ctx, this.text, canvasX-textSize/2, canvasY+4) break; case 'top': - case 'above': canvas.drawVisibleText(ctx, this.text, canvasX-textSize/2, canvasY-16) break; case 'bottom': - case 'below': canvas.drawVisibleText(ctx, this.text, canvasX-textSize/2, canvasY+16) break; case 'left': @@ -84,19 +82,15 @@ class Text extends Common.DrawableObject { canvas.drawVisibleText(ctx, this.text, canvasX+5, canvasY+4) break; case 'top-left': - case 'above-left': canvas.drawVisibleText(ctx, this.text, canvasX-textSize-5, canvasY-16) break; case 'top-right': - case 'above-right': canvas.drawVisibleText(ctx, this.text, canvasX+5, canvasY-16) break; case 'bottom-left': - case 'below-left': canvas.drawVisibleText(ctx, this.text, canvasX-textSize-5, canvasY+16) break; case 'bottom-right': - case 'below-right': canvas.drawVisibleText(ctx, this.text, canvasX+5, canvasY+16) break; diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parameters.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parameters.js index 3c3dc8f..dfcae53 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parameters.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parameters.js @@ -69,6 +69,18 @@ Enum.Position = new Enum( QT_TR_NOOP('below-right') ) +Enum.Positioning = new Enum( + QT_TR_NOOP('center'), + QT_TR_NOOP('top'), + QT_TR_NOOP('bottom'), + QT_TR_NOOP('left'), + QT_TR_NOOP('right'), + QT_TR_NOOP('top-left'), + QT_TR_NOOP('top-right'), + QT_TR_NOOP('bottom-left'), + QT_TR_NOOP('bottom-right') +) + Enum.FunctionDisplayType = new Enum( QT_TR_NOOP('application'), QT_TR_NOOP('function')