Skip to content

Commit 947ce06

Browse files
committed
Fix - toggling of statbox was not working in all situations
1 parent 022225b commit 947ce06

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

changes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# JSROOT changelog
22

3+
## Changes in 4.4.x
4+
1. Fix - toggling of statbox was not working in all situations
5+
6+
37
## Changes in 4.4.3
48
1. Fix - wrong selection of TH1 Y axis range when errors are displayed (#44)
59
2. Fix - apply user range for TH1 X-axis zooming (#44)

scripts/JSRootPainter.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4827,31 +4827,31 @@
48274827

48284828
JSROOT.THistPainter.prototype.ToggleStat = function(arg) {
48294829

4830-
var stat = this.FindStat();
4830+
var stat = this.FindStat(), statpainter = null;
48314831

48324832
if (stat == null) {
48334833
if (arg=='only-check') return false;
48344834
// when statbox created first time, one need to draw it
48354835
stat = this.CreateStat();
4836-
4837-
this.svg_canvas().property('current_pad', this.pad_name);
4838-
JSROOT.draw(this.divid, stat);
4839-
this.svg_canvas().property('current_pad', '');
4840-
4841-
return true;
4836+
} else {
4837+
statpainter = this.FindPainterFor(stat);
48424838
}
48434839

4844-
var statpainter = this.FindPainterFor(stat);
4845-
if (statpainter == null) return false;
4840+
if (arg=='only-check') return statpainter ? statpainter.Enabled : false;
48464841

4847-
if (arg=='only-check') return statpainter.Enabled;
4842+
if (statpainter) {
4843+
statpainter.Enabled = !statpainter.Enabled;
4844+
// when stat box is drawed, it always can be draw individualy while it
4845+
// should be last for colz RedrawPad is used
4846+
statpainter.Redraw();
4847+
return statpainter.Enabled;
4848+
}
48484849

4849-
statpainter.Enabled = !statpainter.Enabled;
4850-
// when stat box is drawed, it always can be draw individualy while it
4851-
// should be last for colz RedrawPad is used
4852-
statpainter.Redraw();
4850+
this.svg_canvas().property('current_pad', this.pad_name);
4851+
JSROOT.draw(this.divid, stat);
4852+
this.svg_canvas().property('current_pad', '');
48534853

4854-
return statpainter.Enabled;
4854+
return true;
48554855
}
48564856

48574857
JSROOT.THistPainter.prototype.IsAxisZoomed = function(axis) {

0 commit comments

Comments
 (0)