Skip to content

Commit dfeb378

Browse files
committed
Move pave stats and drag box to the front always
git-svn-id: https://subversion.gsi.de/dabc/trunk/plugins/root/js@2697 bcbf6573-9a26-0410-9ebc-ce4ab7aade96
1 parent fa09598 commit dfeb378

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

scripts/JSRootPainter.js

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,15 @@
444444
x = pad['fUxmin'];
445445
}
446446
return x;
447-
};
447+
}
448+
449+
JSROOT.Painter.moveChildToEnd = function(child) {
450+
if (!child) return;
451+
var prnt = child.node().parentNode;
452+
prnt.removeChild(child.node());
453+
prnt.appendChild(child.node());
454+
}
455+
448456

449457
JSROOT.Painter.ytoPad = function(y, pad) {
450458
if (pad['fLogy']) {
@@ -1114,6 +1122,9 @@
11141122

11151123
pthis[drag_rect_name].attr("x", x);
11161124
pthis[drag_rect_name].attr("y", y);
1125+
1126+
JSROOT.Painter.moveChildToEnd(pthis[drag_rect_name]);
1127+
11171128
d3.event.sourceEvent.stopPropagation();
11181129
}).on("dragend", function() {
11191130
d3.event.sourceEvent.preventDefault();
@@ -1176,6 +1187,9 @@
11761187
if (h+dy > pad_h) acc_y += dy; else h+=dy;
11771188
pthis[drag_rect_name].attr("width", w);
11781189
pthis[drag_rect_name].attr("height", h);
1190+
1191+
JSROOT.Painter.moveChildToEnd(pthis[drag_rect_name]);
1192+
11791193
d3.event.sourceEvent.stopPropagation();
11801194
}).on( "dragend", function() {
11811195
d3.event.sourceEvent.preventDefault();
@@ -2339,8 +2353,15 @@
23392353
var fontDetails = JSROOT.Painter.getFontDetails(pavetext['fTextFont']);
23402354
var lwidth = pavetext['fBorderSize'] ? pavetext['fBorderSize'] : 0;
23412355

2342-
if (this.main_rect == null)
2356+
var pthis = this;
2357+
2358+
if (this.main_rect == null) {
23432359
this.main_rect = this.svg_pad(true).append("rect");
2360+
} else {
2361+
// force main rect of the stat box be last item in the primitives to
2362+
// kept it on the top - for instance when colz is created
2363+
JSROOT.Painter.moveChildToEnd(this.main_rect);
2364+
}
23442365

23452366
this.main_rect
23462367
.attr("x", pos_x)
@@ -2351,8 +2372,6 @@
23512372
.style("stroke-width", lwidth ? 1 : 0)
23522373
.style("stroke", lcolor);
23532374

2354-
var pthis = this;
2355-
23562375
this.AddDrag("stat", this.main_rect, {
23572376
move : function(x, y, dx, dy) {
23582377
pthis.draw_g.attr("transform", "translate(" + x + "," + y + ")");

0 commit comments

Comments
 (0)