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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user