Skip to content

Commit beb0ba5

Browse files
committed
Resizeable: avoid braking the size of an image
1 parent ada6080 commit beb0ba5

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

ui/widgets/resizable.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,11 @@ $.widget( "ui.resizable", $.ui.mouse, {
134134
$( "<div class='ui-wrapper'></div>" ).css( {
135135
overflow: "hidden",
136136
position: this.element.css( "position" ),
137-
width: this.element.outerWidth(),
138-
height: this.element.outerHeight(),
139137
top: this.element.css( "top" ),
140138
left: this.element.css( "left" )
141139
} )
140+
.outerWidth( this.element.outerWidth() )
141+
.outerHeight( this.element.outerHeight() )
142142
);
143143

144144
this.element = this.element.parent().data(
@@ -159,7 +159,9 @@ $.widget( "ui.resizable", $.ui.mouse, {
159159
// Support: Safari
160160
// Prevent Safari textarea resize
161161
this.originalResizeStyle = this.originalElement.css( "resize" );
162-
this.originalElement.css( "resize", "none" );
162+
this.originalElement
163+
.css( "resize", "none" )
164+
.css( "margin", 0 );
163165

164166
this._proportionallyResizeElements.push( this.originalElement.css( {
165167
position: "static",
@@ -214,11 +216,12 @@ $.widget( "ui.resizable", $.ui.mouse, {
214216
wrapper = this.element;
215217
this.originalElement.css( {
216218
position: wrapper.css( "position" ),
217-
width: wrapper.outerWidth(),
218-
height: wrapper.outerHeight(),
219219
top: wrapper.css( "top" ),
220220
left: wrapper.css( "left" )
221-
} ).insertAfter( wrapper );
221+
} )
222+
.outerWidth( wrapper.outerWidth() )
223+
.outerHeight( wrapper.outerHeight() )
224+
.insertAfter( wrapper );
222225
wrapper.remove();
223226
}
224227

0 commit comments

Comments
 (0)