@@ -53,7 +53,6 @@ $.widget("ui.resizable", $.ui.mouse, {
53
53
54
54
_hasScroll : function ( el , a ) {
55
55
56
- //If overflow is hidden, the element might have extra content, but the user wants to hide it
57
56
if ( $ ( el ) . css ( "overflow" ) === "hidden" ) {
58
57
return false ;
59
58
}
@@ -89,10 +88,9 @@ $.widget("ui.resizable", $.ui.mouse, {
89
88
_helper : o . helper || o . ghost || o . animate ? o . helper || "ui-resizable-helper" : null
90
89
} ) ;
91
90
92
- //Wrap the element if it cannot hold child nodes
91
+ // Wrap the element if it cannot hold child nodes
93
92
if ( this . element [ 0 ] . nodeName . match ( / c a n v a s | t e x t a r e a | i n p u t | s e l e c t | b u t t o n | i m g / i) ) {
94
93
95
- //Create a wrapper element and set the wrapper to the new current internal element
96
94
this . element . wrap (
97
95
$ ( "<div class='ui-wrapper' style='overflow: hidden;'></div>" ) . css ( {
98
96
position : this . element . css ( "position" ) ,
@@ -103,30 +101,26 @@ $.widget("ui.resizable", $.ui.mouse, {
103
101
} )
104
102
) ;
105
103
106
- //Overwrite the original this.element
107
104
this . element = this . element . parent ( ) . data (
108
105
"ui-resizable" , this . element . resizable ( "instance" )
109
106
) ;
110
107
111
108
this . elementIsWrapper = true ;
112
109
113
- //Move margins to the wrapper
114
110
this . element . css ( { marginLeft : this . originalElement . css ( "marginLeft" ) , marginTop : this . originalElement . css ( "marginTop" ) , marginRight : this . originalElement . css ( "marginRight" ) , marginBottom : this . originalElement . css ( "marginBottom" ) } ) ;
115
111
this . originalElement . css ( { marginLeft : 0 , marginTop : 0 , marginRight : 0 , marginBottom : 0 } ) ;
116
-
117
- //Prevent Safari textarea resize
112
+ // support: Safari
113
+ // Prevent Safari textarea resize
118
114
this . originalResizeStyle = this . originalElement . css ( "resize" ) ;
119
115
this . originalElement . css ( "resize" , "none" ) ;
120
116
121
- //Push the actual element to our proportionallyResize internal array
122
117
this . _proportionallyResizeElements . push ( this . originalElement . css ( { position : "static" , zoom : 1 , display : "block" } ) ) ;
123
118
119
+ // support: IE9
124
120
// avoid IE jump (hard set the margin)
125
121
this . originalElement . css ( { margin : this . originalElement . css ( "margin" ) } ) ;
126
122
127
- // fix handlers offset
128
123
this . _proportionallyResize ( ) ;
129
-
130
124
}
131
125
132
126
this . handles = o . handles || ( ! $ ( ".ui-resizable-handle" , this . element ) . length ? "e,s,se" : { n : ".ui-resizable-n" , e : ".ui-resizable-e" , s : ".ui-resizable-s" , w : ".ui-resizable-w" , se : ".ui-resizable-se" , sw : ".ui-resizable-sw" , ne : ".ui-resizable-ne" , nw : ".ui-resizable-nw" } ) ;
@@ -145,15 +139,13 @@ $.widget("ui.resizable", $.ui.mouse, {
145
139
hname = "ui-resizable-" + handle ;
146
140
axis = $ ( "<div class='ui-resizable-handle " + hname + "'></div>" ) ;
147
141
148
- // Apply zIndex to all handles - see #7960
149
142
axis . css ( { zIndex : o . zIndex } ) ;
150
143
151
- //TODO : What's going on here?
144
+ // TODO : What's going on here?
152
145
if ( "se" === handle ) {
153
146
axis . addClass ( "ui-icon ui-icon-gripsmall-diagonal-se" ) ;
154
147
}
155
148
156
- //Insert into internal handles object and append to element
157
149
this . handles [ handle ] = ".ui-resizable-" + handle ;
158
150
this . element . append ( axis ) ;
159
151
}
@@ -172,15 +164,12 @@ $.widget("ui.resizable", $.ui.mouse, {
172
164
this . handles [ i ] = this . element . children ( this . handles [ i ] ) . first ( ) . show ( ) ;
173
165
}
174
166
175
- //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
176
167
if ( this . elementIsWrapper && this . originalElement [ 0 ] . nodeName . match ( / t e x t a r e a | i n p u t | s e l e c t | b u t t o n / i) ) {
177
168
178
169
axis = $ ( this . handles [ i ] , this . element ) ;
179
170
180
- //Checking the correct pad and border
181
171
padWrapper = / s w | n e | n w | s e | n | s / . test ( i ) ? axis . outerHeight ( ) : axis . outerWidth ( ) ;
182
172
183
- //The padding type i have to apply...
184
173
padPos = [ "padding" ,
185
174
/ n e | n w | n / . test ( i ) ? "Top" :
186
175
/ s e | s w | s / . test ( i ) ? "Bottom" :
@@ -192,31 +181,28 @@ $.widget("ui.resizable", $.ui.mouse, {
192
181
193
182
}
194
183
195
- //TODO: What's that good for? There's not anything to be executed left
184
+ // TODO: What's that good for? There's not anything to be executed left
196
185
if ( ! $ ( this . handles [ i ] ) . length ) {
197
186
continue ;
198
187
}
199
188
}
200
189
} ;
201
190
202
- //TODO: make renderAxis a prototype function
191
+ // TODO: make renderAxis a prototype function
203
192
this . _renderAxis ( this . element ) ;
204
193
205
194
this . _handles = $ ( ".ui-resizable-handle" , this . element )
206
195
. disableSelection ( ) ;
207
196
208
- //Matching axis name
209
197
this . _handles . mouseover ( function ( ) {
210
198
if ( ! that . resizing ) {
211
199
if ( this . className ) {
212
200
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) ;
213
201
}
214
- //Axis, default = se
215
202
that . axis = axis && axis [ 1 ] ? axis [ 1 ] : "se" ;
216
203
}
217
204
} ) ;
218
205
219
- //If we want to auto hide the elements
220
206
if ( o . autoHide ) {
221
207
this . _handles . hide ( ) ;
222
208
$ ( this . element )
@@ -239,7 +225,6 @@ $.widget("ui.resizable", $.ui.mouse, {
239
225
} ) ;
240
226
}
241
227
242
- //Initialize the mouse interaction
243
228
this . _mouseInit ( ) ;
244
229
245
230
} ,
@@ -254,7 +239,7 @@ $.widget("ui.resizable", $.ui.mouse, {
254
239
. removeData ( "resizable" ) . removeData ( "ui-resizable" ) . unbind ( ".resizable" ) . find ( ".ui-resizable-handle" ) . remove ( ) ;
255
240
} ;
256
241
257
- //TODO: Unwrap at same DOM position
242
+ // TODO: Unwrap at same DOM position
258
243
if ( this . elementIsWrapper ) {
259
244
_destroy ( this . element ) ;
260
245
wrapper = this . element ;
@@ -297,7 +282,7 @@ $.widget("ui.resizable", $.ui.mouse, {
297
282
298
283
this . resizing = true ;
299
284
300
- // bugfix for http://dev.jquery .com/ticket/1749
285
+ // Bugfix for http://bugs.jqueryui .com/ticket/1749
301
286
if ( ( / a b s o l u t e / ) . test ( el . css ( "position" ) ) ) {
302
287
el . css ( { position : "absolute" , top : el . css ( "top" ) , left : el . css ( "left" ) } ) ;
303
288
} else if ( el . is ( ".ui-draggable" ) ) {
@@ -314,7 +299,6 @@ $.widget("ui.resizable", $.ui.mouse, {
314
299
curtop += $ ( o . containment ) . scrollTop ( ) || 0 ;
315
300
}
316
301
317
- //Store needed variables
318
302
this . offset = this . helper . offset ( ) ;
319
303
this . position = { left : curleft , top : curtop } ;
320
304
this . size = this . _helper ? { width : this . helper . width ( ) , height : this . helper . height ( ) } : { width : el . width ( ) , height : el . height ( ) } ;
@@ -323,7 +307,6 @@ $.widget("ui.resizable", $.ui.mouse, {
323
307
this . sizeDiff = { width : el . outerWidth ( ) - el . width ( ) , height : el . outerHeight ( ) - el . height ( ) } ;
324
308
this . originalMousePosition = { left : event . pageX , top : event . pageY } ;
325
309
326
- //Aspect Ratio
327
310
this . aspectRatio = ( typeof o . aspectRatio === "number" ) ? o . aspectRatio : ( ( this . originalSize . width / this . originalSize . height ) || 1 ) ;
328
311
329
312
cursor = $ ( ".ui-resizable-" + this . axis ) . css ( "cursor" ) ;
@@ -336,7 +319,6 @@ $.widget("ui.resizable", $.ui.mouse, {
336
319
337
320
_mouseDrag : function ( event ) {
338
321
339
- //Increase performance, avoid regex
340
322
var data ,
341
323
el = this . helper , props = { } ,
342
324
smp = this . originalMousePosition ,
@@ -358,10 +340,8 @@ $.widget("ui.resizable", $.ui.mouse, {
358
340
return false ;
359
341
}
360
342
361
- // Calculate the attrs that will be change
362
343
data = trigger . apply ( this , [ event , dx , dy ] ) ;
363
344
364
- // Put this in the mouseDrag handler since the user can start pressing shift while resizing
365
345
this . _updateVirtualBoundaries ( event . shiftKey ) ;
366
346
if ( this . _aspectRatio || event . shiftKey ) {
367
347
data = this . _updateRatio ( data , event ) ;
@@ -371,7 +351,6 @@ $.widget("ui.resizable", $.ui.mouse, {
371
351
372
352
this . _updateCache ( data ) ;
373
353
374
- // plugins callbacks need to be called first
375
354
this . _propagate ( "resize" , event ) ;
376
355
377
356
if ( this . position . top !== this . prevPosition . top ) {
@@ -386,15 +365,14 @@ $.widget("ui.resizable", $.ui.mouse, {
386
365
if ( this . size . height !== this . prevSize . height ) {
387
366
props . height = this . size . height + "px" ;
388
367
}
389
- el . css ( props ) ;
368
+ el . css ( props ) ;
390
369
391
- if ( ! this . _helper && this . _proportionallyResizeElements . length ) {
370
+ if ( ! this . _helper && this . _proportionallyResizeElements . length ) {
392
371
this . _proportionallyResize ( ) ;
393
372
}
394
373
395
- // Call the user callback if the element was resized
396
- if ( ! $ . isEmptyObject ( props ) ) {
397
- this . _trigger ( "resize" , event , this . ui ( ) ) ;
374
+ if ( ! $ . isEmptyObject ( props ) ) {
375
+ this . _trigger ( "resize" , event , this . ui ( ) ) ;
398
376
}
399
377
400
378
return false ;
@@ -455,8 +433,6 @@ $.widget("ui.resizable", $.ui.mouse, {
455
433
} ;
456
434
457
435
if ( this . _aspectRatio || forceAspectRatio ) {
458
- // We want to create an enclosing box whose aspect ration is the requested one
459
- // First, compute the "projected" size for each dimension based on the aspect ratio and other dimension
460
436
pMinWidth = b . minHeight * this . aspectRatio ;
461
437
pMinHeight = b . minWidth / this . aspectRatio ;
462
438
pMaxWidth = b . maxHeight * this . aspectRatio ;
@@ -553,7 +529,7 @@ $.widget("ui.resizable", $.ui.mouse, {
553
529
data . top = dh - o . maxHeight ;
554
530
}
555
531
556
- // fixing jump error on top/left - bug #2330
532
+ // Fixing jump error on top/left - bug #2330
557
533
if ( ! data . width && ! data . height && ! data . left && data . top ) {
558
534
data . top = null ;
559
535
} else if ( ! data . width && ! data . height && ! data . top && data . left ) {
@@ -753,10 +729,7 @@ $.ui.plugin.add( "resizable", "containment", {
753
729
width : $ ( document ) . width ( ) ,
754
730
height : $ ( document ) . height ( ) || document . body . parentNode . scrollHeight
755
731
} ;
756
- }
757
-
758
- // i'm a node, so compute top, left, right, bottom
759
- else {
732
+ } else {
760
733
element = $ ( ce ) ;
761
734
p = [ ] ;
762
735
$ ( [ "Top" , "Right" , "Left" , "Bottom" ] ) . each ( function ( i , name ) {
0 commit comments