Cache the output of SpeedProvider.getRanges during a drag to increase speed provider performance
This commit is contained in:
+4
-1
@@ -1,6 +1,9 @@
|
||||
## In development
|
||||
### Bugfixes
|
||||
### Performance
|
||||
- Greatly increased the performance when playing on huge maps and when moving many tokens at once.
|
||||
- Huge performance improvements for speed providers. (Technical details: `getRanges` is now being called way less frequently)
|
||||
|
||||
### Bugfixes
|
||||
- When starting to drag a new token while the previous one is still moving the ruler won't dissappear anymore when the previous token arrives at it's destination.
|
||||
|
||||
|
||||
|
||||
+3
-1
@@ -185,7 +185,9 @@ export function getColorForDistance(startDistance, subDistance=0) {
|
||||
return this.color
|
||||
}
|
||||
const distance = startDistance + subDistance
|
||||
const ranges = getRangesFromSpeedProvider(this.draggedToken)
|
||||
if (!this.dragRulerRanges)
|
||||
this.dragRulerRanges = getRangesFromSpeedProvider(this.draggedToken)
|
||||
const ranges = this.dragRulerRanges;
|
||||
if (ranges.length === 0)
|
||||
return this.color
|
||||
const currentRange = ranges.reduce((minRange, currentRange) => {
|
||||
|
||||
@@ -14,6 +14,7 @@ export class DragRulerRuler extends Ruler {
|
||||
super.clear();
|
||||
this.previousWaypoints = [];
|
||||
this.previousLabels.removeChildren().forEach(c => c.destroy());
|
||||
this.dragRulerRanges = undefined;
|
||||
}
|
||||
|
||||
async moveToken(event) {
|
||||
|
||||
Reference in New Issue
Block a user