Skip to content

Commit 1827d01

Browse files
committed
Fix - use FontSize when draw TLegend entries
Before font size was automatically adjusted to content height, now it can be fixed (if not disturb drawing)
1 parent 2d2025c commit 1827d01

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

scripts/JSRootPainter.hist.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1929,7 +1929,10 @@
19291929
padding_x = Math.round(0.03*w/ncols),
19301930
padding_y = Math.round(0.03*h),
19311931
step_y = (h - 2*padding_y)/nrows,
1932-
any_opt = false, i = -1;
1932+
ph = this.pad_height(),
1933+
fsize, any_opt = false, i = -1;
1934+
1935+
if (legend.fTextSize && (ph*legend.fTextSize > 2) && (ph*legend.fTextSize < step_y)) fsize = Math.round(ph*legend.fTextSize);
19331936

19341937
this.StartTextDrawing(legend.fTextFont, 0.9*step_y);
19351938

@@ -2012,8 +2015,8 @@
20122015
if (lopt.length>0) any_opt = true;
20132016
else if (!any_opt) pos_x = x0 + padding_x;
20142017

2015-
if (leg.fLabel && (leg.fLabel != " "))
2016-
this.DrawText({ align: "start", x: pos_x, y: pos_y, width: x0+column_width-pos_x-padding_x, height: step_y, text: leg.fLabel, color: tcolor });
2018+
if (leg.fLabel)
2019+
this.DrawText({ align: "start", x: pos_x, y: pos_y, width: x0+column_width-pos_x-padding_x, height: step_y, text: leg.fLabel, color: tcolor, font_size: fsize });
20172020
}
20182021

20192022
// rescale after all entries are shown

0 commit comments

Comments
 (0)