fix(button): pointer collider box after resize (#50)

This commit is contained in:
lucas authored and GitHub committed 2026-06-22 20:55:30 +02:00
1 parent c0a88d5137
commit d9225b9ad0
1 file changed
+10
+10
View File
@@ -39,6 +39,16 @@ export class Button extends ex.ScreenElement {
onInitialize(_engine: ex.Engine): void {
const { height, width } = this;
// Annoying Excalibur bug. It queries the graphics hash grid with worldPos, but ScreenElement transforms
// are in screen space. Setting localBounds activates the path that correctly uses screenPos.
this.pointer.useGraphicsBounds = false;
this.pointer.localBounds = new ex.BoundingBox({
left: -width / 2,
top: 0,
right: width / 2,
bottom: height,
});
this._textElement = new Text({
text: this._text,
font: paragraphFont,