Skip to main content

Search and Top Navigation

#10054 closed bug (invalid)

Opened May 21, 2014 12:13PM UTC

Closed June 05, 2014 08:55AM UTC

Resizable fails to enlarge an element, but will shrink it

Reported by: glenatron Owned by: glenatron
Priority: minor Milestone: none
Component: ui.resizable Version: 1.10.4
Keywords: Cc:
Blocked by: Blocking:
Description

I have a very complex page which uses Resizable to facilitate dragging a panel over the page. The panel is dragged up and down only, to a maximum height.

On upgrading to JQuery-UI 1.10.4 this is failing. If I enlarg the panel manually, Resizable would be able to resize it down and back up to the original size, but as soon as the mouse was released it would "lock" to the new size and could not be resized any larger.

I have not been able to find a reduced scenario to demonstrate the problem however, tracking through the source I have managed to get to an actual line of code, in the "resize" function, which I have commented below:

resize: function( event ) {

var woset, hoset, isParent, isOffsetRelative,

that = $(this).data("ui-resizable"),

o = that.options,

co = that.containerOffset, cp = that.position,

pRatio = that._aspectRatio || event.shiftKey,

cop = { top:0, left:0 }, ce = that.containerElement;

if (ce[0] !== document && (/static/).test(ce.css("position"))) {

cop = co;

}

if (cp.left < (that._helper ? co.left : 0)) {

that.size.width = that.size.width + (that._helper ? (that.position.left - co.left) : (that.position.left - cop.left));

if (pRatio) {

that.size.height = that.size.width / that.aspectRatio;

}

that.position.left = o.helper ? co.left : 0;

}

if (cp.top < (that._helper ? co.top : 0)) {

The problem is here.

The value of cp.top is at this point negative, as is

that.position.top, which is basically set to the difference between

the movement target height and the current object height

// so this resets the height to its previous value.

that.size.height = that.size.height + (that._helper ? (that.position.top - co.top) : that.position.top);

if (pRatio) {

that.size.width = that.size.height * that.aspectRatio;

}

that.position.top = that._helper ? co.top : 0;

}

that.offset.left = that.parentData.left+that.position.left;

that.offset.top = that.parentData.top+that.position.top;

woset = Math.abs( (that._helper ? that.offset.left - cop.left : (that.offset.left - cop.left)) + that.sizeDiff.width );

hoset = Math.abs( (that._helper ? that.offset.top - cop.top : (that.offset.top - co.top)) + that.sizeDiff.height );

isParent = that.containerElement.get(0) === that.element.parent().get(0);

isOffsetRelative = /relative|absolute/.test(that.containerElement.css("position"));

if ( isParent && isOffsetRelative ) {

woset -= Math.abs( that.parentData.left );

}

if (woset + that.size.width >= that.parentData.width) {

that.size.width = that.parentData.width - woset;

if (pRatio) {

that.size.height = that.size.width / that.aspectRatio;

}

}

if (hoset + that.size.height >= that.parentData.height) {

that.size.height = that.parentData.height - hoset;

if (pRatio) {

that.size.width = that.size.height * that.aspectRatio;

}

}

},

I realise this will not be an easy fix from the evidence I have given but it may contribute if others run into the same scenario.

Attachments (0)
Change History (2)

Changed May 21, 2014 01:36PM UTC by tj.vantoll comment:1

owner: → glenatron
status: newpending

Hi glenatron,

Thanks for taking the time to contribute to jQuery UI, but we require a reduced test case before we can look into problems like this. You can use this as a starting point: http://jsfiddle.net/tj_vantoll/VJNFF/.

Changed June 05, 2014 08:55AM UTC by trac-o-bot comment:2

resolution: → invalid
status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!