diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/point.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/point.js index f599973..1967641 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/point.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/point.js @@ -84,9 +84,11 @@ class Point extends Common.DrawableObject { ctx.font = `${canvas.textsize}px sans-serif` var textSize = ctx.measureText(text).width switch(this.labelPosition) { + case 'top': case 'above': canvas.drawVisibleText(ctx, text, canvasX-textSize/2, canvasY-16) break; + case 'bottom': case 'below': canvas.drawVisibleText(ctx, text, canvasX-textSize/2, canvasY+16) break; @@ -96,15 +98,19 @@ class Point extends Common.DrawableObject { case 'right': canvas.drawVisibleText(ctx, text, canvasX+10, canvasY+4) break; + case 'top-left': case 'above-left': canvas.drawVisibleText(ctx, text, canvasX-textSize-10, canvasY-16) break; + case 'top-right': case 'above-right': canvas.drawVisibleText(ctx, text, canvasX+10, canvasY-16) break; + case 'bottom-left': case 'below-left': canvas.drawVisibleText(ctx, text, canvasX-textSize-10, canvasY+16) break; + case 'bottom-right': case 'below-right': canvas.drawVisibleText(ctx, text, canvasX+10, canvasY+16) break; diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/text.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/text.js index 2f61e3d..b58f26d 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/text.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/objs/text.js @@ -69,9 +69,11 @@ class Text extends Common.DrawableObject { case 'center': 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; @@ -81,15 +83,19 @@ class Text extends Common.DrawableObject { case 'right': 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;