Skip to content

Commit c542b9d

Browse files
committed
Fix - limit th2 text output size
1 parent 6327bd8 commit c542b9d

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

changes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
1. Fix - position of TFrame in canvas/pad
55
2. Fix - use histogram fMinimum/fMaximum when creating color palette
66
3. Fix - correctly draw empty th2 bins when zmin<0 is specified
7+
4. Fix - limit th2 text output size
78

89

910
## Changes in 4.5.1

scripts/JSRootPainter.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2253,7 +2253,7 @@
22532253
// options
22542254
}
22552255

2256-
JSROOT.TObjectPainter.prototype.StartTextDrawing = function(font_face, font_size, draw_g) {
2256+
JSROOT.TObjectPainter.prototype.StartTextDrawing = function(font_face, font_size, draw_g, max_font_size) {
22572257
// we need to preserve font to be able rescle at the end
22582258

22592259
if (!draw_g) draw_g = this.draw_g;
@@ -2266,6 +2266,7 @@
22662266
draw_g.property('mathjax_use', false);
22672267
draw_g.property('text_factor', 0.);
22682268
draw_g.property('max_text_width', 0); // keep maximal text width, use it later
2269+
draw_g.property('max_font_size', max_font_size);
22692270
}
22702271

22712272
JSROOT.TObjectPainter.prototype.TextScaleFactor = function(value, draw_g) {
@@ -2326,6 +2327,8 @@
23262327
if ((f>0) && ((f<0.9) || (f>1.))) {
23272328
var font = draw_g.property('text_font');
23282329
font.size = Math.floor(font.size/f);
2330+
if (draw_g.property('max_font_size') && (font.size>draw_g.property('max_font_size')))
2331+
font.size = draw_g.property('max_font_size');
23292332
draw_g.call(font.func);
23302333
}
23312334

scripts/JSRootPainter.more.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3475,7 +3475,7 @@
34753475
.append("svg:g")
34763476
.attr("class","th2_text");
34773477

3478-
this.StartTextDrawing(42, 20, text_g);
3478+
this.StartTextDrawing(42, 20, text_g, 20);
34793479

34803480
for (i = handle.i1; i < handle.i2; ++i)
34813481
for (j = handle.j1; j < handle.j2; ++j) {

0 commit comments

Comments
 (0)