Skip to content

Commit 0eb39a2

Browse files
committed
Change docking element for 3D tooltip after canvas enlarge
1 parent 5e353ee commit 0eb39a2

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

scripts/JSRoot3DPainter.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@
5353
this.canvas = canvas; // we need canvas to recalculate mouse events
5454
this.abspos = !prnt;
5555

56+
this.check_parent = function(prnt) {
57+
if (prnt && (this.parent !== prnt)) {
58+
this.hide();
59+
this.parent = prnt;
60+
}
61+
}
62+
5663
this.pos = function(e) {
5764
// method used to define position of next tooltip
5865
// event is delivered from canvas,
@@ -149,7 +156,7 @@
149156
}
150157
};
151158

152-
this.hide = function() {
159+
this.hide = function() {
153160
if (this.tt !== null)
154161
this.parent.removeChild(this.tt);
155162

@@ -368,7 +375,10 @@
368375

369376
this.cursor_changed = false;
370377
if (tip) {
371-
var ignore_status = (this.painter && this.painter.enlarge_main && this.painter.enlarge_main('state')==='on');
378+
var ignore_status = ((typeof this.painter.enlarge_main=='function') && (this.painter.enlarge_main('state')==='on'));
379+
380+
this.tooltip.check_parent(this.painter.select_main().node());
381+
372382
this.tooltip.show(tip, mouse, ignore_status);
373383
this.tooltip.pos(evnt)
374384
} else {

0 commit comments

Comments
 (0)