Avoid recreating tiles from scratch when refreshing Pl3xmap
This commit is contained in:
parent
f316c0dd50
commit
552b289bb9
@ -43,15 +43,15 @@ export default defineComponent({
|
||||
const store = useStore(),
|
||||
active = computed(() => props.map === store.state.currentMap);
|
||||
|
||||
let redrawTimeout = 0,
|
||||
let refreshTimeout = 0,
|
||||
layer: LiveAtlasTileLayer;
|
||||
|
||||
const redraw = () => {
|
||||
const refresh = () => {
|
||||
if(active.value) {
|
||||
layer._update();
|
||||
layer.refresh();
|
||||
}
|
||||
|
||||
redrawTimeout = setTimeout(redraw, props.map.tileUpdateInterval);
|
||||
refreshTimeout = setTimeout(refresh, props.map.tileUpdateInterval);
|
||||
};
|
||||
|
||||
if(store.state.currentServer?.type === 'dynmap') {
|
||||
@ -81,14 +81,14 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
if(props.map.tileUpdateInterval) {
|
||||
redrawTimeout = setTimeout(redraw, props.map.tileUpdateInterval);
|
||||
refreshTimeout = setTimeout(refresh, props.map.tileUpdateInterval);
|
||||
}
|
||||
|
||||
onUnmounted(() => {
|
||||
disableLayer();
|
||||
|
||||
if(redrawTimeout) {
|
||||
clearTimeout(redrawTimeout);
|
||||
if(refreshTimeout) {
|
||||
clearTimeout(refreshTimeout);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
@ -144,6 +144,22 @@ export abstract class LiveAtlasTileLayer extends TileLayer {
|
||||
this.fetchTile(tile);
|
||||
}
|
||||
|
||||
refresh() {
|
||||
for (const i in this._tiles) {
|
||||
if (!Object.prototype.hasOwnProperty.call(this._tiles, i)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const tile = this._tiles[i] as LiveAtlasTile;
|
||||
|
||||
if(tile.loaded) {
|
||||
this.loadQueue.push(tile.el);
|
||||
}
|
||||
}
|
||||
|
||||
this.tickLoadQueue();
|
||||
}
|
||||
|
||||
_abortLoading() {
|
||||
let tile;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user