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.

docs(ui): the example's lives counter was never under the capsule

esengine3a8de5cf47b4
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 53545912c..4cda6e6a0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -25,10 +25,10 @@ published separately; it ships inside the editor.
- **A UI node can keep clear of WeChat's capsule menu, which the safe area does not cover.**
`SafeArea.avoidHostMenu` pushes the top inset past the host's own overlay. Measured on the
- iPhone 12 the simulator offers, the capsule's bottom edge is 29px *inside* the safe area —
- so a HUD that respects the safe area still sits under it, which is what the space-shooter
- example's lives counter did. No engine offers this: every game converts the rect to layout
- units by hand, which is the arithmetic the safe area already does here.
+ iPhone 12 the simulator offers, the capsule's bottom edge is 29px *inside* the safe area,
+ so a node anchored to the top of the safe area can still be under it. No engine offers
+ this: every game converts the rect to layout units by hand, which is the arithmetic the
+ safe area already does here.
### Fixed
diff --git a/sdk/src/ui/layout/safe-area.ts b/sdk/src/ui/layout/safe-area.ts
index ef60da74c..fff543102 100644
--- a/sdk/src/ui/layout/safe-area.ts
+++ b/sdk/src/ui/layout/safe-area.ts
@@ -25,7 +25,8 @@ export interface SafeAreaData {
/**
* Also clear the host's own overlay — WeChat's capsule menu, which sits
* INSIDE the safe area: measured on an iPhone 12, its bottom is 29px below
- * `safeArea.top`, so a node that respects the safe area is still under it.
+ * `safeArea.top`. Only for a node the overlay actually reaches: this moves
+ * the whole node down, so a HUD already above the capsule ends up on it.
*/
avoidHostMenu: boolean;
}
diff --git a/sdk/tests/safe-area-host-menu.test.ts b/sdk/tests/safe-area-host-menu.test.ts
index 7377fbf69..ed7c3d10c 100644
--- a/sdk/tests/safe-area-host-menu.test.ts
+++ b/sdk/tests/safe-area-host-menu.test.ts
@@ -5,8 +5,8 @@
*
* The capsule menu sits INSIDE the safe area: measured on the iPhone 12 the
* simulator offers, `safeArea.top` is 47 and the capsule's bottom is 76, so a
- * node that respects the safe area is still under the capsule for 29 of its 32
- * pixels — which is what the space-shooter example's lives counter did.
+ * node anchored to the top of the safe area is under the capsule for 29 of its
+ * 32 pixels.
*/
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { App } from '../src/app/app';