Resizable: fix whitespace on containment plugin

This commit is contained in:
Jyoti Deka 2013-12-15 12:37:54 -05:00 committed by Mike Sherov
parent c03cb8079c
commit bae1a25b14

View File

@ -730,12 +730,21 @@ $.ui.plugin.add("resizable", "containment", {
that.containerElement = $( ce );
if ( / document/.test( oc ) || oc === document ) {
that.containerOffset = { left: 0, top: 0 };
that.containerPosition = { left: 0, top: 0 };
that.containerOffset = {
left: 0,
top: 0
};
that.containerPosition = {
left: 0,
top: 0
};
that.parentData = {
element: $(document), left: 0, top: 0,
width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight
element: $( document ),
left: 0,
top: 0,
width: $( document ).width(),
height: $( document ).height() || document.body.parentNode.scrollHeight
};
}
@ -743,11 +752,16 @@ $.ui.plugin.add("resizable", "containment", {
else {
element = $( ce );
p = [];
$([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = that._num(element.css("padding" + name)); });
$([ "Top", "Right", "Left", "Bottom" ]).each(function( i, name ) {
p[ i ] = that._num( element.css( "padding" + name ) );
});
that.containerOffset = element.offset();
that.containerPosition = element.position();
that.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) };
that.containerSize = {
height: ( element.innerHeight() - p[ 3 ] ),
width: ( element.innerWidth() - p[ 1 ] )
};
co = that.containerOffset;
ch = that.containerSize.height;
@ -756,7 +770,11 @@ $.ui.plugin.add("resizable", "containment", {
height = ( that._hasScroll ( ce ) ? ce.scrollHeight : ch ) ;
that.parentData = {
element: ce, left: co.left, top: co.top, width: width, height: height
element: ce,
left: co.left,
top: co.top,
width: width,
height: height
};
}
},
@ -765,9 +783,14 @@ $.ui.plugin.add("resizable", "containment", {
var woset, hoset, isParent, isOffsetRelative,
that = $( this ).resizable( "instance" ),
o = that.options,
co = that.containerOffset, cp = that.position,
co = that.containerOffset,
cp = that.position,
pRatio = that._aspectRatio || event.shiftKey,
cop = { top:0, left:0 }, ce = that.containerElement;
cop = {
top: 0,
left: 0
},
ce = that.containerElement;
if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) {
cop = co;
@ -829,13 +852,20 @@ $.ui.plugin.add("resizable", "containment", {
h = helper.outerHeight() - that.sizeDiff.height;
if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) {
$(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
$( this ).css({
left: ho.left - cop.left - co.left,
width: w,
height: h
});
}
if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) {
$(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
$( this ).css({
left: ho.left - cop.left - co.left,
width: w,
height: h
});
}
}
});