Skip to content

Commit 77a2c34

Browse files
committed
Fix - do not allow move browser too far left/top
1 parent d6cb1fc commit 77a2c34

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

modules/gui/display.mjs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1655,18 +1655,16 @@ class BrowserLayout {
16551655
let sl = area.style('left'), st = area.style('top');
16561656
this._float_left = parseInt(sl.slice(0,sl.length-2));
16571657
this._float_top = parseInt(st.slice(0,st.length-2));
1658-
this._max_left = main.node().clientWidth - area.node().offsetWidth - 1;
1659-
this._max_top = main.node().clientHeight - area.node().offsetHeight - 1;
1658+
this._max_left = Math.max(0, main.node().clientWidth - area.node().offsetWidth - 1);
1659+
this._max_top = Math.max(0, main.node().clientHeight - area.node().offsetHeight - 1);
16601660

16611661
}).filter(evnt => {
16621662
return main.select('.jsroot_browser_title').node() === evnt.target;
16631663
}).on('drag', evnt => {
16641664
this._float_left += evnt.dx;
16651665
this._float_top += evnt.dy;
1666-
16671666
area.style('left', Math.min(Math.max(0, this._float_left), this._max_left) + 'px')
16681667
.style('top', Math.min(Math.max(0, this._float_top), this._max_top) + 'px');
1669-
16701668
this.setButtonsPosition();
16711669
});
16721670

0 commit comments

Comments
 (0)