minor perf improvments

This commit is contained in:
Evan
2025-01-10 13:45:09 -08:00
parent 8e442fe9ce
commit 5fca2f287b
2 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -126,7 +126,7 @@ export class NameLayer implements Layer {
this.container.style.transform = `translate(${screenPos.x}px, ${screenPos.y}px) scale(${this.transformHandler.scale})`
const now = Date.now()
if (now + this.lastChecked > this.renderRefreshRate) {
if (now > this.lastChecked + this.renderCheckRate) {
this.lastChecked = now
for (const render of this.renders) {
this.renderPlayerInfo(render)
@@ -185,7 +185,7 @@ export class NameLayer implements Layer {
render.fontSize = Math.max(1, Math.floor(render.player.nameLocation().size))
// console.log(`zoom ${this.transformHandler.scale}, size: ${render.player.nameLocation().size}`)
const size = this.transformHandler.scale * render.player.nameLocation().size
if (size < 5) {
if (size < 10) {
if (render.element.style.display != 'none') {
render.element.style.display = 'none'
}
+4 -4
View File
@@ -150,11 +150,11 @@ export class TerritoryLayer implements Layer {
}
paintTerritory(tile: Tile) {
if (tile.hasFallout()) {
this.paintCell(tile.cell(), this.theme.falloutColor(), 150)
return
}
if (!tile.hasOwner()) {
if (tile.hasFallout()) {
this.paintCell(tile.cell(), this.theme.falloutColor(), 150)
return
}
this.clearCell(tile.cell())
return
}