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
This commit is contained in:
Manuel Vögele
2021-11-21 22:55:02 +01:00
parent 39f7bab4b6
commit c3a62e3646
+1
View File
@@ -166,6 +166,7 @@ export class DragRulerRuler extends Ruler {
if (!(this.draggedEntity.actor.data.type === "character" && game.settings.get(settingsKey, "alwaysShowSpeedForPCs"))) if (!(this.draggedEntity.actor.data.type === "character" && game.settings.get(settingsKey, "alwaysShowSpeedForPCs")))
return this.color; return this.color;
} }
distance = Math.round(distance * 100) / 100;
if (!this.dragRulerRanges) if (!this.dragRulerRanges)
this.dragRulerRanges = getRangesFromSpeedProvider(this.draggedEntity); this.dragRulerRanges = getRangesFromSpeedProvider(this.draggedEntity);
return getColorForDistanceAndToken(distance, this.draggedEntity, this.dragRulerRanges); return getColorForDistanceAndToken(distance, this.draggedEntity, this.dragRulerRanges);