diff --git a/src/ui/move-info-overlay.ts b/src/ui/move-info-overlay.ts index 9726f9c5ae3..e8bc561026e 100644 --- a/src/ui/move-info-overlay.ts +++ b/src/ui/move-info-overlay.ts @@ -77,7 +77,7 @@ export class MoveInfoOverlay extends Phaser.GameObjects.Container implements Inf TextStyle.BATTLE_INFO, !options?.hideBg, ); - this.desc.createMask(globalScene, this.x, this.y); + this.desc.createMask(globalScene, this.x + this.desc.x, this.y + this.desc.y); this.add(this.desc); // prepare the effect box diff --git a/src/ui/pokedex-info-overlay.ts b/src/ui/pokedex-info-overlay.ts index 9bfb531a060..8f6d5398cb6 100644 --- a/src/ui/pokedex-info-overlay.ts +++ b/src/ui/pokedex-info-overlay.ts @@ -55,7 +55,7 @@ export class PokedexInfoOverlay extends Phaser.GameObjects.Container implements TextStyle.BATTLE_INFO, true, ); - this.desc.createMask(globalScene, this.x, this.y); + this.desc.createMask(globalScene, this.x + this.desc.x, this.y + this.desc.y); this.add(this.desc); // hide this component for now diff --git a/src/ui/scrolling-text.ts b/src/ui/scrolling-text.ts index a76530ae7c5..16f8dedadea 100644 --- a/src/ui/scrolling-text.ts +++ b/src/ui/scrolling-text.ts @@ -10,7 +10,7 @@ This takes various coordinates: - The x and y coordinates relative to the parent container, this is typical behavior for Phaser.GameObjects.Container. - The width and height of the box; these are needed to create the background. The mask is not created right away (although this is possible in principle). Instead, we have a separate function, -which takes as input the _global_ coordinates of the parent. This is necessary to correctly position the mask in the scene. +which takes as input the _global_ coordinates of scrolling text object. This is necessary to correctly position the mask in the scene. */ const BORDER = 8; @@ -61,12 +61,10 @@ export default class ScrollingText extends Phaser.GameObjects.Container { this.add(this.text); } - createMask(scene: Phaser.Scene, parentX: number, parentY: number) { + createMask(scene: Phaser.Scene, globalX: number, globalY: number) { // Adding the mask for the scrolling effect - const visibleX = parentX < 0 ? parentX + globalScene.scaledCanvas.width : parentX; - const visibleY = parentY < 0 ? parentY + globalScene.scaledCanvas.height : parentY; - const globalMaskX = visibleX + this.x + this.offsetX; - const globalMaskY = visibleY + this.y + this.offsetY; + const globalMaskX = globalX + this.offsetX; + const globalMaskY = globalY + this.offsetY; const visibleWidth = this.descBg.width - (this.offsetX - 2) * 2; const visibleHeight = this.descBg.height - this.offsetY * 2; diff --git a/src/ui/summary-ui-handler.ts b/src/ui/summary-ui-handler.ts index 689f691f62b..31549efc4c6 100644 --- a/src/ui/summary-ui-handler.ts +++ b/src/ui/summary-ui-handler.ts @@ -919,7 +919,7 @@ export class SummaryUiHandler extends UiHandler { abilityInfo.ability?.description!, // initial content TextStyle.WINDOW_ALT, ); - abilityInfo.description.createMask(globalScene, 110 - 7, 90.5 - 71); + abilityInfo.description.createMask(globalScene, 110, 90.5); profileContainer.add(abilityInfo.description); abilityInfo.description.activate(); @@ -1161,7 +1161,7 @@ export class SummaryUiHandler extends UiHandler { "", // initial content TextStyle.WINDOW_ALT, ); - this.moveDescription.createMask(globalScene, 112 - 2, 130 - 84); + this.moveDescription.createMask(globalScene, 112, 130); this.movesContainer.add(this.moveDescription); break; }