Refine map tile updates and enhance performance

- Updated tile freshness animation to reduce flicker and improve visual clarity.
- Modified MapView component to optimize layer visibility handling and ensure proper map resizing on fullscreen toggle.
- Increased tile buffer size in map initialization for better tile loading efficiency.
- Implemented logic to limit tile updates to only visible tiles, enhancing rendering performance during map updates.
This commit is contained in:
2026-03-01 17:40:43 +03:00
parent 49af08c13f
commit 8331473808
5 changed files with 48 additions and 21 deletions

View File

@@ -71,12 +71,14 @@ export const SmartTileLayer = L.TileLayer.extend({
const key = `${x}:${y}:${zoom}`
const tile = this._tiles[key]
if (tile?.el) {
tile.el.src = this.getTrueTileUrl({ x, y }, z)
tile.el.classList.add('tile-fresh')
const el = tile.el
setTimeout(() => el.classList.remove('tile-fresh'), 600)
}
if (!tile?.el) return
const newUrl = this.getTrueTileUrl({ x, y }, z)
if (tile.el.dataset.tileUrl === newUrl) return
tile.el.dataset.tileUrl = newUrl
tile.el.src = newUrl
tile.el.classList.add('tile-fresh')
const el = tile.el
setTimeout(() => el.classList.remove('tile-fresh'), 400)
},
}) as unknown as new (urlTemplate: string, options?: L.TileLayerOptions) => L.TileLayer & {
cache: SmartTileLayerCache