Skip to content

Commit d4d8d74

Browse files
committed
Scale: We can't detect this reliably currently, so assume all elements are positioned with left and top
1 parent 42d33f2 commit d4d8d74

File tree

2 files changed

+5
-18
lines changed

2 files changed

+5
-18
lines changed

tests/unit/effects/effects_scale.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ function suite( position ) {
4444
run( position, "top", "left", "top", "left" );
4545
run( position, "top", "left", "middle", "center" );
4646
run( position, "top", "left", "bottom", "right" );
47+
/* Firefox is currently not capable of supporting detection of bottom and right....
4748
run( position, "bottom", "right", "top", "left" );
4849
run( position, "bottom", "right", "middle", "center" );
4950
run( position, "bottom", "right", "bottom", "right" );
51+
*/
5052
}
5153

5254
$(function() {

ui/jquery.effects.scale.js

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,7 @@ $.effects.effect.size = function( o, done ) {
117117
scale = o.scale || "both",
118118
origin = o.origin || [ "middle", "center" ],
119119
original, baseline, factor,
120-
position = el.css( "position" ),
121-
originalVerticalPositioning = el.css( "bottom" ) !== "auto" ? "bottom" : "top";
122-
originalHorizontalPositioning = el.css( "right" ) !== "auto" ? "right" : "left";
120+
position = el.css( "position" );
123121

124122
if ( mode === "show" ) {
125123
el.show();
@@ -260,32 +258,19 @@ $.effects.effect.size = function( o, done ) {
260258
left: el.to.left
261259
});
262260
} else {
263-
$.each([ originalVerticalPositioning, originalHorizontalPositioning ], function( idx, pos ) {
261+
$.each([ "top", "left" ], function( idx, pos ) {
264262
el.css( pos, function( _, str ) {
265263
var val = parseInt( str, 10 ),
266264
toRef = idx ? el.to.left : el.to.top,
267265
delta = idx ? el.to.outerWidth - el.from.outerWidth: el.to.outerHeight - el.from.outerHeight,
268266
same = origin[ idx ] === pos,
269-
mid = origin[ idx ] === "middle" || origin[ idx ] === "center",
270-
direction = pos == "left" || pos == "top";
267+
mid = origin[ idx ] === "middle" || origin[ idx ] === "center";
271268

272269
// if original was "auto", recalculate the new value from wrapper
273270
if ( str === "auto" ) {
274271
return toRef + "px";
275272
}
276273

277-
// if not setting left or top
278-
if ( !direction ) {
279-
280-
// if the position is relative, bottom/right are reversed meaning
281-
if ( position === "relative" ) {
282-
toRef *= -1;
283-
284-
// otherwise, if its NOT a midpoint origin, compensate for the outerWidth difference
285-
} else if ( !mid ) {
286-
toRef -= delta * ( same ? -1 : 1 );
287-
}
288-
}
289274
return val + toRef + "px";
290275
});
291276
});

0 commit comments

Comments
 (0)