aboutsummaryrefslogtreecommitdiffstats
path: root/themes/default/js/ui/jquery.ui.resizable.js
diff options
context:
space:
mode:
authorpatdenice <patdenice@piwigo.org>2011-10-28 13:25:54 +0000
committerpatdenice <patdenice@piwigo.org>2011-10-28 13:25:54 +0000
commit2a5be28bc5a0fe4748279bebe23d1be6416fe015 (patch)
tree19dc0a131baa6ad1b8fb1c96e64c153013785d81 /themes/default/js/ui/jquery.ui.resizable.js
parent3ea95e0ebcce5ecd80ac4e95879dae72e9360988 (diff)
feature:2487
Update jQuery to 1.6.4 and jQuery UI to 1.8.16 git-svn-id: http://piwigo.org/svn/trunk@12525 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--themes/default/js/ui/jquery.ui.resizable.js40
1 files changed, 35 insertions, 5 deletions
diff --git a/themes/default/js/ui/jquery.ui.resizable.js b/themes/default/js/ui/jquery.ui.resizable.js
index 1d7648a0c..d5fd9b9ac 100644
--- a/themes/default/js/ui/jquery.ui.resizable.js
+++ b/themes/default/js/ui/jquery.ui.resizable.js
@@ -1,5 +1,5 @@
/*
- * jQuery UI Resizable 1.8.10
+ * jQuery UI Resizable 1.8.16
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
@@ -176,10 +176,12 @@ $.widget("ui.resizable", $.ui.mouse, {
$(this.element)
.addClass("ui-resizable-autohide")
.hover(function() {
+ if (o.disabled) return;
$(this).removeClass("ui-resizable-autohide");
self._handles.show();
},
function(){
+ if (o.disabled) return;
if (!self.resizing) {
$(this).addClass("ui-resizable-autohide");
self._handles.hide();
@@ -291,6 +293,8 @@ $.widget("ui.resizable", $.ui.mouse, {
// Calculate the attrs that will be change
var data = trigger.apply(this, [event, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff;
+ // Put this in the mouseDrag handler since the user can start pressing shift while resizing
+ this._updateVirtualBoundaries(event.shiftKey);
if (this._aspectRatio || event.shiftKey)
data = this._updateRatio(data, event);
@@ -349,6 +353,32 @@ $.widget("ui.resizable", $.ui.mouse, {
},
+ _updateVirtualBoundaries: function(forceAspectRatio) {
+ var o = this.options, pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b;
+
+ b = {
+ minWidth: isNumber(o.minWidth) ? o.minWidth : 0,
+ maxWidth: isNumber(o.maxWidth) ? o.maxWidth : Infinity,
+ minHeight: isNumber(o.minHeight) ? o.minHeight : 0,
+ maxHeight: isNumber(o.maxHeight) ? o.maxHeight : Infinity
+ };
+
+ if(this._aspectRatio || forceAspectRatio) {
+ // We want to create an enclosing box whose aspect ration is the requested one
+ // First, compute the "projected" size for each dimension based on the aspect ratio and other dimension
+ pMinWidth = b.minHeight * this.aspectRatio;
+ pMinHeight = b.minWidth / this.aspectRatio;
+ pMaxWidth = b.maxHeight * this.aspectRatio;
+ pMaxHeight = b.maxWidth / this.aspectRatio;
+
+ if(pMinWidth > b.minWidth) b.minWidth = pMinWidth;
+ if(pMinHeight > b.minHeight) b.minHeight = pMinHeight;
+ if(pMaxWidth < b.maxWidth) b.maxWidth = pMaxWidth;
+ if(pMaxHeight < b.maxHeight) b.maxHeight = pMaxHeight;
+ }
+ this._vBoundaries = b;
+ },
+
_updateCache: function(data) {
var o = this.options;
this.offset = this.helper.offset();
@@ -362,8 +392,8 @@ $.widget("ui.resizable", $.ui.mouse, {
var o = this.options, cpos = this.position, csize = this.size, a = this.axis;
- if (data.height) data.width = (csize.height * this.aspectRatio);
- else if (data.width) data.height = (csize.width / this.aspectRatio);
+ if (isNumber(data.height)) data.width = (data.height * this.aspectRatio);
+ else if (isNumber(data.width)) data.height = (data.width / this.aspectRatio);
if (a == 'sw') {
data.left = cpos.left + (csize.width - data.width);
@@ -379,7 +409,7 @@ $.widget("ui.resizable", $.ui.mouse, {
_respectSize: function(data, event) {
- var el = this.helper, o = this.options, pRatio = this._aspectRatio || event.shiftKey, a = this.axis,
+ var el = this.helper, o = this._vBoundaries, pRatio = this._aspectRatio || event.shiftKey, a = this.axis,
ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height);
@@ -519,7 +549,7 @@ $.widget("ui.resizable", $.ui.mouse, {
});
$.extend($.ui.resizable, {
- version: "1.8.10"
+ version: "1.8.16"
});
/*