Skip to content

Commit bd84067

Browse files
committed
Fix - correctly access top element in simple layout
Simple layout means direct usage of <div> element for drawing. If drawing itself uses other layouts (like grid), this can lead to unintended redirection for select_main() method. Therefore for simple layout select_main('origin') has to be used.
1 parent 5555d15 commit bd84067

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

scripts/JSRootPainter.hierarchy.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2779,19 +2779,17 @@
27792779
this.CreateSeparator(handle, main, handle.groups[cnt]);
27802780
}
27812781

2782-
GridDisplay.prototype.ForEachFrame = function(userfunc, only_visible) {
2783-
var main = this.select_main();
2784-
2782+
GridDisplay.prototype.ForEachFrame = function(userfunc, only_visible) {
27852783
if (this.simple_layout)
2786-
userfunc(main.node());
2784+
userfunc(this.GetFrame());
27872785
else
2788-
main.selectAll('.jsroot_newgrid').each(function() {
2786+
this.select_main().selectAll('.jsroot_newgrid').each(function() {
27892787
userfunc(d3.select(this).node());
27902788
});
27912789
}
27922790

27932791
GridDisplay.prototype.GetActiveFrame = function() {
2794-
if (this.simple_layout) return this.select_main().node();
2792+
if (this.simple_layout) return this.GetFrame();
27952793

27962794
var found = MDIDisplay.prototype.GetActiveFrame.call(this);
27972795
if (found) return found;
@@ -2808,10 +2806,10 @@
28082806
}
28092807

28102808
GridDisplay.prototype.GetFrame = function(id) {
2811-
var main = this.select_main();
2812-
if (this.simple_layout) return main.node();
2809+
if (this.simple_layout)
2810+
return this.select_main('origin').node();
28132811
var res = null;
2814-
main.selectAll('.jsroot_newgrid').each(function() {
2812+
this.select_main().selectAll('.jsroot_newgrid').each(function() {
28152813
if (id-- === 0) res = this;
28162814
});
28172815
return res;

0 commit comments

Comments
 (0)