From bec877bfe5b70e6ba03dd44868cb4341050735ef Mon Sep 17 00:00:00 2001 From: Rolux Date: Sun, 21 Feb 2010 12:17:18 +0530 Subject: [PATCH] dblclick resize area to reset size --- build/js/ox.ui.js | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/build/js/ox.ui.js b/build/js/ox.ui.js index 024cfc9..d59541b 100644 --- a/build/js/ox.ui.js +++ b/build/js/ox.ui.js @@ -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({