mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 13:00:42 +00:00
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:
committed by
GitHub
parent
99a5d5b8d7
commit
369483b4ac
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user