|
5263 | 5263 | } |
5264 | 5264 | } |
5265 | 5265 |
|
5266 | | - JSROOT.THistPainter.prototype.ToggleStat = function() { |
| 5266 | + JSROOT.THistPainter.prototype.ToggleStat = function(arg) { |
5267 | 5267 |
|
5268 | 5268 | var stat = this.FindStat(); |
5269 | | - |
5270 | 5269 | if (stat == null) { |
5271 | | - |
| 5270 | + if (arg=='only-check') return false; |
5272 | 5271 | // when statbox created first time, one need to draw it |
5273 | | - stat = this.CreateStat(); |
5274 | | - |
| 5272 | + this.CreateStat(); |
5275 | 5273 | this.Redraw(); |
5276 | | - |
5277 | | - return; |
| 5274 | + return true; |
5278 | 5275 | } |
5279 | 5276 |
|
5280 | 5277 | var statpainter = this.FindPainterFor(stat); |
5281 | | - if (statpainter == null) { |
5282 | | - alert("Did not found painter for existing stat??"); |
5283 | | - return; |
5284 | | - } |
| 5278 | + if (statpainter == null) return false; |
| 5279 | + |
| 5280 | + if (arg=='only-check') return statpainter.Enabled; |
5285 | 5281 |
|
5286 | 5282 | statpainter.Enabled = !statpainter.Enabled; |
5287 | 5283 |
|
5288 | 5284 | // when stat box is drawed, it always can be draw individualy while it |
5289 | 5285 | // should be last for colz RedrawPad is used |
5290 | 5286 | statpainter.Redraw(); |
| 5287 | + |
| 5288 | + return statpainter.Enabled; |
5291 | 5289 | } |
5292 | 5290 |
|
5293 | 5291 | JSROOT.THistPainter.prototype.IsAxisZoomed = function(axis) { |
|
5907 | 5905 | } |
5908 | 5906 |
|
5909 | 5907 | JSROOT.THistPainter.prototype.FillContextMenu = function(menu) { |
5910 | | - |
5911 | 5908 | if (this.zoom_xmin!=this.zoom_xmax) |
5912 | 5909 | menu.add("Unzoom X", function() { this.Unzoom(true, false, false); }); |
5913 | 5910 | if (this.zoom_ymin!=this.zoom_ymax) |
|
5916 | 5913 | menu.add("Unzoom Z", function() { this.Unzoom(false, false, true); }); |
5917 | 5914 | menu.add("Unzoom", function() { this.Unzoom(true, true, true); }); |
5918 | 5915 |
|
5919 | | - menu.add(JSROOT.gStyle.Tooltip ? "Disable tooltip" : "Enable tooltip", function() { |
| 5916 | + menu.add((JSROOT.gStyle.Tooltip ? "chk:" : "unk:") + "Show tooltips", function() { |
5920 | 5917 | JSROOT.gStyle.Tooltip = !JSROOT.gStyle.Tooltip; |
5921 | 5918 | this.RedrawPad(); |
5922 | 5919 | }); |
5923 | 5920 |
|
5924 | 5921 | if (this.options) { |
5925 | | - |
5926 | 5922 | var item = (this.options.Logx ? "chk:" : "unk:") + "SetLogx"; |
5927 | 5923 |
|
5928 | 5924 | menu.add(item, function() { this.ToggleLog("x"); }); |
|
5936 | 5932 | } |
5937 | 5933 | } |
5938 | 5934 | if (this.draw_content) |
5939 | | - menu.add("Toggle stat", function() { this.ToggleStat(); }); |
| 5935 | + menu.add((this.ToggleStat('only-check') ? "chk:" : "unk:") + "Show statbox", this.ToggleStat.bind(this)); |
5940 | 5936 | } |
5941 | 5937 |
|
5942 | 5938 | // ======= TH1 painter================================================ |
|
6467 | 6463 | JSROOT.TH1Painter.prototype.FillContextMenu = function(menu) { |
6468 | 6464 | JSROOT.THistPainter.prototype.FillContextMenu.call(this, menu); |
6469 | 6465 | if (this.draw_content) |
6470 | | - menu.add("Auto zoom-in", function() { this.AutoZoom(); }); |
| 6466 | + menu.add("Auto zoom-in", this.AutoZoom.bind(this)); |
6471 | 6467 | } |
6472 | 6468 |
|
6473 | 6469 | JSROOT.TH1Painter.prototype.AutoZoom = function() { |
|
6549 | 6545 |
|
6550 | 6546 | JSROOT.TH2Painter.prototype.FillContextMenu = function(menu) { |
6551 | 6547 | JSROOT.THistPainter.prototype.FillContextMenu.call(this, menu); |
6552 | | - menu.add("Auto zoom-in", this.AutoZoom().bind(this)); |
6553 | | - menu.add("Draw in 3D", this.Draw3D().bind(this)); |
| 6548 | + menu.add("Auto zoom-in", this.AutoZoom.bind(this)); |
| 6549 | + menu.add("Draw in 3D", this.Draw3D.bind(this)); |
6554 | 6550 | menu.add("Toggle col", function() { |
6555 | 6551 | if (this.options.Color == 0) |
6556 | 6552 | this.options.Color = JSROOT.gStyle.DefaultCol; |
6557 | 6553 | else |
6558 | | - this.options.Color = -1 * this.options.Color; |
| 6554 | + this.options.Color = - this.options.Color; |
6559 | 6555 | this.RedrawPad(); |
6560 | 6556 | }); |
6561 | 6557 |
|
6562 | 6558 | if (this.options.Color > 0) |
6563 | | - menu.add("Toggle colz", this.ToggleColz().bind(this)); |
| 6559 | + menu.add("Toggle colz", this.ToggleColz.bind(this)); |
6564 | 6560 | } |
6565 | 6561 |
|
6566 | 6562 | JSROOT.TH2Painter.prototype.FindPalette = function(remove) { |
|
0 commit comments