From 79b5e68c260929d025e230c92b56efa3e66f2052 Mon Sep 17 00:00:00 2001 From: Erik Onarheim Date: Sun, 28 Jan 2024 21:05:29 -0600 Subject: [PATCH] fix: issue with *AndFill suffixed [[DisplayModes]]s where content area offset was not accounted for in world space --- CHANGELOG.md | 1 + src/engine/Screen.ts | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 727900e65..3fa9f654b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -138,6 +138,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Fixed +- Fixed issue with *AndFill suffixed [[DisplayModes]]s where content area offset was not accounted for in world space - Fixed issue where `ex.Sound.getTotalPlaybackDuration()` would crash if not loaded, now logs friendly warning - Fixed issue where an empty constructor on `new ex.Label()` would crash - Fixed issue where pointer events did not work properly when using [[ScreenElement]]s diff --git a/src/engine/Screen.ts b/src/engine/Screen.ts index c905bc81d..89f5bf7c3 100644 --- a/src/engine/Screen.ts +++ b/src/engine/Screen.ts @@ -632,6 +632,9 @@ export class Screen { * @param point Screen coordinate to convert */ public screenToWorldCoordinates(point: Vector): Vector { + // offset by content area + point = point.add(vec(this.contentArea.left, this.contentArea.top)); + // the only difference between screen & world is the camera transform if (this._camera) { return this._camera.inverse.multiply(point);