Skip to content

Commit d740f13

Browse files
committed
Provide user tooltips also for 3D graphic
1 parent 3510769 commit d740f13

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

scripts/JSRoot3DPainter.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,10 @@
8585
// all absolute coordinates calculated relative to such node
8686
var abs_parent = this.parent;
8787
while (abs_parent) {
88+
// console.log(abs_parent.nodeType, abs_parent.id);
8889
var style = getComputedStyle(abs_parent);
8990
if (!style || (style.position !== 'static')) break;
91+
if (!abs_parent.parentNode || (abs_parent.parentNode.nodeType != 1)) break;
9092
abs_parent = abs_parent.parentNode;
9193
}
9294

@@ -416,7 +418,7 @@
416418
}
417419

418420
if (tip !== null) {
419-
var delta = 1e-8*painter.size3d;
421+
var delta = 1e-5*painter.size3d;
420422
if ((tip.x1 > tip.x2) || (tip.y1 > tip.y2) || (tip.z1 > tip.z2)) console.warn('check 3D hints coordinates');
421423
tip.x1 -= delta; tip.x2 += delta;
422424
tip.y1 -= delta; tip.y2 += delta;
@@ -954,6 +956,7 @@
954956
delete this.tooltip_mesh;
955957
this.Render3D();
956958
}
959+
this.ProvideUserTooltip(null);
957960
return;
958961
}
959962

@@ -998,6 +1001,13 @@
9981001
}
9991002

10001003
this.Render3D();
1004+
1005+
if (this.IsUserTooltipCallback() && this.GetObject()) {
1006+
this.ProvideUserTooltip({ obj: this.GetObject(), name: this.GetObject().fName,
1007+
bin: tip.bin, cont: tip.value,
1008+
binx: tip.ix, biny: tip.iy, binz: tip.iz,
1009+
grx: (tip.x1+tip.x2)/2, gry: (tip.y1+tip.y2)/2, grz: (tip.z1+tip.z2)/2 });
1010+
}
10011011
}
10021012

10031013
JSROOT.Painter.HistPainter_DrawLego = function() {

0 commit comments

Comments
 (0)