Skip to content

Commit 0b4f7c9

Browse files
committed
Restrict resizing to visible screen
This makes sure that the debugbar isn't dragged to high, so the handler is unreachable, and not too low to make sure it's always clear that it's just resized, not broken/collapsed.
1 parent 4a660ce commit 0b4f7c9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/DebugBar/Resources/debugbar.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,13 +461,18 @@ if (typeof(PhpDebugBar) == 'undefined') {
461461

462462
// dragging of resize handle
463463
var dragging = false;
464+
var min_h = 40;
465+
var max_h = $(window).height() - this.$header.height() - 10;
464466
this.$resizehdle.on('mousedown', function(e) {
465467
var orig_h = $body.height(), pos_y = e.pageY;
466468
dragging = true;
467469

468470
$body.parents().on('mousemove', function(e) {
469471
if (dragging) {
470472
var h = orig_h + (pos_y - e.pageY);
473+
// Respect the min/max values
474+
h = Math.min(h, max_h);
475+
h = Math.max(h, min_h);
471476
$body.css('height', h);
472477
localStorage.setItem('phpdebugbar-height', h);
473478
self.recomputeBottomOffset();

0 commit comments

Comments
 (0)