Skip to content

Commit 8f4dd28

Browse files
committed
Fix problem with stat-box toggling
1 parent 9cd32d0 commit 8f4dd28

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

scripts/JSRootPainter.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3055,6 +3055,7 @@
30553055

30563056
JSROOT.TPavePainter.prototype.Redraw = function() {
30573057
// if pavetext artificially disabled, do not redraw it
3058+
30583059
if (this.Enabled) {
30593060
this.FillStatistic();
30603061
this.DrawPaveText();
@@ -3064,6 +3065,7 @@
30643065
}
30653066

30663067
JSROOT.Painter.drawPaveText = function(divid, pavetext) {
3068+
30673069
var painter = new JSROOT.TPavePainter(pavetext);
30683070
painter.SetDivId(divid);
30693071

@@ -3123,7 +3125,6 @@
31233125
factor = svg.property('height_factor');
31243126

31253127
if (factor!=null) {
3126-
console.log('change ratio!!!');
31273128
// if canvas was resize when created, resize height also now
31283129
h = Math.round(w * factor);
31293130
render_to.style('height', h+'px');
@@ -4667,6 +4668,7 @@
46674668
JSROOT.THistPainter.prototype.ToggleStat = function(arg) {
46684669

46694670
var stat = this.FindStat();
4671+
46704672
if (stat == null) {
46714673
if (arg=='only-check') return false;
46724674
// when statbox created first time, one need to draw it
@@ -4681,7 +4683,6 @@
46814683
if (arg=='only-check') return statpainter.Enabled;
46824684

46834685
statpainter.Enabled = !statpainter.Enabled;
4684-
46854686
// when stat box is drawed, it always can be draw individualy while it
46864687
// should be last for colz RedrawPad is used
46874688
statpainter.Redraw();
@@ -4741,12 +4742,10 @@
47414742

47424743
if ('fFunctions' in this.histo)
47434744
for (var i=0; i < this.histo.fFunctions.arr.length; ++i) {
4744-
47454745
var func = this.histo.fFunctions.arr[i];
47464746

4747-
if (func['_typename'] == 'TPaveText' || func['_typename'] == 'TPaveStats') {
4748-
return func;
4749-
}
4747+
if ((func._typename == 'TPaveStats') &&
4748+
(func.fName == 'stats')) return func;
47504749
}
47514750

47524751
return null;
@@ -5325,7 +5324,7 @@
53255324
this.RedrawPad();
53265325
});
53275326

5328-
menu.addchk(this.ToggleStat('only-check'), "Show statbox", this.ToggleStat.bind(this));
5327+
menu.addchk(this.ToggleStat('only-check'), "Show statbox", function() { this.ToggleStat(); });
53295328
}
53305329
}
53315330

@@ -6567,12 +6566,9 @@
65676566
if ((arg.rest == d.rest) || (arg.rest.length <= d.rest.length))
65686567
return JSROOT.CallBack(call_back);
65696568

6570-
// console.log('Find potential parent ' + parentname + " rest = " + d.rest);
6571-
65726569
return this.expand(parentname, function(res) {
65736570
if (!res) JSROOT.CallBack(call_back);
65746571
var newparentname = hpainter.itemFullName(d.last);
6575-
// console.log('New parent name ' + newparentname + " sub = " + d.rest);
65766572
hpainter.get( { arg : newparentname + "/" + d.rest, rest : d.rest }, call_back, options);
65776573
});
65786574
}

0 commit comments

Comments
 (0)