Small optimisation in TerritoryLayer.renderLayer call to dedupe Date.… (#759)

## Description:

Small optimisation in TerritoryLayer.renderLayer call to dedupe
Date.now()

## Please complete the following:

- [-] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

## Please put your Discord username so you can be contacted if a bug or
regression is found:

N/A

Co-authored-by: robertpitt <robertpitt1988@gmail.com>
This commit is contained in:
robert-pitt-foodhub
2025-05-16 00:07:39 +01:00
committed by GitHub
parent 99a5d5b8d7
commit 369483b4ac
+4 -3
View File
@@ -186,11 +186,12 @@ export class TerritoryLayer implements Layer {
}
renderLayer(context: CanvasRenderingContext2D) {
const now = Date.now();
if (
Date.now() > this.lastDragTime + this.nodrawDragDuration &&
Date.now() > this.lastRefresh + this.refreshRate
now > this.lastDragTime + this.nodrawDragDuration &&
now > this.lastRefresh + this.refreshRate
) {
this.lastRefresh = Date.now();
this.lastRefresh = now;
this.renderTerritory();
this.context.putImageData(this.imageData, 0, 0);
}