From 2b5b3bc1ac3677d19826d53a7be242e982adccf0 Mon Sep 17 00:00:00 2001 From: Vinzenz Sinapius Date: Thu, 13 Mar 2025 09:05:53 +0100 Subject: [PATCH] Fix clamp not updating on screen size changes --- src/plugins/Clamp.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/Clamp.ts b/src/plugins/Clamp.ts index 1b38f484..05274d50 100644 --- a/src/plugins/Clamp.ts +++ b/src/plugins/Clamp.ts @@ -89,6 +89,8 @@ export class Clamp extends Plugin y: number | null; scaleX: number | null; scaleY: number | null; + screenWidth: number | null; + screenHeight: number | null; }; protected noUnderflow!: boolean; @@ -124,7 +126,7 @@ export class Clamp extends Plugin } this.parseUnderflow(); - this.last = { x: null, y: null, scaleX: null, scaleY: null }; + this.last = { x: null, y: null, scaleX: null, scaleY: null, screenWidth: null, screenHeight: null }; this.update(); } @@ -179,6 +181,8 @@ export class Clamp extends Plugin && this.parent.y === this.last.y && this.parent.scale.x === this.last.scaleX && this.parent.scale.y === this.last.scaleY + && this.parent.screenWidth === this.last.screenWidth + && this.parent.screenHeight === this.last.screenHeight ) { return; @@ -363,6 +367,8 @@ export class Clamp extends Plugin this.last.y = this.parent.y; this.last.scaleX = this.parent.scale.x; this.last.scaleY = this.parent.scale.y; + this.last.screenWidth = this.parent.screenWidth; + this.last.screenHeight = this.parent.screenHeight; } public reset(): void