]> source.dussan.org Git - jquery-ui.git/commitdiff
Scale: We can't detect this reliably currently, so assume all elements are positioned...
authorCorey Frang <gnarf@gnarf.net>
Thu, 13 Oct 2011 21:06:19 +0000 (16:06 -0500)
committerCorey Frang <gnarf@gnarf.net>
Fri, 14 Oct 2011 15:24:01 +0000 (10:24 -0500)
tests/unit/effects/effects_scale.js
ui/jquery.effects.scale.js

index 1436cd03058241054a9993561be6d6a5d1bda1a8..a607361e6f0bc583273d11755c68767489f71156 100644 (file)
@@ -44,9 +44,11 @@ function suite( position ) {
        run( position, "top", "left", "top", "left" );
        run( position, "top", "left", "middle", "center" );
        run( position, "top", "left", "bottom", "right" );
+       /* Firefox is currently not capable of supporting detection of bottom and right....
        run( position, "bottom", "right", "top", "left" );
        run( position, "bottom", "right", "middle", "center" );
        run( position, "bottom", "right", "bottom", "right" );
+       */
 }
 
 $(function() {
index 000fdee28817aca3d564bd2d3aa50d69497061ab..96a9269ec10916ede3d12dbd9e15d9f6bd22fa1b 100644 (file)
@@ -117,9 +117,7 @@ $.effects.effect.size = function( o, done ) {
                scale = o.scale || "both",
                origin = o.origin || [ "middle", "center" ],
                original, baseline, factor,
-               position = el.css( "position" ),
-               originalVerticalPositioning = el.css( "bottom" ) !== "auto" ? "bottom" : "top";
-               originalHorizontalPositioning = el.css( "right" ) !== "auto" ? "right" : "left";
+               position = el.css( "position" );
 
        if ( mode === "show" ) {
                el.show();
@@ -260,32 +258,19 @@ $.effects.effect.size = function( o, done ) {
                                                left: el.to.left
                                        });
                                } else {
-                                       $.each([ originalVerticalPositioning, originalHorizontalPositioning ], function( idx, pos ) {
+                                       $.each([ "top", "left" ], function( idx, pos ) {
                                                el.css( pos, function( _, str ) {
                                                        var val = parseInt( str, 10 ),
                                                                toRef = idx ? el.to.left : el.to.top,
                                                                delta = idx ? el.to.outerWidth - el.from.outerWidth: el.to.outerHeight - el.from.outerHeight,
                                                                same = origin[ idx ] === pos,
-                                                               mid = origin[ idx ] === "middle" || origin[ idx ] === "center",
-                                                               direction = pos == "left" || pos == "top";
+                                                               mid = origin[ idx ] === "middle" || origin[ idx ] === "center";
 
                                                        // if original was "auto", recalculate the new value from wrapper
                                                        if ( str === "auto" ) {
                                                                return toRef + "px";
                                                        }
 
-                                                       // if not setting left or top
-                                                       if ( !direction ) {
-
-                                                               // if the position is relative, bottom/right are reversed meaning
-                                                               if ( position === "relative" ) {
-                                                                       toRef *= -1;
-
-                                                               // otherwise, if its NOT a midpoint origin, compensate for the outerWidth difference
-                                                               } else if ( !mid ) {
-                                                                       toRef -= delta * ( same ? -1 : 1 );
-                                                               }
-                                                       }
                                                        return val + toRef + "px"; 
                                                });
                                        });