keep dialog from being resizable beyond document

This commit is contained in:
Rolux 2010-02-21 11:32:56 +05:30
parent 74e9a817e3
commit 6eebf82e33
2 changed files with 13 additions and 6 deletions

View file

@ -62,7 +62,7 @@ Dialog
.OxDialog { .OxDialog {
position: absolute; position: absolute;
left: 0; left: 0;
top: -48px; top: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
margin: auto; margin: auto;

View file

@ -1254,6 +1254,7 @@ requires
.css({ .css({
//left: (($document.width() - self.options.width) / 2) + "px", //left: (($document.width() - self.options.width) / 2) + "px",
//top: (($document.height() - self.options.height - 80) / 2) + "px", //top: (($document.height() - self.options.height - 80) / 2) + "px",
top: parseInt(-$document.height() / 10) + "px",
width: self.options.width + "px", width: self.options.width + "px",
height: self.options.height + "px" height: self.options.height + "px"
}); });
@ -1316,12 +1317,12 @@ requires
x = event.clientX, x = event.clientX,
y = event.clientY; y = event.clientY;
$window.mousemove(function(event) { $window.mousemove(function(event) {
that.css({
margin: 0
});
$("*").css({ $("*").css({
WebkitUserSelect: "none" WebkitUserSelect: "none"
}); });
that.css({
margin: 0
});
var left = Ox.limit( var left = Ox.limit(
offset.left - x + event.clientX, offset.left - x + event.clientX,
24 - self.options.width, documentWidth - 24 24 - self.options.width, documentWidth - 24
@ -1354,6 +1355,9 @@ requires
x = event.clientX, x = event.clientX,
y = event.clientY; y = event.clientY;
$window.mousemove(function(event) { $window.mousemove(function(event) {
$("*").css({
WebkitUserSelect: "none"
});
that.css({ that.css({
left: offset.left, left: offset.left,
top: offset.top, top: offset.top,
@ -1361,11 +1365,11 @@ requires
}); });
var width = Ox.limit( var width = Ox.limit(
elementWidth - x + event.clientX, elementWidth - x + event.clientX,
self.options.minWidth, documentWidth self.options.minWidth, documentWidth - offset.left
), ),
height = Ox.limit( height = Ox.limit(
elementHeight - y + event.clientY, elementHeight - y + event.clientY,
self.options.minHeight, documentHeight self.options.minHeight, documentHeight - offset.top
); );
that.width(width); that.width(width);
that.height(height); that.height(height);
@ -1373,6 +1377,9 @@ requires
}); });
$window.one("mouseup", function() { $window.one("mouseup", function() {
$window.unbind("mousemove"); $window.unbind("mousemove");
$("*").css({
WebkitUserSelect: "auto"
});
}); });
} }