Skip to content

Commit 0e3e2cb

Browse files
committed
Fix - clearly assign active tooltis with the pad name
Before when drawing many subpads and actiavte tooltip on one, all following pads were activating tooltips. Nicely reproduced with big canvas example.
1 parent 8e51096 commit 0e3e2cb

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

scripts/JSRootPainter.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4671,7 +4671,8 @@
46714671
TooltipHandler.prototype.IsTooltipShown = function() {
46724672
// return true if tooltip is shown, use to prevent some other action
46734673
if (!this.tooltip_allowed || !this.tooltip_enabled) return false;
4674-
return ! (this.hints_layer().select(".objects_hints").empty());
4674+
var hintsg = this.hints_layer().select(".objects_hints");
4675+
return hintsg.empty() ? false : hintsg.property("hints_pad") == this.pad_name;
46754676
}
46764677

46774678
TooltipHandler.prototype.ProcessTooltipEvent = function(pnt, enabled) {
@@ -4793,7 +4794,8 @@
47934794

47944795
// copy transform attributes from frame itself
47954796
hintsg.attr("transform", trans)
4796-
.property("last_point", pnt);
4797+
.property("last_point", pnt)
4798+
.property("hints_pad", this.pad_name);
47974799

47984800
var viewmode = hintsg.property('viewmode') || "",
47994801
actualw = 0, posx = pnt.x + frame_rect.hint_delta_x;

scripts/JSRootPainter.v6.js

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

16511651
var hintsg = this.hints_layer().select(".objects_hints");
16521652
// if tooltips were visible before, try to reconstruct them after short timeout
1653-
if (!hintsg.empty() && this.tooltip_allowed)
1653+
if (!hintsg.empty() && this.tooltip_allowed && (hintsg.property("hints_pad") == this.pad_name))
16541654
setTimeout(this.ProcessTooltipEvent.bind(this, hintsg.property('last_point')), 10);
16551655
}
16561656

scripts/JSRootPainter.v7.js

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

13511351
var hintsg = this.hints_layer().select(".objects_hints");
13521352
// if tooltips were visible before, try to reconstruct them after short timeout
1353-
if (!hintsg.empty() && this.tooltip_allowed)
1353+
if (!hintsg.empty() && this.tooltip_allowed && (hintsg.property("hints_pad") == this.pad_name))
13541354
setTimeout(this.ProcessTooltipEvent.bind(this, hintsg.property('last_point')), 10);
13551355
}
13561356

0 commit comments

Comments
 (0)