@@ -341,14 +341,19 @@ $.widget("ui.resizable", $.ui.mouse, {
341
341
el = this . helper , props = { } ,
342
342
smp = this . originalMousePosition ,
343
343
a = this . axis ,
344
- prevTop = this . position . top ,
345
- prevLeft = this . position . left ,
346
- prevWidth = this . size . width ,
347
- prevHeight = this . size . height ,
348
344
dx = ( event . pageX - smp . left ) || 0 ,
349
345
dy = ( event . pageY - smp . top ) || 0 ,
350
346
trigger = this . _change [ a ] ;
351
347
348
+ this . prevPosition = {
349
+ top : this . position . top ,
350
+ left : this . position . left
351
+ } ;
352
+ this . prevSize = {
353
+ width : this . size . width ,
354
+ height : this . size . height
355
+ } ;
356
+
352
357
if ( ! trigger ) {
353
358
return false ;
354
359
}
@@ -369,16 +374,16 @@ $.widget("ui.resizable", $.ui.mouse, {
369
374
// plugins callbacks need to be called first
370
375
this . _propagate ( "resize" , event ) ;
371
376
372
- if ( this . position . top !== prevTop ) {
377
+ if ( this . position . top !== this . prevPosition . top ) {
373
378
props . top = this . position . top + "px" ;
374
379
}
375
- if ( this . position . left !== prevLeft ) {
380
+ if ( this . position . left !== this . prevPosition . left ) {
376
381
props . left = this . position . left + "px" ;
377
382
}
378
- if ( this . size . width !== prevWidth ) {
383
+ if ( this . size . width !== this . prevSize . width ) {
379
384
props . width = this . size . width + "px" ;
380
385
}
381
- if ( this . size . height !== prevHeight ) {
386
+ if ( this . size . height !== this . prevSize . height ) {
382
387
props . height = this . size . height + "px" ;
383
388
}
384
389
el . css ( props ) ;
@@ -662,7 +667,9 @@ $.widget("ui.resizable", $.ui.mouse, {
662
667
position : this . position ,
663
668
size : this . size ,
664
669
originalSize : this . originalSize ,
665
- originalPosition : this . originalPosition
670
+ originalPosition : this . originalPosition ,
671
+ prevSize : this . prevSize ,
672
+ prevPosition : this . prevPosition
666
673
} ;
667
674
}
668
675
@@ -779,7 +786,7 @@ $.ui.plugin.add( "resizable", "containment", {
779
786
}
780
787
} ,
781
788
782
- resize : function ( event ) {
789
+ resize : function ( event , ui ) {
783
790
var woset , hoset , isParent , isOffsetRelative ,
784
791
that = $ ( this ) . resizable ( "instance" ) ,
785
792
o = that . options ,
@@ -790,7 +797,8 @@ $.ui.plugin.add( "resizable", "containment", {
790
797
top : 0 ,
791
798
left : 0
792
799
} ,
793
- ce = that . containerElement ;
800
+ ce = that . containerElement ,
801
+ continueResize = true ;
794
802
795
803
if ( ce [ 0 ] !== document && ( / s t a t i c / ) . test ( ce . css ( "position" ) ) ) {
796
804
cop = co ;
@@ -800,6 +808,7 @@ $.ui.plugin.add( "resizable", "containment", {
800
808
that . size . width = that . size . width + ( that . _helper ? ( that . position . left - co . left ) : ( that . position . left - cop . left ) ) ;
801
809
if ( pRatio ) {
802
810
that . size . height = that . size . width / that . aspectRatio ;
811
+ continueResize = false ;
803
812
}
804
813
that . position . left = o . helper ? co . left : 0 ;
805
814
}
@@ -808,6 +817,7 @@ $.ui.plugin.add( "resizable", "containment", {
808
817
that . size . height = that . size . height + ( that . _helper ? ( that . position . top - co . top ) : that . position . top ) ;
809
818
if ( pRatio ) {
810
819
that . size . width = that . size . height * that . aspectRatio ;
820
+ continueResize = false ;
811
821
}
812
822
that . position . top = that . _helper ? co . top : 0 ;
813
823
}
@@ -829,15 +839,24 @@ $.ui.plugin.add( "resizable", "containment", {
829
839
that . size . width = that . parentData . width - woset ;
830
840
if ( pRatio ) {
831
841
that . size . height = that . size . width / that . aspectRatio ;
842
+ continueResize = false ;
832
843
}
833
844
}
834
845
835
846
if ( hoset + that . size . height >= that . parentData . height ) {
836
847
that . size . height = that . parentData . height - hoset ;
837
848
if ( pRatio ) {
838
849
that . size . width = that . size . height * that . aspectRatio ;
850
+ continueResize = false ;
839
851
}
840
852
}
853
+
854
+ if ( ! continueResize ) {
855
+ that . position . left = ui . prevPosition . left ;
856
+ that . position . top = ui . prevPosition . top ;
857
+ that . size . width = ui . prevSize . width ;
858
+ that . size . height = ui . prevSize . height ;
859
+ }
841
860
} ,
842
861
843
862
stop : function ( ) {
0 commit comments