From 5101f17d7c311594fc9ae83f4bc0a4dc157fc081 Mon Sep 17 00:00:00 2001 From: mcanepa Date: Tue, 9 Nov 2021 13:22:35 -0300 Subject: [PATCH 1/6] Resizable: Fix issue with border-box --- ui/widgets/resizable.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ui/widgets/resizable.js b/ui/widgets/resizable.js index 13e98c6588d..be7a65db801 100644 --- a/ui/widgets/resizable.js +++ b/ui/widgets/resizable.js @@ -533,15 +533,18 @@ $.widget( "ui.resizable", $.ui.mouse, { if ( this.position.left !== this.prevPosition.left ) { props.left = this.position.left + "px"; } + + this.helper.css( props ); + if ( this.size.width !== this.prevSize.width ) { props.width = this.size.width + "px"; + this.helper.width(this.size.width); } if ( this.size.height !== this.prevSize.height ) { props.height = this.size.height + "px"; + this.helper.height(this.size.height); } - this.helper.css( props ); - return props; }, @@ -1048,7 +1051,7 @@ $.ui.plugin.add( "resizable", "alsoResize", { $( o.alsoResize ).each( function() { var el = $( this ); el.data( "ui-resizable-alsoresize", { - width: parseFloat( el.width() ), height: parseFloat( el.height() ), + width: parseFloat( el.css( "width" ) ), height: parseFloat(el.css( "height ") ), left: parseFloat( el.css( "left" ) ), top: parseFloat( el.css( "top" ) ) } ); } ); From 93f648cf51448e4e3386a74829652928735fcb08 Mon Sep 17 00:00:00 2001 From: mcanepa Date: Thu, 2 Dec 2021 19:21:50 -0300 Subject: [PATCH 2/6] fix asciilint test --- ui/widgets/resizable.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/widgets/resizable.js b/ui/widgets/resizable.js index be7a65db801..28e931dd0a7 100644 --- a/ui/widgets/resizable.js +++ b/ui/widgets/resizable.js @@ -538,11 +538,11 @@ $.widget( "ui.resizable", $.ui.mouse, { if ( this.size.width !== this.prevSize.width ) { props.width = this.size.width + "px"; - this.helper.width(this.size.width); + this.helper.width( this.size.width ); } if ( this.size.height !== this.prevSize.height ) { props.height = this.size.height + "px"; - this.helper.height(this.size.height); + this.helper.height( this.size.height ); } return props; @@ -1051,7 +1051,7 @@ $.ui.plugin.add( "resizable", "alsoResize", { $( o.alsoResize ).each( function() { var el = $( this ); el.data( "ui-resizable-alsoresize", { - width: parseFloat( el.css( "width" ) ), height: parseFloat(el.css( "height ") ), + width: parseFloat( el.css( "width" ) ), height: parseFloat( el.css( "height" ) ), left: parseFloat( el.css( "left" ) ), top: parseFloat( el.css( "top" ) ) } ); } ); From 96562003a1bab1d56311ef5a51d38d04b080f1ce Mon Sep 17 00:00:00 2001 From: mcanepa Date: Sun, 30 Jan 2022 04:58:16 -0300 Subject: [PATCH 3/6] unit test for PR 2012 --- tests/unit/resizable/options.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/unit/resizable/options.js b/tests/unit/resizable/options.js index d8584056202..08c9320249c 100644 --- a/tests/unit/resizable/options.js +++ b/tests/unit/resizable/options.js @@ -532,4 +532,30 @@ QUnit.test( "alsoResize + multiple selection", function( assert ) { assert.equal( other2.height(), 150, "alsoResize o2 constrained height at containment edge" ); } ); +QUnit.test( "alsoResize with box-sizing: border-box", function( assert ) { + assert.expect( 4 ); + + var other = $( "
" ) + .css( { + width: 50, + height: 50, + padding: 10, + border: 5 + } ) + .appendTo( "body" ), + element = $( "#resizable1" ).resizable( { + alsoResize: other + } ), + handle = ".ui-resizable-se"; + + $("*").css("box-sizing", "border-box"); + + testHelper.drag( handle, 80, 80 ); + + assert.equal( element.width(), 180, "resizable width" ); + assert.equal( parseFloat( other.css( "width" ) ), 130, "alsoResize width" ); + assert.equal( element.height(), 180, "resizable height" ); + assert.equal( parseFloat( other.css( "height" ) ), 130, "alsoResize height" ); +} ); + } ); From 264f4347de96576e27fb5c35ff5cc6f75bddf6c1 Mon Sep 17 00:00:00 2001 From: mcanepa Date: Sun, 30 Jan 2022 05:13:44 -0300 Subject: [PATCH 4/6] fixed lint --- tests/unit/resizable/options.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/resizable/options.js b/tests/unit/resizable/options.js index 08c9320249c..6149fbfefc9 100644 --- a/tests/unit/resizable/options.js +++ b/tests/unit/resizable/options.js @@ -548,7 +548,7 @@ QUnit.test( "alsoResize with box-sizing: border-box", function( assert ) { } ), handle = ".ui-resizable-se"; - $("*").css("box-sizing", "border-box"); + $( "*" ).css( "box-sizing", "border-box" ); testHelper.drag( handle, 80, 80 ); From 9019f294e4d52fcb3ada5fed8a0c594c72930c87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20C=C3=A1nepa?= Date: Wed, 5 Oct 2022 09:47:50 -0300 Subject: [PATCH 5/6] Update ui/widgets/resizable.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Michał Gołębiowski-Owczarek --- ui/widgets/resizable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/widgets/resizable.js b/ui/widgets/resizable.js index 80bd1ffefc3..0eee37e6a7d 100644 --- a/ui/widgets/resizable.js +++ b/ui/widgets/resizable.js @@ -538,7 +538,7 @@ $.widget( "ui.resizable", $.ui.mouse, { if ( this.size.width !== this.prevSize.width ) { props.width = this.size.width + "px"; - this.helper.width( this.size.width ); + this.helper.width( props.width ); } if ( this.size.height !== this.prevSize.height ) { props.height = this.size.height + "px"; From 76e047673242a4f4a1ed24e69cd2f8a3f0b63236 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20C=C3=A1nepa?= Date: Wed, 5 Oct 2022 09:48:00 -0300 Subject: [PATCH 6/6] Update ui/widgets/resizable.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Michał Gołębiowski-Owczarek --- ui/widgets/resizable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/widgets/resizable.js b/ui/widgets/resizable.js index 0eee37e6a7d..3f1f19833d8 100644 --- a/ui/widgets/resizable.js +++ b/ui/widgets/resizable.js @@ -542,7 +542,7 @@ $.widget( "ui.resizable", $.ui.mouse, { } if ( this.size.height !== this.prevSize.height ) { props.height = this.size.height + "px"; - this.helper.height( this.size.height ); + this.helper.height( props.height ); } return props;