@@ -37,7 +37,7 @@ $.widget("ui.resizable", $.ui.mouse, {
37
37
} ,
38
38
_create : function ( ) {
39
39
40
- var self = this , o = this . options ;
40
+ var that = this , o = this . options ;
41
41
this . element . addClass ( "ui-resizable" ) ;
42
42
43
43
$ . extend ( this , {
@@ -158,11 +158,11 @@ $.widget("ui.resizable", $.ui.mouse, {
158
158
159
159
//Matching axis name
160
160
this . _handles . mouseover ( function ( ) {
161
- if ( ! self . resizing ) {
161
+ if ( ! that . resizing ) {
162
162
if ( this . className )
163
163
var axis = this . className . match ( / u i - r e s i z a b l e - ( s e | s w | n e | n w | n | e | s | w ) / i) ;
164
164
//Axis, default = se
165
- self . axis = axis && axis [ 1 ] ? axis [ 1 ] : 'se' ;
165
+ that . axis = axis && axis [ 1 ] ? axis [ 1 ] : 'se' ;
166
166
}
167
167
} ) ;
168
168
@@ -174,13 +174,13 @@ $.widget("ui.resizable", $.ui.mouse, {
174
174
. hover ( function ( ) {
175
175
if ( o . disabled ) return ;
176
176
$ ( this ) . removeClass ( "ui-resizable-autohide" ) ;
177
- self . _handles . show ( ) ;
177
+ that . _handles . show ( ) ;
178
178
} ,
179
179
function ( ) {
180
180
if ( o . disabled ) return ;
181
- if ( ! self . resizing ) {
181
+ if ( ! that . resizing ) {
182
182
$ ( this ) . addClass ( "ui-resizable-autohide" ) ;
183
- self . _handles . hide ( ) ;
183
+ that . _handles . hide ( ) ;
184
184
}
185
185
} ) ;
186
186
}
@@ -276,7 +276,7 @@ $.widget("ui.resizable", $.ui.mouse, {
276
276
277
277
//Increase performance, avoid regex
278
278
var el = this . helper , o = this . options , props = { } ,
279
- self = this , smp = this . originalMousePosition , a = this . axis ;
279
+ that = this , smp = this . originalMousePosition , a = this . axis ;
280
280
281
281
var dx = ( event . pageX - smp . left ) || 0 , dy = ( event . pageY - smp . top ) || 0 ;
282
282
var trigger = this . _change [ a ] ;
@@ -314,22 +314,22 @@ $.widget("ui.resizable", $.ui.mouse, {
314
314
_mouseStop : function ( event ) {
315
315
316
316
this . resizing = false ;
317
- var o = this . options , self = this ;
317
+ var o = this . options , that = this ;
318
318
319
319
if ( this . _helper ) {
320
320
var pr = this . _proportionallyResizeElements , ista = pr . length && ( / t e x t a r e a / i) . test ( pr [ 0 ] . nodeName ) ,
321
- soffseth = ista && $ . ui . hasScroll ( pr [ 0 ] , 'left' ) /* TODO - jump height */ ? 0 : self . sizeDiff . height ,
322
- soffsetw = ista ? 0 : self . sizeDiff . width ;
321
+ soffseth = ista && $ . ui . hasScroll ( pr [ 0 ] , 'left' ) /* TODO - jump height */ ? 0 : that . sizeDiff . height ,
322
+ soffsetw = ista ? 0 : that . sizeDiff . width ;
323
323
324
- var s = { width : ( self . helper . width ( ) - soffsetw ) , height : ( self . helper . height ( ) - soffseth ) } ,
325
- left = ( parseInt ( self . element . css ( 'left' ) , 10 ) + ( self . position . left - self . originalPosition . left ) ) || null ,
326
- top = ( parseInt ( self . element . css ( 'top' ) , 10 ) + ( self . position . top - self . originalPosition . top ) ) || null ;
324
+ var s = { width : ( that . helper . width ( ) - soffsetw ) , height : ( that . helper . height ( ) - soffseth ) } ,
325
+ left = ( parseInt ( that . element . css ( 'left' ) , 10 ) + ( that . position . left - that . originalPosition . left ) ) || null ,
326
+ top = ( parseInt ( that . element . css ( 'top' ) , 10 ) + ( that . position . top - that . originalPosition . top ) ) || null ;
327
327
328
328
if ( ! o . animate )
329
329
this . element . css ( $ . extend ( s , { top : top , left : left } ) ) ;
330
330
331
- self . helper . height ( self . size . height ) ;
332
- self . helper . width ( self . size . width ) ;
331
+ that . helper . height ( that . size . height ) ;
332
+ that . helper . width ( that . size . width ) ;
333
333
334
334
if ( this . _helper && ! o . animate ) this . _proportionallyResize ( ) ;
335
335
}
@@ -547,7 +547,7 @@ $.widget("ui.resizable", $.ui.mouse, {
547
547
$ . ui . plugin . add ( "resizable" , "alsoResize" , {
548
548
549
549
start : function ( event , ui ) {
550
- var self = $ ( this ) . data ( "resizable" ) , o = self . options ;
550
+ var that = $ ( this ) . data ( "resizable" ) , o = that . options ;
551
551
552
552
var _store = function ( exp ) {
553
553
$ ( exp ) . each ( function ( ) {
@@ -568,11 +568,11 @@ $.ui.plugin.add("resizable", "alsoResize", {
568
568
} ,
569
569
570
570
resize : function ( event , ui ) {
571
- var self = $ ( this ) . data ( "resizable" ) , o = self . options , os = self . originalSize , op = self . originalPosition ;
571
+ var that = $ ( this ) . data ( "resizable" ) , o = that . options , os = that . originalSize , op = that . originalPosition ;
572
572
573
573
var delta = {
574
- height : ( self . size . height - os . height ) || 0 , width : ( self . size . width - os . width ) || 0 ,
575
- top : ( self . position . top - op . top ) || 0 , left : ( self . position . left - op . left ) || 0
574
+ height : ( that . size . height - os . height ) || 0 , width : ( that . size . width - os . width ) || 0 ,
575
+ top : ( that . position . top - op . top ) || 0 , left : ( that . position . left - op . left ) || 0
576
576
} ,
577
577
578
578
_alsoResize = function ( exp , c ) {
@@ -605,34 +605,34 @@ $.ui.plugin.add("resizable", "alsoResize", {
605
605
$ . ui . plugin . add ( "resizable" , "animate" , {
606
606
607
607
stop : function ( event , ui ) {
608
- var self = $ ( this ) . data ( "resizable" ) , o = self . options ;
608
+ var that = $ ( this ) . data ( "resizable" ) , o = that . options ;
609
609
610
- var pr = self . _proportionallyResizeElements , ista = pr . length && ( / t e x t a r e a / i) . test ( pr [ 0 ] . nodeName ) ,
611
- soffseth = ista && $ . ui . hasScroll ( pr [ 0 ] , 'left' ) /* TODO - jump height */ ? 0 : self . sizeDiff . height ,
612
- soffsetw = ista ? 0 : self . sizeDiff . width ;
610
+ var pr = that . _proportionallyResizeElements , ista = pr . length && ( / t e x t a r e a / i) . test ( pr [ 0 ] . nodeName ) ,
611
+ soffseth = ista && $ . ui . hasScroll ( pr [ 0 ] , 'left' ) /* TODO - jump height */ ? 0 : that . sizeDiff . height ,
612
+ soffsetw = ista ? 0 : that . sizeDiff . width ;
613
613
614
- var style = { width : ( self . size . width - soffsetw ) , height : ( self . size . height - soffseth ) } ,
615
- left = ( parseInt ( self . element . css ( 'left' ) , 10 ) + ( self . position . left - self . originalPosition . left ) ) || null ,
616
- top = ( parseInt ( self . element . css ( 'top' ) , 10 ) + ( self . position . top - self . originalPosition . top ) ) || null ;
614
+ var style = { width : ( that . size . width - soffsetw ) , height : ( that . size . height - soffseth ) } ,
615
+ left = ( parseInt ( that . element . css ( 'left' ) , 10 ) + ( that . position . left - that . originalPosition . left ) ) || null ,
616
+ top = ( parseInt ( that . element . css ( 'top' ) , 10 ) + ( that . position . top - that . originalPosition . top ) ) || null ;
617
617
618
- self . element . animate (
618
+ that . element . animate (
619
619
$ . extend ( style , top && left ? { top : top , left : left } : { } ) , {
620
620
duration : o . animateDuration ,
621
621
easing : o . animateEasing ,
622
622
step : function ( ) {
623
623
624
624
var data = {
625
- width : parseInt ( self . element . css ( 'width' ) , 10 ) ,
626
- height : parseInt ( self . element . css ( 'height' ) , 10 ) ,
627
- top : parseInt ( self . element . css ( 'top' ) , 10 ) ,
628
- left : parseInt ( self . element . css ( 'left' ) , 10 )
625
+ width : parseInt ( that . element . css ( 'width' ) , 10 ) ,
626
+ height : parseInt ( that . element . css ( 'height' ) , 10 ) ,
627
+ top : parseInt ( that . element . css ( 'top' ) , 10 ) ,
628
+ left : parseInt ( that . element . css ( 'left' ) , 10 )
629
629
} ;
630
630
631
631
if ( pr && pr . length ) $ ( pr [ 0 ] ) . css ( { width : data . width , height : data . height } ) ;
632
632
633
633
// propagating resize, and updating values for each animation step
634
- self . _updateCache ( data ) ;
635
- self . _propagate ( "resize" , event ) ;
634
+ that . _updateCache ( data ) ;
635
+ that . _propagate ( "resize" , event ) ;
636
636
637
637
}
638
638
}
@@ -644,17 +644,17 @@ $.ui.plugin.add("resizable", "animate", {
644
644
$ . ui . plugin . add ( "resizable" , "containment" , {
645
645
646
646
start : function ( event , ui ) {
647
- var self = $ ( this ) . data ( "resizable" ) , o = self . options , el = self . element ;
647
+ var that = $ ( this ) . data ( "resizable" ) , o = that . options , el = that . element ;
648
648
var oc = o . containment , ce = ( oc instanceof $ ) ? oc . get ( 0 ) : ( / p a r e n t / . test ( oc ) ) ? el . parent ( ) . get ( 0 ) : oc ;
649
649
if ( ! ce ) return ;
650
650
651
- self . containerElement = $ ( ce ) ;
651
+ that . containerElement = $ ( ce ) ;
652
652
653
653
if ( / d o c u m e n t / . test ( oc ) || oc == document ) {
654
- self . containerOffset = { left : 0 , top : 0 } ;
655
- self . containerPosition = { left : 0 , top : 0 } ;
654
+ that . containerOffset = { left : 0 , top : 0 } ;
655
+ that . containerPosition = { left : 0 , top : 0 } ;
656
656
657
- self . parentData = {
657
+ that . parentData = {
658
658
element : $ ( document ) , left : 0 , top : 0 ,
659
659
width : $ ( document ) . width ( ) , height : $ ( document ) . height ( ) || document . body . parentNode . scrollHeight
660
660
} ;
@@ -665,70 +665,70 @@ $.ui.plugin.add("resizable", "containment", {
665
665
var element = $ ( ce ) , p = [ ] ;
666
666
$ ( [ "Top" , "Right" , "Left" , "Bottom" ] ) . each ( function ( i , name ) { p [ i ] = num ( element . css ( "padding" + name ) ) ; } ) ;
667
667
668
- self . containerOffset = element . offset ( ) ;
669
- self . containerPosition = element . position ( ) ;
670
- self . containerSize = { height : ( element . innerHeight ( ) - p [ 3 ] ) , width : ( element . innerWidth ( ) - p [ 1 ] ) } ;
668
+ that . containerOffset = element . offset ( ) ;
669
+ that . containerPosition = element . position ( ) ;
670
+ that . containerSize = { height : ( element . innerHeight ( ) - p [ 3 ] ) , width : ( element . innerWidth ( ) - p [ 1 ] ) } ;
671
671
672
- var co = self . containerOffset , ch = self . containerSize . height , cw = self . containerSize . width ,
672
+ var co = that . containerOffset , ch = that . containerSize . height , cw = that . containerSize . width ,
673
673
width = ( $ . ui . hasScroll ( ce , "left" ) ? ce . scrollWidth : cw ) , height = ( $ . ui . hasScroll ( ce ) ? ce . scrollHeight : ch ) ;
674
674
675
- self . parentData = {
675
+ that . parentData = {
676
676
element : ce , left : co . left , top : co . top , width : width , height : height
677
677
} ;
678
678
}
679
679
} ,
680
680
681
681
resize : function ( event , ui ) {
682
- var self = $ ( this ) . data ( "resizable" ) , o = self . options ,
683
- ps = self . containerSize , co = self . containerOffset , cs = self . size , cp = self . position ,
684
- pRatio = self . _aspectRatio || event . shiftKey , cop = { top :0 , left :0 } , ce = self . containerElement ;
682
+ var that = $ ( this ) . data ( "resizable" ) , o = that . options ,
683
+ ps = that . containerSize , co = that . containerOffset , cs = that . size , cp = that . position ,
684
+ pRatio = that . _aspectRatio || event . shiftKey , cop = { top :0 , left :0 } , ce = that . containerElement ;
685
685
686
686
if ( ce [ 0 ] != document && ( / s t a t i c / ) . test ( ce . css ( 'position' ) ) ) cop = co ;
687
687
688
- if ( cp . left < ( self . _helper ? co . left : 0 ) ) {
689
- self . size . width = self . size . width + ( self . _helper ? ( self . position . left - co . left ) : ( self . position . left - cop . left ) ) ;
690
- if ( pRatio ) self . size . height = self . size . width / self . aspectRatio ;
691
- self . position . left = o . helper ? co . left : 0 ;
688
+ if ( cp . left < ( that . _helper ? co . left : 0 ) ) {
689
+ that . size . width = that . size . width + ( that . _helper ? ( that . position . left - co . left ) : ( that . position . left - cop . left ) ) ;
690
+ if ( pRatio ) that . size . height = that . size . width / that . aspectRatio ;
691
+ that . position . left = o . helper ? co . left : 0 ;
692
692
}
693
693
694
- if ( cp . top < ( self . _helper ? co . top : 0 ) ) {
695
- self . size . height = self . size . height + ( self . _helper ? ( self . position . top - co . top ) : self . position . top ) ;
696
- if ( pRatio ) self . size . width = self . size . height * self . aspectRatio ;
697
- self . position . top = self . _helper ? co . top : 0 ;
694
+ if ( cp . top < ( that . _helper ? co . top : 0 ) ) {
695
+ that . size . height = that . size . height + ( that . _helper ? ( that . position . top - co . top ) : that . position . top ) ;
696
+ if ( pRatio ) that . size . width = that . size . height * that . aspectRatio ;
697
+ that . position . top = that . _helper ? co . top : 0 ;
698
698
}
699
699
700
- self . offset . left = self . parentData . left + self . position . left ;
701
- self . offset . top = self . parentData . top + self . position . top ;
700
+ that . offset . left = that . parentData . left + that . position . left ;
701
+ that . offset . top = that . parentData . top + that . position . top ;
702
702
703
- var woset = Math . abs ( ( self . _helper ? self . offset . left - cop . left : ( self . offset . left - cop . left ) ) + self . sizeDiff . width ) ,
704
- hoset = Math . abs ( ( self . _helper ? self . offset . top - cop . top : ( self . offset . top - co . top ) ) + self . sizeDiff . height ) ;
703
+ var woset = Math . abs ( ( that . _helper ? that . offset . left - cop . left : ( that . offset . left - cop . left ) ) + that . sizeDiff . width ) ,
704
+ hoset = Math . abs ( ( that . _helper ? that . offset . top - cop . top : ( that . offset . top - co . top ) ) + that . sizeDiff . height ) ;
705
705
706
- var isParent = self . containerElement . get ( 0 ) == self . element . parent ( ) . get ( 0 ) ,
707
- isOffsetRelative = / r e l a t i v e | a b s o l u t e / . test ( self . containerElement . css ( 'position' ) ) ;
706
+ var isParent = that . containerElement . get ( 0 ) == that . element . parent ( ) . get ( 0 ) ,
707
+ isOffsetRelative = / r e l a t i v e | a b s o l u t e / . test ( that . containerElement . css ( 'position' ) ) ;
708
708
709
- if ( isParent && isOffsetRelative ) woset -= self . parentData . left ;
709
+ if ( isParent && isOffsetRelative ) woset -= that . parentData . left ;
710
710
711
- if ( woset + self . size . width >= self . parentData . width ) {
712
- self . size . width = self . parentData . width - woset ;
713
- if ( pRatio ) self . size . height = self . size . width / self . aspectRatio ;
711
+ if ( woset + that . size . width >= that . parentData . width ) {
712
+ that . size . width = that . parentData . width - woset ;
713
+ if ( pRatio ) that . size . height = that . size . width / that . aspectRatio ;
714
714
}
715
715
716
- if ( hoset + self . size . height >= self . parentData . height ) {
717
- self . size . height = self . parentData . height - hoset ;
718
- if ( pRatio ) self . size . width = self . size . height * self . aspectRatio ;
716
+ if ( hoset + that . size . height >= that . parentData . height ) {
717
+ that . size . height = that . parentData . height - hoset ;
718
+ if ( pRatio ) that . size . width = that . size . height * that . aspectRatio ;
719
719
}
720
720
} ,
721
721
722
722
stop : function ( event , ui ) {
723
- var self = $ ( this ) . data ( "resizable" ) , o = self . options , cp = self . position ,
724
- co = self . containerOffset , cop = self . containerPosition , ce = self . containerElement ;
723
+ var that = $ ( this ) . data ( "resizable" ) , o = that . options , cp = that . position ,
724
+ co = that . containerOffset , cop = that . containerPosition , ce = that . containerElement ;
725
725
726
- var helper = $ ( self . helper ) , ho = helper . offset ( ) , w = helper . outerWidth ( ) - self . sizeDiff . width , h = helper . outerHeight ( ) - self . sizeDiff . height ;
726
+ var helper = $ ( that . helper ) , ho = helper . offset ( ) , w = helper . outerWidth ( ) - that . sizeDiff . width , h = helper . outerHeight ( ) - that . sizeDiff . height ;
727
727
728
- if ( self . _helper && ! o . animate && ( / r e l a t i v e / ) . test ( ce . css ( 'position' ) ) )
728
+ if ( that . _helper && ! o . animate && ( / r e l a t i v e / ) . test ( ce . css ( 'position' ) ) )
729
729
$ ( this ) . css ( { left : ho . left - cop . left - co . left , width : w , height : h } ) ;
730
730
731
- if ( self . _helper && ! o . animate && ( / s t a t i c / ) . test ( ce . css ( 'position' ) ) )
731
+ if ( that . _helper && ! o . animate && ( / s t a t i c / ) . test ( ce . css ( 'position' ) ) )
732
732
$ ( this ) . css ( { left : ho . left - cop . left - co . left , width : w , height : h } ) ;
733
733
734
734
}
@@ -738,56 +738,56 @@ $.ui.plugin.add("resizable", "ghost", {
738
738
739
739
start : function ( event , ui ) {
740
740
741
- var self = $ ( this ) . data ( "resizable" ) , o = self . options , cs = self . size ;
741
+ var that = $ ( this ) . data ( "resizable" ) , o = that . options , cs = that . size ;
742
742
743
- self . ghost = self . originalElement . clone ( ) ;
744
- self . ghost
743
+ that . ghost = that . originalElement . clone ( ) ;
744
+ that . ghost
745
745
. css ( { opacity : .25 , display : 'block' , position : 'relative' , height : cs . height , width : cs . width , margin : 0 , left : 0 , top : 0 } )
746
746
. addClass ( 'ui-resizable-ghost' )
747
747
. addClass ( typeof o . ghost == 'string' ? o . ghost : '' ) ;
748
748
749
- self . ghost . appendTo ( self . helper ) ;
749
+ that . ghost . appendTo ( that . helper ) ;
750
750
751
751
} ,
752
752
753
753
resize : function ( event , ui ) {
754
- var self = $ ( this ) . data ( "resizable" ) , o = self . options ;
755
- if ( self . ghost ) self . ghost . css ( { position : 'relative' , height : self . size . height , width : self . size . width } ) ;
754
+ var that = $ ( this ) . data ( "resizable" ) , o = that . options ;
755
+ if ( that . ghost ) that . ghost . css ( { position : 'relative' , height : that . size . height , width : that . size . width } ) ;
756
756
} ,
757
757
758
758
stop : function ( event , ui ) {
759
- var self = $ ( this ) . data ( "resizable" ) , o = self . options ;
760
- if ( self . ghost && self . helper ) self . helper . get ( 0 ) . removeChild ( self . ghost . get ( 0 ) ) ;
759
+ var that = $ ( this ) . data ( "resizable" ) , o = that . options ;
760
+ if ( that . ghost && that . helper ) that . helper . get ( 0 ) . removeChild ( that . ghost . get ( 0 ) ) ;
761
761
}
762
762
763
763
} ) ;
764
764
765
765
$ . ui . plugin . add ( "resizable" , "grid" , {
766
766
767
767
resize : function ( event , ui ) {
768
- var self = $ ( this ) . data ( "resizable" ) , o = self . options , cs = self . size , os = self . originalSize , op = self . originalPosition , a = self . axis , ratio = o . _aspectRatio || event . shiftKey ;
768
+ var that = $ ( this ) . data ( "resizable" ) , o = that . options , cs = that . size , os = that . originalSize , op = that . originalPosition , a = that . axis , ratio = o . _aspectRatio || event . shiftKey ;
769
769
o . grid = typeof o . grid == "number" ? [ o . grid , o . grid ] : o . grid ;
770
770
var ox = Math . round ( ( cs . width - os . width ) / ( o . grid [ 0 ] || 1 ) ) * ( o . grid [ 0 ] || 1 ) , oy = Math . round ( ( cs . height - os . height ) / ( o . grid [ 1 ] || 1 ) ) * ( o . grid [ 1 ] || 1 ) ;
771
771
772
772
if ( / ^ ( s e | s | e ) $ / . test ( a ) ) {
773
- self . size . width = os . width + ox ;
774
- self . size . height = os . height + oy ;
773
+ that . size . width = os . width + ox ;
774
+ that . size . height = os . height + oy ;
775
775
}
776
776
else if ( / ^ ( n e ) $ / . test ( a ) ) {
777
- self . size . width = os . width + ox ;
778
- self . size . height = os . height + oy ;
779
- self . position . top = op . top - oy ;
777
+ that . size . width = os . width + ox ;
778
+ that . size . height = os . height + oy ;
779
+ that . position . top = op . top - oy ;
780
780
}
781
781
else if ( / ^ ( s w ) $ / . test ( a ) ) {
782
- self . size . width = os . width + ox ;
783
- self . size . height = os . height + oy ;
784
- self . position . left = op . left - ox ;
782
+ that . size . width = os . width + ox ;
783
+ that . size . height = os . height + oy ;
784
+ that . position . left = op . left - ox ;
785
785
}
786
786
else {
787
- self . size . width = os . width + ox ;
788
- self . size . height = os . height + oy ;
789
- self . position . top = op . top - oy ;
790
- self . position . left = op . left - ox ;
787
+ that . size . width = os . width + ox ;
788
+ that . size . height = os . height + oy ;
789
+ that . position . top = op . top - oy ;
790
+ that . position . left = op . left - ox ;
791
791
}
792
792
}
793
793
0 commit comments