Keeping backwards compatibility with files made in older logarithmplotter versions (but keeping them from being created again).
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Adsooi 2022-01-27 22:09:58 +01:00
parent 3afa9d0c8e
commit c86eed95ca
Signed by: Ad5001
GPG key ID: EF45F9C6AFE20160
2 changed files with 12 additions and 0 deletions

View file

@ -84,9 +84,11 @@ class Point extends Common.DrawableObject {
ctx.font = `${canvas.textsize}px sans-serif` ctx.font = `${canvas.textsize}px sans-serif`
var textSize = ctx.measureText(text).width var textSize = ctx.measureText(text).width
switch(this.labelPosition) { switch(this.labelPosition) {
case 'top':
case 'above': case 'above':
canvas.drawVisibleText(ctx, text, canvasX-textSize/2, canvasY-16) canvas.drawVisibleText(ctx, text, canvasX-textSize/2, canvasY-16)
break; break;
case 'bottom':
case 'below': case 'below':
canvas.drawVisibleText(ctx, text, canvasX-textSize/2, canvasY+16) canvas.drawVisibleText(ctx, text, canvasX-textSize/2, canvasY+16)
break; break;
@ -96,15 +98,19 @@ class Point extends Common.DrawableObject {
case 'right': case 'right':
canvas.drawVisibleText(ctx, text, canvasX+10, canvasY+4) canvas.drawVisibleText(ctx, text, canvasX+10, canvasY+4)
break; break;
case 'top-left':
case 'above-left': case 'above-left':
canvas.drawVisibleText(ctx, text, canvasX-textSize-10, canvasY-16) canvas.drawVisibleText(ctx, text, canvasX-textSize-10, canvasY-16)
break; break;
case 'top-right':
case 'above-right': case 'above-right':
canvas.drawVisibleText(ctx, text, canvasX+10, canvasY-16) canvas.drawVisibleText(ctx, text, canvasX+10, canvasY-16)
break; break;
case 'bottom-left':
case 'below-left': case 'below-left':
canvas.drawVisibleText(ctx, text, canvasX-textSize-10, canvasY+16) canvas.drawVisibleText(ctx, text, canvasX-textSize-10, canvasY+16)
break; break;
case 'bottom-right':
case 'below-right': case 'below-right':
canvas.drawVisibleText(ctx, text, canvasX+10, canvasY+16) canvas.drawVisibleText(ctx, text, canvasX+10, canvasY+16)
break; break;

View file

@ -69,9 +69,11 @@ class Text extends Common.DrawableObject {
case 'center': case 'center':
canvas.drawVisibleText(ctx, this.text, canvasX-textSize/2, canvasY+4) canvas.drawVisibleText(ctx, this.text, canvasX-textSize/2, canvasY+4)
break; break;
case 'top':
case 'above': case 'above':
canvas.drawVisibleText(ctx, this.text, canvasX-textSize/2, canvasY-16) canvas.drawVisibleText(ctx, this.text, canvasX-textSize/2, canvasY-16)
break; break;
case 'bottom':
case 'below': case 'below':
canvas.drawVisibleText(ctx, this.text, canvasX-textSize/2, canvasY+16) canvas.drawVisibleText(ctx, this.text, canvasX-textSize/2, canvasY+16)
break; break;
@ -81,15 +83,19 @@ class Text extends Common.DrawableObject {
case 'right': case 'right':
canvas.drawVisibleText(ctx, this.text, canvasX+5, canvasY+4) canvas.drawVisibleText(ctx, this.text, canvasX+5, canvasY+4)
break; break;
case 'top-left':
case 'above-left': case 'above-left':
canvas.drawVisibleText(ctx, this.text, canvasX-textSize-5, canvasY-16) canvas.drawVisibleText(ctx, this.text, canvasX-textSize-5, canvasY-16)
break; break;
case 'top-right':
case 'above-right': case 'above-right':
canvas.drawVisibleText(ctx, this.text, canvasX+5, canvasY-16) canvas.drawVisibleText(ctx, this.text, canvasX+5, canvasY-16)
break; break;
case 'bottom-left':
case 'below-left': case 'below-left':
canvas.drawVisibleText(ctx, this.text, canvasX-textSize-5, canvasY+16) canvas.drawVisibleText(ctx, this.text, canvasX-textSize-5, canvasY+16)
break; break;
case 'bottom-right':
case 'below-right': case 'below-right':
canvas.drawVisibleText(ctx, this.text, canvasX+5, canvasY+16) canvas.drawVisibleText(ctx, this.text, canvasX+5, canvasY+16)
break; break;