From fa731d682f461ab7e5dd1f94bd7762e18dff0b2d Mon Sep 17 00:00:00 2001 From: Pamela Wolf Date: Mon, 19 Apr 2021 12:53:45 -0700 Subject: [PATCH 1/5] Fix for wrongly rendered GUI rectangle on resize with adaptWidthToChildren --- gui/src/2D/controls/container.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gui/src/2D/controls/container.ts b/gui/src/2D/controls/container.ts index 4107d82d0cc..d258520da5c 100644 --- a/gui/src/2D/controls/container.ts +++ b/gui/src/2D/controls/container.ts @@ -375,6 +375,7 @@ export class Container extends Control { if (this.adaptHeightToChildren && child._height.isPixel) { computedHeight = Math.max(computedHeight, child._currentMeasure.height + child.paddingTopInPixels + child.paddingBottomInPixels); } + this._markAsDirty(); } } @@ -395,6 +396,7 @@ export class Container extends Control { this._postMeasure(); } + rebuildCount++; } while (this._rebuildLayout && rebuildCount < this.maxLayoutCycle); From d30486085a78d27c96e6adf1f676b14afbb4b9a9 Mon Sep 17 00:00:00 2001 From: Pamela Wolf Date: Mon, 19 Apr 2021 12:53:58 -0700 Subject: [PATCH 2/5] what's new --- dist/preview release/what's new.md | 1 + 1 file changed, 1 insertion(+) diff --git a/dist/preview release/what's new.md b/dist/preview release/what's new.md index e8aa7f0e913..2f7be7238e4 100644 --- a/dist/preview release/what's new.md +++ b/dist/preview release/what's new.md @@ -197,6 +197,7 @@ - Fix context lost handling ([#10163](https://github.com/BabylonJS/Babylon.js/issues/10163)) ([Popov72](https://github.com/Popov72)) - Fix for GUI slider step values greater than one ([msDestiny14](https://github.com/msDestiny14)) - Fix Instances wrongly rendered with motion blur ([CraigFeldspar](https://github.com/CraigFeldspar)) +- Fix for wrongly rendered GUI rectangle on resize with adaptWidthToChildren ([msDestiny14](https://github.com/msDestiny14)) ## Breaking changes From 3ae30e160f2b5ea148485ff54976f663bce260c4 Mon Sep 17 00:00:00 2001 From: Pamela Wolf Date: Mon, 19 Apr 2021 13:08:40 -0700 Subject: [PATCH 3/5] spaceing --- gui/src/2D/controls/container.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/gui/src/2D/controls/container.ts b/gui/src/2D/controls/container.ts index d258520da5c..33c29381b42 100644 --- a/gui/src/2D/controls/container.ts +++ b/gui/src/2D/controls/container.ts @@ -396,7 +396,6 @@ export class Container extends Control { this._postMeasure(); } - rebuildCount++; } while (this._rebuildLayout && rebuildCount < this.maxLayoutCycle); From 520d832540e7779df2c8265801d69ff3dc24afa8 Mon Sep 17 00:00:00 2001 From: Pamela Wolf Date: Mon, 19 Apr 2021 15:28:27 -0700 Subject: [PATCH 4/5] edit --- gui/src/2D/controls/container.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gui/src/2D/controls/container.ts b/gui/src/2D/controls/container.ts index 33c29381b42..d656cf9fe84 100644 --- a/gui/src/2D/controls/container.ts +++ b/gui/src/2D/controls/container.ts @@ -371,11 +371,12 @@ export class Container extends Control { if (this.adaptWidthToChildren && child._width.isPixel) { computedWidth = Math.max(computedWidth, child._currentMeasure.width + child.paddingLeftInPixels + child.paddingRightInPixels); + this.parent?._markAsDirty(); } if (this.adaptHeightToChildren && child._height.isPixel) { computedHeight = Math.max(computedHeight, child._currentMeasure.height + child.paddingTopInPixels + child.paddingBottomInPixels); + this.parent?._markAsDirty(); } - this._markAsDirty(); } } From cabbe2aff8d5e8c9412e7c9995686f4bbb5a8671 Mon Sep 17 00:00:00 2001 From: Pamela Wolf Date: Tue, 20 Apr 2021 08:33:13 -0700 Subject: [PATCH 5/5] moving to only occur on change --- gui/src/2D/controls/container.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/src/2D/controls/container.ts b/gui/src/2D/controls/container.ts index d656cf9fe84..f9a0c5cd9c8 100644 --- a/gui/src/2D/controls/container.ts +++ b/gui/src/2D/controls/container.ts @@ -371,11 +371,9 @@ export class Container extends Control { if (this.adaptWidthToChildren && child._width.isPixel) { computedWidth = Math.max(computedWidth, child._currentMeasure.width + child.paddingLeftInPixels + child.paddingRightInPixels); - this.parent?._markAsDirty(); } if (this.adaptHeightToChildren && child._height.isPixel) { computedHeight = Math.max(computedHeight, child._currentMeasure.height + child.paddingTopInPixels + child.paddingBottomInPixels); - this.parent?._markAsDirty(); } } } @@ -383,6 +381,7 @@ export class Container extends Control { if (this.adaptWidthToChildren && computedWidth >= 0) { computedWidth += this.paddingLeftInPixels + this.paddingRightInPixels; if (this.width !== computedWidth + "px") { + this.parent?._markAsDirty(); this.width = computedWidth + "px"; this._rebuildLayout = true; } @@ -390,6 +389,7 @@ export class Container extends Control { if (this.adaptHeightToChildren && computedHeight >= 0) { computedHeight += this.paddingTopInPixels + this.paddingBottomInPixels; if (this.height !== computedHeight + "px") { + this.parent?._markAsDirty(); this.height = computedHeight + "px"; this._rebuildLayout = true; }