From c3a62e3646f51b5390404bf6f3bc0cae2c5166c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Sun, 21 Nov 2021 22:55:02 +0100 Subject: [PATCH] Only switch to the next color once the distance is 0.01 above the allowed distance The goal of this is to reduce color flickering noise due to floating number errors --- src/ruler.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ruler.js b/src/ruler.js index 66fdd01..6147d08 100644 --- a/src/ruler.js +++ b/src/ruler.js @@ -166,6 +166,7 @@ export class DragRulerRuler extends Ruler { if (!(this.draggedEntity.actor.data.type === "character" && game.settings.get(settingsKey, "alwaysShowSpeedForPCs"))) return this.color; } + distance = Math.round(distance * 100) / 100; if (!this.dragRulerRanges) this.dragRulerRanges = getRangesFromSpeedProvider(this.draggedEntity); return getColorForDistanceAndToken(distance, this.draggedEntity, this.dragRulerRanges);