]> source.dussan.org Git - jquery-ui.git/commitdiff
Resizable: Store size based on calculated helper size to prevent 1 pixel shifts....
authorKris Borchers <kris.borchers@gmail.com>
Wed, 16 Oct 2013 02:40:49 +0000 (21:40 -0500)
committerScott González <scott.gonzalez@gmail.com>
Tue, 26 Nov 2013 20:27:23 +0000 (15:27 -0500)
(cherry picked from commit 14065dc23bb453b6c30138f225c9db728dd7e455)

tests/unit/resizable/resizable_core.js
ui/jquery.ui.resizable.js

index 4cffea185d0b65d37731a64f73022fc5e41bee65..b02e8b4f183ccdbb29ecfb5292049213eb35762c 100644 (file)
@@ -191,4 +191,19 @@ test("resizable accounts for scroll position correctly (#3815)", function() {
        equal( el.css("top"), top, "css('top') stays the same when resized" );
 });
 
+test( "resizable stores correct size when using helper and grid (#9547)", function() {
+       expect( 2 );
+
+       var handle = ".ui-resizable-se",
+               target = $( "#resizable1" ).resizable({
+                       handles: "all",
+                       helper: "ui-resizable-helper",
+                       grid: [ 10, 10 ]
+               });
+
+       TestHelpers.resizable.drag( handle, 1, 1 );
+       equal( target.width(), 100, "compare width" );
+       equal( target.height(), 100, "compare height" );
+});
+
 })(jQuery);
index ac1fceaec5df197f75515bbaacc3c13c6f3eaada..a85577f77cd39d65d508e2d1c4e943bb39336347 100644 (file)
@@ -293,7 +293,7 @@ $.widget("ui.resizable", $.ui.mouse, {
                //Store needed variables
                this.offset = this.helper.offset();
                this.position = { left: curleft, top: curtop };
-               this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
+               this.size = this._helper ? { width: this.helper.width(), height: this.helper.height() } : { width: el.width(), height: el.height() };
                this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
                this.originalPosition = { left: curleft, top: curtop };
                this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };