From 3d68e324f2c48c3463be5918cda9c90c372f7554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Mon, 8 Feb 2021 11:36:18 +0100 Subject: [PATCH] Apply ruler offset when determining destination after deleting a waypoint --- CHANGELOG.md | 3 +++ src/main.js | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb6e2d5..4092def 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ### New features - Right click and spacebar can now be swapped, allowing to place waypoints with right click and removing them with spacebar +### Bugfixes +- Fixed a bug where the ruler would sometimes jump to a different target location when deleting a waypoint + ## v1.1.1 ### Bugfixes - Fixed a bug where tokens wouldn't be moved to the corect end position on gridless maps diff --git a/src/main.js b/src/main.js index 8853d7b..880f0a4 100644 --- a/src/main.js +++ b/src/main.js @@ -154,7 +154,9 @@ function onRulerMoveToken(event) { function deleteWaypoint() { if (canvas.controls.ruler.waypoints.length > 1) { - canvas.controls.ruler._removeWaypoint(canvas.app.renderer.plugins.interaction.mouse.getLocalPosition(canvas.tokens)) + const mousePosition = canvas.app.renderer.plugins.interaction.mouse.getLocalPosition(canvas.tokens) + const rulerOffset = canvas.controls.ruler.rulerOffset + canvas.controls.ruler._removeWaypoint({x: mousePosition.x + rulerOffset.x, y: mousePosition.y + rulerOffset.y}) game.user.broadcastActivity({ruler: canvas.controls.ruler}) } else {