Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix: zero UIRect size when fill anchors collapse at slider minimum

esengine4cd05001bbd1
diff --git a/sdk/src/ui/uiHelpers.ts b/sdk/src/ui/uiHelpers.ts
index 596f4c313..04787f1fb 100644
--- a/sdk/src/ui/uiHelpers.ts
+++ b/sdk/src/ui/uiHelpers.ts
@@ -97,6 +97,12 @@ export function applyDirectionalFill(
fillRect.anchorMax = anchors.anchorMax;
fillRect.offsetMin = anchors.offsetMin;
fillRect.offsetMax = anchors.offsetMax;
+ if (anchors.anchorMin.x === anchors.anchorMax.x) {
+ fillRect.size = { ...fillRect.size, x: 0 };
+ }
+ if (anchors.anchorMin.y === anchors.anchorMax.y) {
+ fillRect.size = { ...fillRect.size, y: 0 };
+ }
world.insert(fillEntity, UIRect, fillRect);
}