Apply ruler offset when determining destination after deleting a waypoint

This commit is contained in:
Manuel Vögele
2021-02-08 11:36:18 +01:00
parent c30ff10364
commit 3d68e324f2
2 changed files with 6 additions and 1 deletions
+3
View File
@@ -2,6 +2,9 @@
### New features ### New features
- Right click and spacebar can now be swapped, allowing to place waypoints with right click and removing them with spacebar - 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 ## v1.1.1
### Bugfixes ### Bugfixes
- Fixed a bug where tokens wouldn't be moved to the corect end position on gridless maps - Fixed a bug where tokens wouldn't be moved to the corect end position on gridless maps
+3 -1
View File
@@ -154,7 +154,9 @@ function onRulerMoveToken(event) {
function deleteWaypoint() { function deleteWaypoint() {
if (canvas.controls.ruler.waypoints.length > 1) { 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}) game.user.broadcastActivity({ruler: canvas.controls.ruler})
} }
else { else {