Skip to content

Commit 6a1a159

Browse files
committed
Merge pull request php-debugbar#147 from barryvdh/patch-9
Restrict resizing to visible screen
2 parents 4a660ce + 0b4f7c9 commit 6a1a159

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)