From eb5858f69f0d8a73fc30b37958a6b63909b37b79 Mon Sep 17 00:00:00 2001 From: Eduardo Lundgren Date: Sun, 15 Feb 2009 14:51:59 +0000 Subject: [PATCH] Resizable: Fixed #4147 - Little jump when a resizable is about to reach the coordinate 0 (in x- or y-axis) --- ui/ui.resizable.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ui/ui.resizable.js b/ui/ui.resizable.js index bea9b4de1..bfa04ede2 100644 --- a/ui/ui.resizable.js +++ b/ui/ui.resizable.js @@ -325,10 +325,10 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, { _updateCache: function(data) { var o = this.options; this.offset = this.helper.offset(); - if (data.left) this.position.left = data.left; - if (data.top) this.position.top = data.top; - if (data.height) this.size.height = data.height; - if (data.width) this.size.width = data.width; + if (isNumber(data.left)) this.position.left = data.left; + if (isNumber(data.top)) this.position.top = data.top; + if (isNumber(data.height)) this.size.height = data.height; + if (isNumber(data.width)) this.size.width = data.width; }, _updateRatio: function(data, event) { @@ -352,10 +352,6 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, { _respectSize: function(data, event) { - var isNumber = function(value) { - return !isNaN(parseInt(value, 10)); - }; - var el = this.helper, o = this.options, 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); @@ -783,4 +779,8 @@ var num = function(v) { return parseInt(v, 10) || 0; }; +var isNumber = function(value) { + return !isNaN(parseInt(value, 10)); +}; + })(jQuery); -- 2.39.5