Skip to content
Permalink
Browse files

Fixed #2996

  • Loading branch information
eduardolundgren committed Jun 26, 2008
1 parent bb640af commit 76f414bc5e25fc955bc1b607cd9f1362379a389d
Showing with 19 additions and 19 deletions.
  1. +19 −19 ui/ui.resizable.js
@@ -26,7 +26,7 @@ $.widget("ui.resizable", $.extend($.ui.mouse, {

$.extend(o, {
_aspectRatio: !!(o.aspectRatio),
proxy: o.proxy || o.ghost || o.animate ? o.proxy || 'proxy' : null,
helper: o.helper || o.ghost || o.animate ? o.helper || 'proxy' : null,
knobHandles: o.knobHandles === true ? 'ui-resizable-knob-handle' : o.knobHandles
});

@@ -292,8 +292,8 @@ $.widget("ui.resizable", $.extend($.ui.mouse, {
//Store needed variables
this.offset = this.helper.offset();
this.position = { left: curleft, top: curtop };
this.size = o.proxy || ie6 ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
this.originalSize = o.proxy || ie6 ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
this.size = o.helper || ie6 ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
this.originalSize = o.helper || ie6 ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
this.originalPosition = { left: curleft, top: curtop };
this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };
this.originalMousePosition = { left: e.pageX, top: e.pageY };
@@ -333,7 +333,7 @@ $.widget("ui.resizable", $.extend($.ui.mouse, {
width: this.size.width + "px", height: this.size.height + "px"
});

if (!o.proxy && o.proportionallyResize)
if (!o.helper && o.proportionallyResize)
this._proportionallyResize();

this._updateCache(data);
@@ -348,7 +348,7 @@ $.widget("ui.resizable", $.extend($.ui.mouse, {
this.options.resizing = false;
var o = this.options, num = function(v) { return parseInt(v, 10) || 0; }, self = this;

if(o.proxy) {
if(o.helper) {
var pr = o.proportionallyResize, ista = pr && (/textarea/i).test(pr.get(0).nodeName),
soffseth = ista && $.ui.hasScroll(pr.get(0), 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
soffsetw = ista ? 0 : self.sizeDiff.width;
@@ -360,15 +360,15 @@ $.widget("ui.resizable", $.extend($.ui.mouse, {
if (!o.animate)
this.element.css($.extend(s, { top: top, left: left }));

if (o.proxy && !o.animate) this._proportionallyResize();
if (o.helper && !o.animate) this._proportionallyResize();
}

if (o.preserveCursor)
$('body').css('cursor', 'auto');

this.propagate("stop", e);

if (o.proxy) this.helper.remove();
if (o.helper) this.helper.remove();

return false;
},
@@ -446,14 +446,14 @@ $.widget("ui.resizable", $.extend($.ui.mouse, {
var el = this.element, o = this.options;
this.elementOffset = el.offset();

if(o.proxy) {
if(o.helper) {
this.helper = this.helper || $('<div style="overflow:hidden;"></div>');

// fix ie6 offset
var ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0),
pxyoffset = ( ie6 ? 2 : -1 );

this.helper.addClass(o.proxy).css({
this.helper.addClass(o.helper).css({
width: el.outerWidth() + pxyoffset,
height: el.outerHeight() + pxyoffset,
position: 'absolute',
@@ -565,20 +565,20 @@ $.ui.plugin.add("resizable", "containment", {
if (ce[0] != document && /static/.test(ce.css('position')))
cop = self.containerPosition;

if (cp.left < (o.proxy ? co.left : cop.left)) {
self.size.width = self.size.width + (o.proxy ? (self.position.left - co.left) : (self.position.left - cop.left));
if (cp.left < (o.helper ? co.left : cop.left)) {
self.size.width = self.size.width + (o.helper ? (self.position.left - co.left) : (self.position.left - cop.left));
if (pRatio) self.size.height = self.size.width * o.aspectRatio;
self.position.left = o.proxy ? co.left : cop.left;
self.position.left = o.helper ? co.left : cop.left;
}

if (cp.top < (o.proxy ? co.top : 0)) {
self.size.height = self.size.height + (o.proxy ? (self.position.top - co.top) : self.position.top);
if (cp.top < (o.helper ? co.top : 0)) {
self.size.height = self.size.height + (o.helper ? (self.position.top - co.top) : self.position.top);
if (pRatio) self.size.width = self.size.height / o.aspectRatio;
self.position.top = o.proxy ? co.top : 0;
self.position.top = o.helper ? co.top : 0;
}

var woset = (o.proxy ? self.offset.left - co.left : (self.position.left - cop.left)) + self.sizeDiff.width,
hoset = (o.proxy ? self.offset.top - co.top : self.position.top) + self.sizeDiff.height;
var woset = (o.helper ? self.offset.left - co.left : (self.position.left - cop.left)) + self.sizeDiff.width,
hoset = (o.helper ? self.offset.top - co.top : self.position.top) + self.sizeDiff.height;

if (woset + self.size.width >= self.parentData.width) {
self.size.width = self.parentData.width - woset;
@@ -598,10 +598,10 @@ $.ui.plugin.add("resizable", "containment", {
var helper = $(self.helper), ho = helper.offset(), w = helper.innerWidth(), h = helper.innerHeight();


if (o.proxy && !o.animate && /relative/.test(ce.css('position')))
if (o.helper && !o.animate && /relative/.test(ce.css('position')))
$(this).css({ left: (ho.left - co.left), top: (ho.top - co.top), width: w, height: h });

if (o.proxy && !o.animate && /static/.test(ce.css('position')))
if (o.helper && !o.animate && /static/.test(ce.css('position')))
$(this).css({ left: cop.left + (ho.left - co.left), top: cop.top + (ho.top - co.top), width: w, height: h });

}

0 comments on commit 76f414b

Please sign in to comment.
You can’t perform that action at this time.