From 667259d5d6cf96733fe0c3a664d250f098f69f69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Mon, 19 Apr 2021 11:22:13 +0200 Subject: [PATCH] If a token has no actor, use the user's color for highlighting grid spaces (fixes #58) --- CHANGELOG.md | 6 ++++++ src/main.js | 3 +++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 910775c..ad8cea1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## In development +### Bugfixes +- Drag Ruler no longer prevents tokens that don't have an actor from being moved. ([#58](https://github.com/manuelVo/foundryvtt-drag-ruler/issues/58)) +- Grid highlighting now also works for tokens that don't have an actor. + + ## 1.5.1 ### Bugfixes - The hint that tells users how to enable difficult terrain measurement in Drag Ruler is no longer shown if no terrain layer module is installed. diff --git a/src/main.js b/src/main.js index c3ccad8..a9e9996 100644 --- a/src/main.js +++ b/src/main.js @@ -166,6 +166,9 @@ function onTokenDragLeftCancel(event) { export function getColorForDistance(startDistance, subDistance=0) { if (!this.isDragRuler) return this.color + if (!this.draggedToken.actor) { + return this.color; + } // Don't apply colors if the current user doesn't have at least observer permissions if (this.draggedToken.actor.permission < 2) { // If this is a pc and alwaysShowSpeedForPCs is enabled we show the color anyway