Skip to content

Commit 154c8bd

Browse files
committed
Fix - vertical text position in TPaveText
When custom text attributes are used, text align should be taken into account when set position
1 parent d817efc commit 154c8bd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

modules/hist/TPavePainter.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,11 +505,13 @@ class TPavePainter extends ObjectPainter {
505505
// individual positioning
506506
const align = entry.fTextAlign || this.textatt.align,
507507
halign = Math.floor(align/10),
508+
valign = align % 10,
509+
tsize = this.textatt.getAltSize(entry.fTextSize, pad_height),
508510
x = entry.fX ? entry.fX*width : (halign === 1 ? margin_x : (halign === 2 ? width / 2 : width - margin_x)),
509-
y = entry.fY ? (1 - entry.fY)*height : texty,
511+
y = entry.fY ? (1 - entry.fY)*height : (texty + (valign === 2 ? tsize / 2 : (valign === 3 ? tsize : 0))),
510512
sub_g = text_g.append('svg:g');
511513

512-
this.startTextDrawing(this.textatt.font, this.textatt.getAltSize(entry.fTextSize, pad_height), sub_g);
514+
this.startTextDrawing(this.textatt.font, tsize, sub_g);
513515

514516
this.drawText({ align, x, y, text: entry.fTitle, color,
515517
latex: (entry._typename === clTText) ? 0 : 1, draw_g: sub_g, fast });

0 commit comments

Comments
 (0)