Move fallback to default color to a location where it's accessible (fixes #137)
This commit is contained in:
+1
-1
@@ -121,7 +121,7 @@ export function getColorForDistanceAndToken(distance, token, ranges=null) {
|
||||
ranges = getRangesFromSpeedProvider(token);
|
||||
}
|
||||
if (ranges.length === 0)
|
||||
return this.color;
|
||||
return null;
|
||||
const currentRange = ranges.reduce((minRange, currentRange) => {
|
||||
if (distance <= currentRange.range && currentRange.range < minRange.range)
|
||||
return currentRange;
|
||||
|
||||
+1
-1
@@ -169,6 +169,6 @@ export class DragRulerRuler extends Ruler {
|
||||
distance = Math.round(distance * 100) / 100;
|
||||
if (!this.dragRulerRanges)
|
||||
this.dragRulerRanges = getRangesFromSpeedProvider(this.draggedEntity);
|
||||
return getColorForDistanceAndToken(distance, this.draggedEntity, this.dragRulerRanges);
|
||||
return getColorForDistanceAndToken(distance, this.draggedEntity, this.dragRulerRanges) ?? this.color;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user