mirror of
https://github.com/maximebf/php-debugbar.git
synced 2025-07-21 08:41:28 +02:00
Merge pull request #147 from barryvdh/patch-9
Restrict resizing to visible screen
This commit is contained in:
@@ -461,6 +461,8 @@ if (typeof(PhpDebugBar) == 'undefined') {
|
|||||||
|
|
||||||
// dragging of resize handle
|
// dragging of resize handle
|
||||||
var dragging = false;
|
var dragging = false;
|
||||||
|
var min_h = 40;
|
||||||
|
var max_h = $(window).height() - this.$header.height() - 10;
|
||||||
this.$resizehdle.on('mousedown', function(e) {
|
this.$resizehdle.on('mousedown', function(e) {
|
||||||
var orig_h = $body.height(), pos_y = e.pageY;
|
var orig_h = $body.height(), pos_y = e.pageY;
|
||||||
dragging = true;
|
dragging = true;
|
||||||
@@ -468,6 +470,9 @@ if (typeof(PhpDebugBar) == 'undefined') {
|
|||||||
$body.parents().on('mousemove', function(e) {
|
$body.parents().on('mousemove', function(e) {
|
||||||
if (dragging) {
|
if (dragging) {
|
||||||
var h = orig_h + (pos_y - e.pageY);
|
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);
|
$body.css('height', h);
|
||||||
localStorage.setItem('phpdebugbar-height', h);
|
localStorage.setItem('phpdebugbar-height', h);
|
||||||
self.recomputeBottomOffset();
|
self.recomputeBottomOffset();
|
||||||
|
Reference in New Issue
Block a user