dblclick resize area to reset size
This commit is contained in:
parent
890ccd1b27
commit
bec877bfe5
|
@ -1244,17 +1244,13 @@ requires
|
|||
.defaults({
|
||||
title: "",
|
||||
buttons: [],
|
||||
height: 192,
|
||||
minHeight: 128,
|
||||
height: 216,
|
||||
minHeight: 144,
|
||||
minWidth: 256,
|
||||
width: 384
|
||||
})
|
||||
.options(options || {})
|
||||
.addClass("OxDialog")
|
||||
.css({
|
||||
width: self.options.width + "px",
|
||||
height: self.options.height + "px"
|
||||
});
|
||||
.addClass("OxDialog");
|
||||
|
||||
if (!Ox.isArray(self.options.buttons[0])) {
|
||||
self.options.buttons = [[], self.options.buttons];
|
||||
|
@ -1274,9 +1270,6 @@ requires
|
|||
.appendTo(that.$titlebar);
|
||||
that.$content = new Ox.Container()
|
||||
.addClass("OxContent")
|
||||
.css({
|
||||
height: (self.options.height - 80) + "px"
|
||||
})
|
||||
.appendTo(that);
|
||||
that.$buttonsbar = new Ox.Bar({})
|
||||
.addClass("OxButtonsBar")
|
||||
|
@ -1294,6 +1287,7 @@ requires
|
|||
that.$resize = new Ox.Element()
|
||||
.addClass("OxResize")
|
||||
.mousedown(resize)
|
||||
.dblclick(reset)
|
||||
.appendTo(that.$buttonsbar);
|
||||
$.each(self.options.buttons[1].reverse(), function(i, button) {
|
||||
that.$buttons[that.$buttons.length] = new Ox.Button({
|
||||
|
@ -1311,7 +1305,7 @@ requires
|
|||
function center() {
|
||||
that.css({
|
||||
left: 0,
|
||||
top: parseInt(-$document.height() / 10) + "px",
|
||||
top: parseInt(-$document.height() / 10) + "px", // fixme: don't overlap menu
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
margin: "auto"
|
||||
|
@ -1321,6 +1315,7 @@ requires
|
|||
function drag(event) {
|
||||
var documentWidth = $document.width(),
|
||||
documentHeight = $document.height(),
|
||||
elementWidth = that.width(),
|
||||
offset = that.offset(),
|
||||
x = event.clientX,
|
||||
y = event.clientY;
|
||||
|
@ -1333,7 +1328,7 @@ requires
|
|||
});
|
||||
var left = Ox.limit(
|
||||
offset.left - x + event.clientX,
|
||||
24 - self.options.width, documentWidth - 24
|
||||
24 - elementWidth, documentWidth - 24
|
||||
),
|
||||
top = Ox.limit(
|
||||
offset.top - y + event.clientY,
|
||||
|
@ -1353,6 +1348,12 @@ requires
|
|||
|
||||
}
|
||||
|
||||
function reset() {
|
||||
that.width(self.options.width);
|
||||
that.height(self.options.height);
|
||||
that.$content.height(self.options.height - 80);
|
||||
}
|
||||
|
||||
function resize(event) {
|
||||
var contentHeight = that.$content.height(),
|
||||
documentWidth = $document.width(),
|
||||
|
@ -1373,7 +1374,7 @@ requires
|
|||
});
|
||||
var width = Ox.limit(
|
||||
elementWidth - x + event.clientX,
|
||||
self.options.minWidth, documentWidth - offset.left
|
||||
self.options.minWidth, Math.min(documentWidth, documentWidth - offset.left)
|
||||
),
|
||||
height = Ox.limit(
|
||||
elementHeight - y + event.clientY,
|
||||
|
@ -1428,6 +1429,7 @@ requires
|
|||
that.$layer.appendTo($body);
|
||||
Ox.print("opening...")
|
||||
center();
|
||||
reset();
|
||||
that.css({
|
||||
opacity: 0
|
||||
}).appendTo(that.$layer).animate({
|
||||
|
|
Loading…
Reference in New Issue
Block a user