Skip to content

Commit 7ac6969

Browse files
committed
Correctly provide user tooltips in lego draw
1 parent ef7107f commit 7ac6969

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

scripts/JSRootCore.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595

9696
"use strict";
9797

98-
JSROOT.version = "dev 6/10/2020";
98+
JSROOT.version = "dev 9/10/2020";
9999

100100
JSROOT.source_dir = "";
101101
JSROOT.source_min = false;

scripts/JSRootPainter.hist3d.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,10 @@
334334
JSROOT.TFramePainter.prototype.BinHighlight3D = function(tip, selfmesh) {
335335

336336
var changed = false, tooltip_mesh = null, changed_self = true,
337-
want_remove = !tip || (tip.x1===undefined) || !this.enable_highlight;
337+
want_remove = !tip || (tip.x1===undefined) || !this.enable_highlight,
338+
mainp = this.main_painter();
339+
340+
if (mainp && !mainp.IsUserTooltipCallback()) mainp = null;
338341

339342
if (this.tooltip_selfmesh) {
340343
changed_self = (this.tooltip_selfmesh !== selfmesh)
@@ -352,7 +355,7 @@
352355

353356
if (want_remove) {
354357
if (changed) this.Render3D();
355-
this.ProvideUserTooltip(null);
358+
if (mainp && changed) mainp.ProvideUserTooltip(null);
356359
return;
357360
}
358361

@@ -412,8 +415,8 @@
412415
if (changed && tip.$painter && (typeof tip.$painter.RedrawProjection == 'function'))
413416
tip.$painter.RedrawProjection(tip.ix-1, tip.ix, tip.iy-1, tip.iy);
414417

415-
if (this.GetObject())
416-
this.ProvideUserTooltip({ obj: this.GetObject(), name: this.GetObject().fName,
418+
if (changed && mainp && mainp.GetObject())
419+
mainp.ProvideUserTooltip({ obj: mainp.GetObject(), name: mainp.GetObject().fName,
417420
bin: tip.bin, cont: tip.value,
418421
binx: tip.ix, biny: tip.iy, binz: tip.iz,
419422
grx: (tip.x1+tip.x2)/2, gry: (tip.y1+tip.y2)/2, grz: (tip.z1+tip.z2)/2 });

scripts/JSRootPainter.v7hist3d.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,10 @@
314314
JSROOT.v7.RFramePainter.prototype.BinHighlight3D = function(tip, selfmesh) {
315315

316316
var changed = false, tooltip_mesh = null, changed_self = true,
317-
want_remove = !tip || (tip.x1===undefined) || !this.enable_highlight;
317+
want_remove = !tip || (tip.x1===undefined) || !this.enable_highlight,
318+
mainp = this.main_painter();
319+
320+
if (mainp && !mainp.IsUserTooltipCallback()) mainp = null;
318321

319322
if (this.tooltip_selfmesh) {
320323
changed_self = (this.tooltip_selfmesh !== selfmesh)
@@ -332,7 +335,7 @@
332335

333336
if (want_remove) {
334337
if (changed) this.Render3D();
335-
this.ProvideUserTooltip(null);
338+
if (changed && mainp) mainp.ProvideUserTooltip(null);
336339
return;
337340
}
338341

@@ -392,11 +395,11 @@
392395
if (changed && tip.$painter && (typeof tip.$painter.RedrawProjection == 'function'))
393396
tip.$painter.RedrawProjection(tip.ix-1, tip.ix, tip.iy-1, tip.iy);
394397

395-
if (this.GetObject())
396-
this.ProvideUserTooltip({ obj: this.GetObject(), name: this.GetObject().fName,
397-
bin: tip.bin, cont: tip.value,
398-
binx: tip.ix, biny: tip.iy, binz: tip.iz,
399-
grx: (tip.x1+tip.x2)/2, gry: (tip.y1+tip.y2)/2, grz: (tip.z1+tip.z2)/2 });
398+
if (changed && mainp && mainp.GetObject())
399+
mainp.ProvideUserTooltip({ obj: mainp.GetObject(), name: mainp.GetObject().fName,
400+
bin: tip.bin, cont: tip.value,
401+
binx: tip.ix, biny: tip.iy, binz: tip.iz,
402+
grx: (tip.x1+tip.x2)/2, gry: (tip.y1+tip.y2)/2, grz: (tip.z1+tip.z2)/2 });
400403
}
401404

402405
JSROOT.v7.RFramePainter.prototype.TestAxisVisibility = function(camera, toplevel, fb, bb) {

0 commit comments

Comments
 (0)