diff options
author | Scott González <scott.gonzalez@gmail.com> | 2011-05-26 05:40:13 -0700 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2011-05-26 05:40:13 -0700 |
commit | e89ae5f3bb3e8827960c4f0de5dd1ce1ac5010f5 (patch) | |
tree | ac621856f2955d13977c60b1f4e5ee8ecbbe7055 | |
parent | de3fc0050ee672ce155f0dd65ee9ecdfd818c063 (diff) | |
parent | 7d232f753428d68ade9b73f091579811cf90eb96 (diff) | |
download | jquery-ui-e89ae5f3bb3e8827960c4f0de5dd1ce1ac5010f5.tar.gz jquery-ui-e89ae5f3bb3e8827960c4f0de5dd1ce1ac5010f5.zip |
Merge pull request #317 from tomykaira/bug_6096
effects.scale: fix: calculate top / left by outerHeight / Width. #6096
-rw-r--r-- | ui/jquery.effects.scale.js | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/ui/jquery.effects.scale.js b/ui/jquery.effects.scale.js index b5c49ce7c..00f0151af 100644 --- a/ui/jquery.effects.scale.js +++ b/ui/jquery.effects.scale.js @@ -54,7 +54,9 @@ $.effects.effect.scale = function( o ) { origin = o.origin, original = { height: el.height(), - width: el.width() + width: el.width(), + outerHeight: el.outerHeight(), + outerWidth: el.outerWidth() }, factor = { y: direction != 'horizontal' ? (percent / 100) : 1, @@ -74,7 +76,9 @@ $.effects.effect.scale = function( o ) { options.from = o.from || ( mode == 'show' ? { height: 0, width: 0 } : original ); options.to = { height: original.height * factor.y, - width: original.width * factor.x + width: original.width * factor.x, + outerHeight: original.outerHeight * factor.y, + outerWidth: original.outerWidth * factor.x }; if ( options.fade ) { // Fade option to support puff @@ -122,21 +126,14 @@ $.effects.effect.size = function( o ) { } original = { height: el.height(), - width: el.width() + width: el.width(), + outerHeight: el.outerHeight(), + outerWidth: el.outerWidth() }; el.from = o.from || original; el.to = o.to || original; - // Adjust - if (origin) { // Calculate baseline shifts - baseline = $.effects.getBaseline( origin, original ); - el.from.top = ( original.height - el.from.height ) * baseline.y; - el.from.left = ( original.width - el.from.width ) * baseline.x; - el.to.top = ( original.height - el.to.height ) * baseline.y; - el.to.left = ( original.width - el.to.width ) * baseline.x; - } - // Set scaling factor factor = { from: { @@ -183,6 +180,16 @@ $.effects.effect.size = function( o ) { $.effects.createWrapper( el ); el.css( 'overflow', 'hidden' ).css( el.from ); + // Adjust + if (origin) { // Calculate baseline shifts + baseline = $.effects.getBaseline( origin, original ); + el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y; + el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x; + el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y; + el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x; + } + el.css( el.from ); // set top & left + // Animate if ( scale == 'content' || scale == 'both' ) { // Scale the children |