Replace MapProvider.getTilesUrl with LiveAtlasMapDefinition baseUrl option
This commit is contained in:
parent
1c5351313f
commit
40ee948d91
1
src/index.d.ts
vendored
1
src/index.d.ts
vendored
@ -192,7 +192,6 @@ interface LiveAtlasMapProvider {
|
|||||||
logout(): void;
|
logout(): void;
|
||||||
register(formData: FormData): void;
|
register(formData: FormData): void;
|
||||||
|
|
||||||
getTilesUrl(): string;
|
|
||||||
getMarkerIconUrl(icon: string): string;
|
getMarkerIconUrl(icon: string): string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ export class DynmapTileLayer extends LiveAtlasTileLayer {
|
|||||||
super('', options);
|
super('', options);
|
||||||
|
|
||||||
this._mapSettings = options.mapSettings;
|
this._mapSettings = options.mapSettings;
|
||||||
this._baseUrl = this._store.state.currentMapProvider!.getTilesUrl();
|
this._baseUrl = options.mapSettings.baseUrl;
|
||||||
this._namedTiles = Object.seal(new Map());
|
this._namedTiles = Object.seal(new Map());
|
||||||
|
|
||||||
this._pendingUpdates = computed(() => !!this._store.state.pendingTileUpdates.length);
|
this._pendingUpdates = computed(() => !!this._store.state.pendingTileUpdates.length);
|
||||||
|
@ -18,13 +18,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {LiveAtlasTileLayer, LiveAtlasTileLayerOptions} from "@/leaflet/tileLayer/LiveAtlasTileLayer";
|
import {LiveAtlasTileLayer, LiveAtlasTileLayerOptions} from "@/leaflet/tileLayer/LiveAtlasTileLayer";
|
||||||
import {Store, useStore} from "@/store";
|
|
||||||
import {Coords, Util} from "leaflet";
|
import {Coords, Util} from "leaflet";
|
||||||
|
|
||||||
// noinspection JSUnusedGlobalSymbols
|
// noinspection JSUnusedGlobalSymbols
|
||||||
export class OverviewerTileLayer extends LiveAtlasTileLayer {
|
export class OverviewerTileLayer extends LiveAtlasTileLayer {
|
||||||
private readonly _baseUrl: string;
|
private readonly _baseUrl: string;
|
||||||
private readonly _store: Store = useStore();
|
|
||||||
|
|
||||||
constructor(options: LiveAtlasTileLayerOptions) {
|
constructor(options: LiveAtlasTileLayerOptions) {
|
||||||
super('', options);
|
super('', options);
|
||||||
@ -34,7 +32,7 @@ export class OverviewerTileLayer extends LiveAtlasTileLayer {
|
|||||||
Util.setOptions(this, options);
|
Util.setOptions(this, options);
|
||||||
|
|
||||||
this._mapSettings = options.mapSettings;
|
this._mapSettings = options.mapSettings;
|
||||||
this._baseUrl = this._store.state.currentMapProvider!.getTilesUrl();
|
this._baseUrl = options.mapSettings.baseUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
getTileUrl(coords: Coords): string {
|
getTileUrl(coords: Coords): string {
|
||||||
|
@ -15,16 +15,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {LiveAtlasTileLayer, LiveAtlasTileLayerOptions} from "@/leaflet/tileLayer/LiveAtlasTileLayer";
|
import {LiveAtlasTileLayer, LiveAtlasTileLayerOptions} from "@/leaflet/tileLayer/LiveAtlasTileLayer";
|
||||||
import {useStore} from "@/store";
|
|
||||||
import {Util} from "leaflet";
|
import {Util} from "leaflet";
|
||||||
|
|
||||||
// noinspection JSUnusedGlobalSymbols
|
// noinspection JSUnusedGlobalSymbols
|
||||||
export class Pl3xmapTileLayer extends LiveAtlasTileLayer {
|
export class Pl3xmapTileLayer extends LiveAtlasTileLayer {
|
||||||
constructor(options: LiveAtlasTileLayerOptions) {
|
constructor(options: LiveAtlasTileLayerOptions) {
|
||||||
const worldName = options.mapSettings.world.name,
|
super(`${options.mapSettings.baseUrl}${options.mapSettings.world.name}/{z}/{x}_{y}.png`, options);
|
||||||
baseUrl = useStore().state.currentMapProvider!.getTilesUrl();
|
|
||||||
|
|
||||||
super(`${baseUrl}${worldName}/{z}/{x}_{y}.png`, options);
|
|
||||||
|
|
||||||
options.zoomReverse = false;
|
options.zoomReverse = false;
|
||||||
|
|
||||||
|
@ -311,10 +311,6 @@ export default class DynmapMapProvider extends MapProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getTilesUrl(): string {
|
|
||||||
return this.config.tiles;
|
|
||||||
}
|
|
||||||
|
|
||||||
getMarkerIconUrl(icon: string): string {
|
getMarkerIconUrl(icon: string): string {
|
||||||
return `${this.config.markers}_markers_/${icon}.png`;
|
return `${this.config.markers}_markers_/${icon}.png`;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,6 @@ export default abstract class MapProvider implements LiveAtlasMapProvider {
|
|||||||
abstract loadServerConfiguration(): Promise<void>;
|
abstract loadServerConfiguration(): Promise<void>;
|
||||||
abstract createTileLayer(options: LiveAtlasTileLayerOptions): LiveAtlasTileLayer;
|
abstract createTileLayer(options: LiveAtlasTileLayerOptions): LiveAtlasTileLayer;
|
||||||
|
|
||||||
abstract getTilesUrl(): string;
|
|
||||||
abstract getMarkerIconUrl(icon: string): string;
|
abstract getMarkerIconUrl(icon: string): string;
|
||||||
|
|
||||||
async populateWorld(world: LiveAtlasWorldDefinition): Promise<void> {}
|
async populateWorld(world: LiveAtlasWorldDefinition): Promise<void> {}
|
||||||
|
@ -307,10 +307,6 @@ export default class OverviewerMapProvider extends MapProvider {
|
|||||||
return new OverviewerTileLayer(options);
|
return new OverviewerTileLayer(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
getTilesUrl(): string {
|
|
||||||
return this.config;
|
|
||||||
}
|
|
||||||
|
|
||||||
getMarkerIconUrl(icon: string): string {
|
getMarkerIconUrl(icon: string): string {
|
||||||
return this.config + icon;
|
return this.config + icon;
|
||||||
}
|
}
|
||||||
|
@ -600,10 +600,6 @@ export default class Pl3xmapMapProvider extends MapProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getTilesUrl(): string {
|
|
||||||
return `${this.config}tiles/`;
|
|
||||||
}
|
|
||||||
|
|
||||||
getMarkerIconUrl(icon: string): string {
|
getMarkerIconUrl(icon: string): string {
|
||||||
return `${this.config}images/icon/registered/${icon}.png`;
|
return `${this.config}images/icon/registered/${icon}.png`;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user