Skip to content

Commit e89ae5f

Browse files
committed
Merge pull request #317 from tomykaira/bug_6096
effects.scale: fix: calculate top / left by outerHeight / Width. #6096
2 parents de3fc00 + 7d232f7 commit e89ae5f

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

ui/jquery.effects.scale.js

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ $.effects.effect.scale = function( o ) {
5454
origin = o.origin,
5555
original = {
5656
height: el.height(),
57-
width: el.width()
57+
width: el.width(),
58+
outerHeight: el.outerHeight(),
59+
outerWidth: el.outerWidth()
5860
},
5961
factor = {
6062
y: direction != 'horizontal' ? (percent / 100) : 1,
@@ -74,7 +76,9 @@ $.effects.effect.scale = function( o ) {
7476
options.from = o.from || ( mode == 'show' ? { height: 0, width: 0 } : original );
7577
options.to = {
7678
height: original.height * factor.y,
77-
width: original.width * factor.x
79+
width: original.width * factor.x,
80+
outerHeight: original.outerHeight * factor.y,
81+
outerWidth: original.outerWidth * factor.x
7882
};
7983

8084
if ( options.fade ) { // Fade option to support puff
@@ -122,21 +126,14 @@ $.effects.effect.size = function( o ) {
122126
}
123127
original = {
124128
height: el.height(),
125-
width: el.width()
129+
width: el.width(),
130+
outerHeight: el.outerHeight(),
131+
outerWidth: el.outerWidth()
126132
};
127133

128134
el.from = o.from || original;
129135
el.to = o.to || original;
130136

131-
// Adjust
132-
if (origin) { // Calculate baseline shifts
133-
baseline = $.effects.getBaseline( origin, original );
134-
el.from.top = ( original.height - el.from.height ) * baseline.y;
135-
el.from.left = ( original.width - el.from.width ) * baseline.x;
136-
el.to.top = ( original.height - el.to.height ) * baseline.y;
137-
el.to.left = ( original.width - el.to.width ) * baseline.x;
138-
}
139-
140137
// Set scaling factor
141138
factor = {
142139
from: {
@@ -183,6 +180,16 @@ $.effects.effect.size = function( o ) {
183180
$.effects.createWrapper( el );
184181
el.css( 'overflow', 'hidden' ).css( el.from );
185182

183+
// Adjust
184+
if (origin) { // Calculate baseline shifts
185+
baseline = $.effects.getBaseline( origin, original );
186+
el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y;
187+
el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x;
188+
el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y;
189+
el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x;
190+
}
191+
el.css( el.from ); // set top & left
192+
186193
// Animate
187194
if ( scale == 'content' || scale == 'both' ) { // Scale the children
188195

0 commit comments

Comments
 (0)