Skip to content

Commit 34ed9ed

Browse files
committed
Effects rewrite: correct "restore: false" use case for size/scale.
This makes all tests pass in test suite. Wooh!
1 parent ffce765 commit 34ed9ed

File tree

1 file changed

+7
-24
lines changed

1 file changed

+7
-24
lines changed

ui/effect-size.js

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ $.effects.define( "size", function( o, done ) {
177177
easing: o.easing,
178178
complete: function() {
179179

180+
var offset = el.offset();
181+
180182
if ( restore ) {
181183
$.effects.removePlaceholder( placeholder, el );
182184
}
@@ -190,32 +192,13 @@ $.effects.define( "size", function( o, done ) {
190192

191193
if ( !restore ) {
192194

193-
// we need to calculate our new positioning based on the scaling
194-
if ( position === "static" ) {
195-
el.css({
196-
position: "relative",
197-
top: to.top,
198-
left: to.left
199-
});
200-
} else {
201-
$.each([ "top", "left" ], function( idx, pos ) {
202-
el.css( pos, function( _, str ) {
203-
var val = parseInt( str, 10 ),
204-
toRef = idx ? to.left : to.top;
205-
206-
// if original was "auto", recalculate the new value from placeholder
207-
if ( str === "auto" ) {
208-
return toRef + "px";
209-
}
210-
211-
return val + toRef + "px";
212-
});
213-
});
195+
if ( placeholder ) {
196+
placeholder.remove();
214197
}
215198

216-
// the placeholder needs to be removed only after the new position is set
217-
// as it's relied upon for correcting "auto" above
218-
$.effects.removePlaceholder( placeholder, el );
199+
el.css("position", position === "static" ? "relative" : position );
200+
201+
el.offset(offset);
219202
}
220203

221204
done();

0 commit comments

Comments
 (0)