diff --git a/src/frontend/src/ScreenElements/Button.ts b/src/frontend/src/ScreenElements/Button.ts index 495e519..7ad1a5a 100644 --- a/src/frontend/src/ScreenElements/Button.ts +++ b/src/frontend/src/ScreenElements/Button.ts @@ -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,