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