1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-01-17 13:28:35 +01:00

Merge pull request #147 from barryvdh/patch-9

Restrict resizing to visible screen
This commit is contained in:
Maxime Bouroumeau-Fuseau 2014-08-20 17:24:20 +02:00
commit 6a1a1593b6

View File

@ -461,6 +461,8 @@ if (typeof(PhpDebugBar) == 'undefined') {
// dragging of resize handle
var dragging = false;
var min_h = 40;
var max_h = $(window).height() - this.$header.height() - 10;
this.$resizehdle.on('mousedown', function(e) {
var orig_h = $body.height(), pos_y = e.pageY;
dragging = true;
@ -468,6 +470,9 @@ if (typeof(PhpDebugBar) == 'undefined') {
$body.parents().on('mousemove', function(e) {
if (dragging) {
var h = orig_h + (pos_y - e.pageY);
// Respect the min/max values
h = Math.min(h, max_h);
h = Math.max(h, min_h);
$body.css('height', h);
localStorage.setItem('phpdebugbar-height', h);
self.recomputeBottomOffset();