From cceffc183212d6ebb6e392ae3b7897d5da0aa901 Mon Sep 17 00:00:00 2001 From: Exund Date: Mon, 21 Sep 2020 18:16:36 +0200 Subject: [PATCH] Fix camera pan (#673) * Fix some literal edge cases * Fixed for fullscreen --- src/js/game/camera.js | 12 ++++++++---- src/js/game/hud/parts/shape_viewer.js | 4 ++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/js/game/camera.js b/src/js/game/camera.js index 2be175b4..ce722343 100644 --- a/src/js/game/camera.js +++ b/src/js/game/camera.js @@ -862,6 +862,10 @@ export class Camera extends BasicSerializableObject { * @param {number} dt */ internalUpdateMousePanning(now, dt) { + if (!this.root.app.focused) { + return; + } + if (!this.root.app.settings.getAllSettings().enableMousePan) { // Not enabled return; @@ -882,10 +886,10 @@ export class Camera extends BasicSerializableObject { } if ( - mousePos.x < 0 || - mousePos.y < 0 || - mousePos.x > this.root.gameWidth || - mousePos.y > this.root.gameHeight + mousePos.x <= 0 || + mousePos.y <= 0 || + mousePos.x >= this.root.gameWidth || + mousePos.y >= this.root.gameHeight ) { // Out of screen return; diff --git a/src/js/game/hud/parts/shape_viewer.js b/src/js/game/hud/parts/shape_viewer.js index ea4273aa..18f55c74 100644 --- a/src/js/game/hud/parts/shape_viewer.js +++ b/src/js/game/hud/parts/shape_viewer.js @@ -48,6 +48,10 @@ export class HUDShapeViewer extends BaseHUDPart { this.close(); } + isBlockingOverlay() { + return this.visible; + } + /** * Called when the copying of a key was requested */