Use generic names for extended leaflet classes
This commit is contained in:
parent
ef26d78c19
commit
c99215e259
@ -46,7 +46,7 @@ import LogoControl from "@/components/map/control/LogoControl.vue";
|
|||||||
import {MutationTypes} from "@/store/mutation-types";
|
import {MutationTypes} from "@/store/mutation-types";
|
||||||
import {DynmapPlayer} from "@/dynmap";
|
import {DynmapPlayer} from "@/dynmap";
|
||||||
import {ActionTypes} from "@/store/action-types";
|
import {ActionTypes} from "@/store/action-types";
|
||||||
import DynmapMap from "@/leaflet/DynmapMap";
|
import LiveAtlasLeafletMap from "@/leaflet/LiveAtlasLeafletMap";
|
||||||
import {LoadingControl} from "@/leaflet/control/LoadingControl";
|
import {LoadingControl} from "@/leaflet/control/LoadingControl";
|
||||||
import MapContextMenu from "@/components/map/MapContextMenu.vue";
|
import MapContextMenu from "@/components/map/MapContextMenu.vue";
|
||||||
import {Coordinate} from "@/index";
|
import {Coordinate} from "@/index";
|
||||||
@ -234,7 +234,7 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.leaflet = new DynmapMap(this.$el.nextElementSibling, Object.freeze({
|
this.leaflet = new LiveAtlasLeafletMap(this.$el.nextElementSibling, Object.freeze({
|
||||||
zoom: this.configuration.defaultZoom,
|
zoom: this.configuration.defaultZoom,
|
||||||
center: new LatLng(0, 0),
|
center: new LatLng(0, 0),
|
||||||
fadeAnimation: false,
|
fadeAnimation: false,
|
||||||
@ -245,7 +245,7 @@ export default defineComponent({
|
|||||||
crs: CRS.Simple,
|
crs: CRS.Simple,
|
||||||
worldCopyJump: false,
|
worldCopyJump: false,
|
||||||
// markerZoomAnimation: false,
|
// markerZoomAnimation: false,
|
||||||
})) as DynmapMap;
|
})) as LiveAtlasLeafletMap;
|
||||||
|
|
||||||
window.addEventListener('keydown', this.handleKeydown);
|
window.addEventListener('keydown', this.handleKeydown);
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import DynmapMap from "@/leaflet/DynmapMap";
|
import LiveAtlasLeafletMap from "@/leaflet/LiveAtlasLeafletMap";
|
||||||
import {computed, defineComponent, onMounted, onUnmounted, watch} from "@vue/runtime-core";
|
import {computed, defineComponent, onMounted, onUnmounted, watch} from "@vue/runtime-core";
|
||||||
import {LeafletMouseEvent} from "leaflet";
|
import {LeafletMouseEvent} from "leaflet";
|
||||||
import {useStore} from "@/store";
|
import {useStore} from "@/store";
|
||||||
@ -41,7 +41,7 @@ export default defineComponent({
|
|||||||
components: {WorldListItem},
|
components: {WorldListItem},
|
||||||
props: {
|
props: {
|
||||||
leaflet: {
|
leaflet: {
|
||||||
type: Object as () => DynmapMap,
|
type: Object as () => LiveAtlasLeafletMap,
|
||||||
required: true,
|
required: true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {defineComponent, onMounted, onUnmounted} from "@vue/runtime-core";
|
import {defineComponent, onMounted, onUnmounted} from "@vue/runtime-core";
|
||||||
import {ChatControl} from "@/leaflet/control/ChatControl";
|
import {ChatControl} from "@/leaflet/control/ChatControl";
|
||||||
import DynmapMap from "@/leaflet/DynmapMap";
|
import LiveAtlasLeafletMap from "@/leaflet/LiveAtlasLeafletMap";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
leaflet: {
|
leaflet: {
|
||||||
type: Object as () => DynmapMap,
|
type: Object as () => LiveAtlasLeafletMap,
|
||||||
required: true,
|
required: true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
import {computed, defineComponent, onMounted, onUnmounted} from "@vue/runtime-core";
|
import {computed, defineComponent, onMounted, onUnmounted} from "@vue/runtime-core";
|
||||||
import {useStore} from "@/store";
|
import {useStore} from "@/store";
|
||||||
import {ClockControl, ClockControlOptions} from "@/leaflet/control/ClockControl";
|
import {ClockControl, ClockControlOptions} from "@/leaflet/control/ClockControl";
|
||||||
import DynmapMap from "@/leaflet/DynmapMap";
|
import LiveAtlasLeafletMap from "@/leaflet/LiveAtlasLeafletMap";
|
||||||
import {watch} from "vue";
|
import {watch} from "vue";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
leaflet: {
|
leaflet: {
|
||||||
type: Object as () => DynmapMap,
|
type: Object as () => LiveAtlasLeafletMap,
|
||||||
required: true,
|
required: true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
import {computed, defineComponent, onMounted, onUnmounted} from "@vue/runtime-core";
|
import {computed, defineComponent, onMounted, onUnmounted} from "@vue/runtime-core";
|
||||||
import {useStore} from "@/store";
|
import {useStore} from "@/store";
|
||||||
import {CoordinatesControl, CoordinatesControlOptions} from "@/leaflet/control/CoordinatesControl";
|
import {CoordinatesControl, CoordinatesControlOptions} from "@/leaflet/control/CoordinatesControl";
|
||||||
import DynmapMap from "@/leaflet/DynmapMap";
|
import LiveAtlasLeafletMap from "@/leaflet/LiveAtlasLeafletMap";
|
||||||
import {watch} from "vue";
|
import {watch} from "vue";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
leaflet: {
|
leaflet: {
|
||||||
type: Object as () => DynmapMap,
|
type: Object as () => LiveAtlasLeafletMap,
|
||||||
required: true,
|
required: true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {defineComponent, onMounted, onUnmounted} from "@vue/runtime-core";
|
import {defineComponent, onMounted, onUnmounted} from "@vue/runtime-core";
|
||||||
import {LinkControl} from "@/leaflet/control/LinkControl";
|
import {LinkControl} from "@/leaflet/control/LinkControl";
|
||||||
import DynmapMap from "@/leaflet/DynmapMap";
|
import LiveAtlasLeafletMap from "@/leaflet/LiveAtlasLeafletMap";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
leaflet: {
|
leaflet: {
|
||||||
type: Object as () => DynmapMap,
|
type: Object as () => LiveAtlasLeafletMap,
|
||||||
required: true,
|
required: true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {defineComponent} from "@vue/runtime-core";
|
import {defineComponent} from "@vue/runtime-core";
|
||||||
import {LogoControl, LogoControlOptions} from "@/leaflet/control/LogoControl";
|
import {LogoControl, LogoControlOptions} from "@/leaflet/control/LogoControl";
|
||||||
import DynmapMap from "@/leaflet/DynmapMap";
|
import LiveAtlasLeafletMap from "@/leaflet/LiveAtlasLeafletMap";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
@ -26,7 +26,7 @@ export default defineComponent({
|
|||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
leaflet: {
|
leaflet: {
|
||||||
type: Object as () => DynmapMap,
|
type: Object as () => LiveAtlasLeafletMap,
|
||||||
required: true,
|
required: true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -29,8 +29,8 @@ import Areas from "@/components/map/vector/Areas.vue";
|
|||||||
import Circles from "@/components/map/vector/Circles.vue";
|
import Circles from "@/components/map/vector/Circles.vue";
|
||||||
import Lines from "@/components/map/vector/Lines.vue";
|
import Lines from "@/components/map/vector/Lines.vue";
|
||||||
import Markers from "@/components/map/vector/Markers.vue";
|
import Markers from "@/components/map/vector/Markers.vue";
|
||||||
import DynmapMap from "@/leaflet/DynmapMap";
|
import LiveAtlasLeafletMap from "@/leaflet/LiveAtlasLeafletMap";
|
||||||
import DynmapLayerGroup from "@/leaflet/layer/DynmapLayerGroup";
|
import LiveAtlasLayerGroup from "@/leaflet/layer/LiveAtlasLayerGroup";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
@ -42,7 +42,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
props: {
|
props: {
|
||||||
leaflet: {
|
leaflet: {
|
||||||
type: Object as () => DynmapMap,
|
type: Object as () => LiveAtlasLeafletMap,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ export default defineComponent({
|
|||||||
setup(props) {
|
setup(props) {
|
||||||
const store = useStore(),
|
const store = useStore(),
|
||||||
markerSettings = computed(() => store.state.components.markers),
|
markerSettings = computed(() => store.state.components.markers),
|
||||||
layerGroup = new DynmapLayerGroup({
|
layerGroup = new LiveAtlasLayerGroup({
|
||||||
id: props.markerSet.id,
|
id: props.markerSet.id,
|
||||||
minZoom: props.markerSet.minZoom,
|
minZoom: props.markerSet.minZoom,
|
||||||
maxZoom: props.markerSet.maxZoom,
|
maxZoom: props.markerSet.maxZoom,
|
||||||
|
@ -23,7 +23,7 @@ import PlayerMarker from "@/components/map/marker/PlayerMarker.vue";
|
|||||||
import {defineComponent, computed, watch} from "@vue/runtime-core";
|
import {defineComponent, computed, watch} from "@vue/runtime-core";
|
||||||
import {useStore} from "@/store";
|
import {useStore} from "@/store";
|
||||||
import {LayerGroup} from 'leaflet';
|
import {LayerGroup} from 'leaflet';
|
||||||
import DynmapMap from "@/leaflet/DynmapMap";
|
import LiveAtlasLeafletMap from "@/leaflet/LiveAtlasLeafletMap";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
@ -32,7 +32,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
props: {
|
props: {
|
||||||
leaflet: {
|
leaflet: {
|
||||||
type: Object as () => DynmapMap,
|
type: Object as () => LiveAtlasLeafletMap,
|
||||||
required: true,
|
required: true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -21,9 +21,9 @@ import {DynmapArea, DynmapMarkerSet} from "@/dynmap";
|
|||||||
import {ActionTypes} from "@/store/action-types";
|
import {ActionTypes} from "@/store/action-types";
|
||||||
import {createArea, updateArea} from "@/util/areas";
|
import {createArea, updateArea} from "@/util/areas";
|
||||||
import {getPointConverter} from '@/util';
|
import {getPointConverter} from '@/util';
|
||||||
import DynmapLayerGroup from "@/leaflet/layer/DynmapLayerGroup";
|
import LiveAtlasLayerGroup from "@/leaflet/layer/LiveAtlasLayerGroup";
|
||||||
import DynmapPolygon from "@/leaflet/vector/DynmapPolygon";
|
import LiveAtlasPolygon from "@/leaflet/vector/LiveAtlasPolygon";
|
||||||
import DynmapPolyline from "@/leaflet/vector/DynmapPolyline";
|
import LiveAtlasPolyline from "@/leaflet/vector/LiveAtlasPolyline";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
@ -32,7 +32,7 @@ export default defineComponent({
|
|||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
layerGroup: {
|
layerGroup: {
|
||||||
type: Object as () => DynmapLayerGroup,
|
type: Object as () => LiveAtlasLayerGroup,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -47,7 +47,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
return markerSetUpdates && markerSetUpdates.areaUpdates.length;
|
return markerSetUpdates && markerSetUpdates.areaUpdates.length;
|
||||||
}),
|
}),
|
||||||
layers = Object.freeze(new Map()) as Map<string, DynmapPolygon | DynmapPolyline>,
|
layers = Object.freeze(new Map()) as Map<string, LiveAtlasPolygon | LiveAtlasPolyline>,
|
||||||
|
|
||||||
createAreas = () => {
|
createAreas = () => {
|
||||||
const converter = getPointConverter();
|
const converter = getPointConverter();
|
||||||
@ -61,7 +61,7 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
deleteArea = (id: string) => {
|
deleteArea = (id: string) => {
|
||||||
let area = layers.get(id) as DynmapPolyline;
|
let area = layers.get(id) as LiveAtlasPolyline;
|
||||||
|
|
||||||
if(!area) {
|
if(!area) {
|
||||||
return;
|
return;
|
||||||
|
@ -21,9 +21,9 @@ import {DynmapCircle, DynmapMarkerSet} from "@/dynmap";
|
|||||||
import {ActionTypes} from "@/store/action-types";
|
import {ActionTypes} from "@/store/action-types";
|
||||||
import {createCircle, updateCircle} from "@/util/circles";
|
import {createCircle, updateCircle} from "@/util/circles";
|
||||||
import {getPointConverter} from '@/util';
|
import {getPointConverter} from '@/util';
|
||||||
import DynmapPolyline from "@/leaflet/vector/DynmapPolyline";
|
import LiveAtlasPolyline from "@/leaflet/vector/LiveAtlasPolyline";
|
||||||
import DynmapPolygon from "@/leaflet/vector/DynmapPolygon";
|
import LiveAtlasPolygon from "@/leaflet/vector/LiveAtlasPolygon";
|
||||||
import DynmapLayerGroup from "@/leaflet/layer/DynmapLayerGroup";
|
import LiveAtlasLayerGroup from "@/leaflet/layer/LiveAtlasLayerGroup";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
@ -32,7 +32,7 @@ export default defineComponent({
|
|||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
layerGroup: {
|
layerGroup: {
|
||||||
type: Object as () => DynmapLayerGroup,
|
type: Object as () => LiveAtlasLayerGroup,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -47,7 +47,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
return markerSetUpdates && markerSetUpdates.circleUpdates.length;
|
return markerSetUpdates && markerSetUpdates.circleUpdates.length;
|
||||||
}),
|
}),
|
||||||
layers = Object.freeze(new Map<string, DynmapPolyline | DynmapPolygon>()),
|
layers = Object.freeze(new Map<string, LiveAtlasPolyline | LiveAtlasPolygon>()),
|
||||||
|
|
||||||
createCircles = () => {
|
createCircles = () => {
|
||||||
const converter = getPointConverter();
|
const converter = getPointConverter();
|
||||||
@ -61,7 +61,7 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
deleteCircle = (id: string) => {
|
deleteCircle = (id: string) => {
|
||||||
let circle = layers.get(id) as DynmapPolyline;
|
let circle = layers.get(id) as LiveAtlasPolyline;
|
||||||
|
|
||||||
if (!circle) {
|
if (!circle) {
|
||||||
return;
|
return;
|
||||||
|
@ -21,8 +21,8 @@ import {DynmapLine, DynmapMarkerSet} from "@/dynmap";
|
|||||||
import {ActionTypes} from "@/store/action-types";
|
import {ActionTypes} from "@/store/action-types";
|
||||||
import {createLine, updateLine} from "@/util/lines";
|
import {createLine, updateLine} from "@/util/lines";
|
||||||
import {getPointConverter} from '@/util';
|
import {getPointConverter} from '@/util';
|
||||||
import DynmapPolyline from "@/leaflet/vector/DynmapPolyline";
|
import LiveAtlasPolyline from "@/leaflet/vector/LiveAtlasPolyline";
|
||||||
import DynmapLayerGroup from "@/leaflet/layer/DynmapLayerGroup";
|
import LiveAtlasLayerGroup from "@/leaflet/layer/LiveAtlasLayerGroup";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
@ -31,7 +31,7 @@ export default defineComponent({
|
|||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
layerGroup: {
|
layerGroup: {
|
||||||
type: Object as () => DynmapLayerGroup,
|
type: Object as () => LiveAtlasLayerGroup,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -46,7 +46,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
return markerSetUpdates && markerSetUpdates.lineUpdates.length;
|
return markerSetUpdates && markerSetUpdates.lineUpdates.length;
|
||||||
}),
|
}),
|
||||||
layers = Object.freeze(new Map<string, DynmapPolyline>()),
|
layers = Object.freeze(new Map<string, LiveAtlasPolyline>()),
|
||||||
|
|
||||||
createLines = () => {
|
createLines = () => {
|
||||||
const converter = getPointConverter();
|
const converter = getPointConverter();
|
||||||
@ -60,7 +60,7 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
deleteLine = (id: string) => {
|
deleteLine = (id: string) => {
|
||||||
let line = layers.get(id) as DynmapPolyline;
|
let line = layers.get(id) as LiveAtlasPolyline;
|
||||||
|
|
||||||
if (!line) {
|
if (!line) {
|
||||||
return;
|
return;
|
||||||
|
@ -21,7 +21,7 @@ import {useStore} from "@/store";
|
|||||||
import {DynmapMarker, DynmapMarkerSet} from "@/dynmap";
|
import {DynmapMarker, DynmapMarkerSet} from "@/dynmap";
|
||||||
import {ActionTypes} from "@/store/action-types";
|
import {ActionTypes} from "@/store/action-types";
|
||||||
import {createMarker, updateMarker} from "@/util/markers";
|
import {createMarker, updateMarker} from "@/util/markers";
|
||||||
import DynmapLayerGroup from "@/leaflet/layer/DynmapLayerGroup";
|
import LiveAtlasLayerGroup from "@/leaflet/layer/LiveAtlasLayerGroup";
|
||||||
import {getPointConverter} from "@/util";
|
import {getPointConverter} from "@/util";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
@ -31,7 +31,7 @@ export default defineComponent({
|
|||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
layerGroup: {
|
layerGroup: {
|
||||||
type: Object as () => DynmapLayerGroup,
|
type: Object as () => LiveAtlasLayerGroup,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
import {Map, DomUtil, MapOptions} from 'leaflet';
|
import {Map, DomUtil, MapOptions} from 'leaflet';
|
||||||
import LayerManager from "@/leaflet/layer/LayerManager";
|
import LayerManager from "@/leaflet/layer/LayerManager";
|
||||||
|
|
||||||
export default class DynmapMap extends Map {
|
export default class LiveAtlasLeafletMap extends Map {
|
||||||
private readonly _layerManager: LayerManager;
|
private readonly _layerManager: LayerManager;
|
||||||
private _controlCorners: any;
|
private _controlCorners: any;
|
||||||
private _controlContainer?: HTMLElement;
|
private _controlContainer?: HTMLElement;
|
@ -31,7 +31,7 @@ import Layers = Control.Layers;
|
|||||||
|
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
|
|
||||||
export class DynmapLayerControl extends Control.Layers {
|
export class LiveAtlasLayerControl extends Control.Layers {
|
||||||
private _layersButton?: HTMLElement;
|
private _layersButton?: HTMLElement;
|
||||||
private _map ?: LeafletMap;
|
private _map ?: LeafletMap;
|
||||||
private _overlaysList?: HTMLElement;
|
private _overlaysList?: HTMLElement;
|
@ -20,7 +20,7 @@
|
|||||||
import {DivIconOptions, PointExpression, Icon, DivIcon, DomUtil, point} from 'leaflet';
|
import {DivIconOptions, PointExpression, Icon, DivIcon, DomUtil, point} from 'leaflet';
|
||||||
import {useStore} from "@/store";
|
import {useStore} from "@/store";
|
||||||
|
|
||||||
export interface DynmapIconOptions extends DivIconOptions {
|
export interface GenericIconOptions extends DivIconOptions {
|
||||||
icon: string;
|
icon: string;
|
||||||
label: string;
|
label: string;
|
||||||
isHtml?: boolean;
|
isHtml?: boolean;
|
||||||
@ -36,8 +36,8 @@ markerIcon.className = 'marker__icon';
|
|||||||
const markerLabel: HTMLSpanElement = document.createElement('span');
|
const markerLabel: HTMLSpanElement = document.createElement('span');
|
||||||
markerLabel.className = 'marker__label';
|
markerLabel.className = 'marker__label';
|
||||||
|
|
||||||
export class DynmapIcon extends DivIcon {
|
export class GenericIcon extends DivIcon {
|
||||||
static defaultOptions: DynmapIconOptions = {
|
static defaultOptions: GenericIconOptions = {
|
||||||
icon: 'default',
|
icon: 'default',
|
||||||
label: '',
|
label: '',
|
||||||
iconSize: [16, 16],
|
iconSize: [16, 16],
|
||||||
@ -46,12 +46,12 @@ export class DynmapIcon extends DivIcon {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
options: DynmapIconOptions;
|
options: GenericIconOptions;
|
||||||
_image?: HTMLImageElement;
|
_image?: HTMLImageElement;
|
||||||
_label?: HTMLSpanElement;
|
_label?: HTMLSpanElement;
|
||||||
|
|
||||||
constructor(options: DynmapIconOptions) {
|
constructor(options: GenericIconOptions) {
|
||||||
super(Object.assign(DynmapIcon.defaultOptions, options));
|
super(Object.assign(GenericIcon.defaultOptions, options));
|
||||||
}
|
}
|
||||||
|
|
||||||
createIcon(oldIcon: HTMLElement) {
|
createIcon(oldIcon: HTMLElement) {
|
||||||
@ -94,7 +94,7 @@ export class DynmapIcon extends DivIcon {
|
|||||||
return div;
|
return div;
|
||||||
}
|
}
|
||||||
|
|
||||||
update(options: DynmapIconOptions) {
|
update(options: GenericIconOptions) {
|
||||||
if(this._image && options.icon !== this.options.icon) {
|
if(this._image && options.icon !== this.options.icon) {
|
||||||
this._image!.src = `${useStore().getters.serverConfig.dynmap.markers}_markers_/${options.icon}.png`;
|
this._image!.src = `${useStore().getters.serverConfig.dynmap.markers}_markers_/${options.icon}.png`;
|
||||||
this.options.icon = options.icon;
|
this.options.icon = options.icon;
|
@ -15,19 +15,19 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {Map, Layer} from 'leaflet';
|
import {Map, Layer} from 'leaflet';
|
||||||
import {DynmapLayerControl} from "@/leaflet/control/DynmapLayerControl";
|
import {LiveAtlasLayerControl} from "@/leaflet/control/LiveAtlasLayerControl";
|
||||||
import {watch} from "vue";
|
import {watch} from "vue";
|
||||||
import {useStore} from "@/store";
|
import {useStore} from "@/store";
|
||||||
import {computed} from "@vue/runtime-core";
|
import {computed} from "@vue/runtime-core";
|
||||||
|
|
||||||
export default class LayerManager {
|
export default class LayerManager {
|
||||||
private readonly layerControl: DynmapLayerControl;
|
private readonly layerControl: LiveAtlasLayerControl;
|
||||||
private readonly map: Map;
|
private readonly map: Map;
|
||||||
|
|
||||||
constructor(map: Map) {
|
constructor(map: Map) {
|
||||||
const showControl = computed(() => useStore().state.configuration.showLayerControl);
|
const showControl = computed(() => useStore().state.configuration.showLayerControl);
|
||||||
this.map = map;
|
this.map = map;
|
||||||
this.layerControl = new DynmapLayerControl({}, {},{
|
this.layerControl = new LiveAtlasLayerControl({}, {},{
|
||||||
position: 'topleft',
|
position: 'topleft',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
import {Layer, Map as LeafletMap, LayerGroup, LayerOptions, Util, Marker, Path} from "leaflet";
|
import {Layer, Map as LeafletMap, LayerGroup, LayerOptions, Util, Marker, Path} from "leaflet";
|
||||||
|
|
||||||
export interface DynmapLayerGroupOptions extends LayerOptions {
|
export interface LiveAtlasLayerGroupOptions extends LayerOptions {
|
||||||
id: string; //Added to the name of layer group panes
|
id: string; //Added to the name of layer group panes
|
||||||
showLabels: boolean;
|
showLabels: boolean;
|
||||||
priority: number; //Added to the z-index of layer group panes
|
priority: number; //Added to the z-index of layer group panes
|
||||||
@ -26,16 +26,16 @@ export interface DynmapLayerGroupOptions extends LayerOptions {
|
|||||||
maxZoom?: number;
|
maxZoom?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class DynmapLayerGroup extends LayerGroup {
|
export default class LiveAtlasLayerGroup extends LayerGroup {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
options: DynmapLayerGroupOptions;
|
options: LiveAtlasLayerGroupOptions;
|
||||||
_zoomLimitedLayers: Set<Layer>; //Layers which are zoom limited and should be checked on zoom
|
_zoomLimitedLayers: Set<Layer>; //Layers which are zoom limited and should be checked on zoom
|
||||||
_layers: any;
|
_layers: any;
|
||||||
_markerPane?: HTMLElement;
|
_markerPane?: HTMLElement;
|
||||||
|
|
||||||
_zoomEndCallback = () => this._updateLayerVisibility();
|
_zoomEndCallback = () => this._updateLayerVisibility();
|
||||||
|
|
||||||
constructor(options: DynmapLayerGroupOptions) {
|
constructor(options: LiveAtlasLayerGroupOptions) {
|
||||||
super([], options);
|
super([], options);
|
||||||
Util.setOptions(this, options);
|
Util.setOptions(this, options);
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ export default class DynmapLayerGroup extends LayerGroup {
|
|||||||
return super.removeLayer(layer);
|
return super.removeLayer(layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
update(options: DynmapLayerGroupOptions) {
|
update(options: LiveAtlasLayerGroupOptions) {
|
||||||
this.options.showLabels = options.showLabels;
|
this.options.showLabels = options.showLabels;
|
||||||
|
|
||||||
if(this._markerPane) {
|
if(this._markerPane) {
|
@ -16,13 +16,13 @@
|
|||||||
|
|
||||||
import {LatLngExpression, Polygon, PolylineOptions, Util} from "leaflet";
|
import {LatLngExpression, Polygon, PolylineOptions, Util} from "leaflet";
|
||||||
|
|
||||||
export interface DynmapPolygonOptions extends PolylineOptions {
|
export interface LiveAtlasPolygonOptions extends PolylineOptions {
|
||||||
minZoom?: number;
|
minZoom?: number;
|
||||||
maxZoom?: number;
|
maxZoom?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class DynmapPolygon extends Polygon {
|
export default class LiveAtlasPolygon extends Polygon {
|
||||||
constructor(latlngs: LatLngExpression[] | LatLngExpression[][] | LatLngExpression[][][], options?: DynmapPolygonOptions) {
|
constructor(latlngs: LatLngExpression[] | LatLngExpression[][] | LatLngExpression[][][], options?: LiveAtlasPolygonOptions) {
|
||||||
super(latlngs, options);
|
super(latlngs, options);
|
||||||
Util.setOptions(this, options);
|
Util.setOptions(this, options);
|
||||||
}
|
}
|
@ -16,13 +16,13 @@
|
|||||||
|
|
||||||
import {LatLngExpression, Polyline, PolylineOptions, Util} from "leaflet";
|
import {LatLngExpression, Polyline, PolylineOptions, Util} from "leaflet";
|
||||||
|
|
||||||
export interface DynmapPolylineOptions extends PolylineOptions {
|
export interface LiveAtlasPolylineOptions extends PolylineOptions {
|
||||||
minZoom?: number;
|
minZoom?: number;
|
||||||
maxZoom?: number;
|
maxZoom?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class DynmapPolyline extends Polyline {
|
export default class LiveAtlasPolyline extends Polyline {
|
||||||
constructor(latlngs: LatLngExpression[] | LatLngExpression[][], options?: DynmapPolylineOptions) {
|
constructor(latlngs: LatLngExpression[] | LatLngExpression[][], options?: LiveAtlasPolylineOptions) {
|
||||||
super(latlngs, options);
|
super(latlngs, options);
|
||||||
Util.setOptions(this, options);
|
Util.setOptions(this, options);
|
||||||
}
|
}
|
@ -19,17 +19,17 @@
|
|||||||
|
|
||||||
import {LatLngExpression} from "leaflet";
|
import {LatLngExpression} from "leaflet";
|
||||||
import {DynmapArea} from "@/dynmap";
|
import {DynmapArea} from "@/dynmap";
|
||||||
import DynmapPolyline from "@/leaflet/vector/DynmapPolyline";
|
import LiveAtlasPolyline from "@/leaflet/vector/LiveAtlasPolyline";
|
||||||
import DynmapPolygon from "@/leaflet/vector/DynmapPolygon";
|
import LiveAtlasPolygon from "@/leaflet/vector/LiveAtlasPolygon";
|
||||||
|
|
||||||
export const createArea = (options: DynmapArea, converter: Function): DynmapPolyline | DynmapPolygon => {
|
export const createArea = (options: DynmapArea, converter: Function): LiveAtlasPolyline | LiveAtlasPolygon => {
|
||||||
const outline = !options.style.fillOpacity || (options.style.fillOpacity <= 0),
|
const outline = !options.style.fillOpacity || (options.style.fillOpacity <= 0),
|
||||||
points = getPoints(options, converter, outline),
|
points = getPoints(options, converter, outline),
|
||||||
area = outline ? new DynmapPolyline(points, {
|
area = outline ? new LiveAtlasPolyline(points, {
|
||||||
...options.style,
|
...options.style,
|
||||||
minZoom: options.minZoom,
|
minZoom: options.minZoom,
|
||||||
maxZoom: options.maxZoom,
|
maxZoom: options.maxZoom,
|
||||||
}) : new DynmapPolygon(points, {
|
}) : new LiveAtlasPolygon(points, {
|
||||||
...options.style,
|
...options.style,
|
||||||
minZoom: options.minZoom,
|
minZoom: options.minZoom,
|
||||||
maxZoom: options.maxZoom,
|
maxZoom: options.maxZoom,
|
||||||
@ -42,7 +42,7 @@ export const createArea = (options: DynmapArea, converter: Function): DynmapPoly
|
|||||||
return area;
|
return area;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const updateArea = (area: DynmapPolyline | DynmapPolygon | undefined, options: DynmapArea, converter: Function): DynmapPolyline | DynmapPolygon => {
|
export const updateArea = (area: LiveAtlasPolyline | LiveAtlasPolygon | undefined, options: DynmapArea, converter: Function): LiveAtlasPolyline | LiveAtlasPolygon => {
|
||||||
const outline = !options.style || !options.style.fillOpacity || (options.style.fillOpacity <= 0) as boolean,
|
const outline = !options.style || !options.style.fillOpacity || (options.style.fillOpacity <= 0) as boolean,
|
||||||
points = getPoints(options, converter, outline);
|
points = getPoints(options, converter, outline);
|
||||||
|
|
||||||
|
@ -19,17 +19,17 @@
|
|||||||
|
|
||||||
import {DynmapCircle} from "@/dynmap";
|
import {DynmapCircle} from "@/dynmap";
|
||||||
import {LatLngExpression} from "leaflet";
|
import {LatLngExpression} from "leaflet";
|
||||||
import DynmapPolyline from "@/leaflet/vector/DynmapPolyline";
|
import LiveAtlasPolyline from "@/leaflet/vector/LiveAtlasPolyline";
|
||||||
import DynmapPolygon from "@/leaflet/vector/DynmapPolygon";
|
import LiveAtlasPolygon from "@/leaflet/vector/LiveAtlasPolygon";
|
||||||
|
|
||||||
export const createCircle = (options: DynmapCircle, converter: Function): DynmapPolyline | DynmapPolygon => {
|
export const createCircle = (options: DynmapCircle, converter: Function): LiveAtlasPolyline | LiveAtlasPolygon => {
|
||||||
const outline = !options.style.fillOpacity || (options.style.fillOpacity <= 0),
|
const outline = !options.style.fillOpacity || (options.style.fillOpacity <= 0),
|
||||||
points = getCirclePoints(options, converter, outline),
|
points = getCirclePoints(options, converter, outline),
|
||||||
circle = outline ? new DynmapPolyline(points, {
|
circle = outline ? new LiveAtlasPolyline(points, {
|
||||||
...options.style,
|
...options.style,
|
||||||
minZoom: options.minZoom,
|
minZoom: options.minZoom,
|
||||||
maxZoom: options.maxZoom,
|
maxZoom: options.maxZoom,
|
||||||
}) : new DynmapPolygon(points, {
|
}) : new LiveAtlasPolygon(points, {
|
||||||
...options.style,
|
...options.style,
|
||||||
minZoom: options.minZoom,
|
minZoom: options.minZoom,
|
||||||
maxZoom: options.maxZoom,
|
maxZoom: options.maxZoom,
|
||||||
@ -42,7 +42,7 @@ export const createCircle = (options: DynmapCircle, converter: Function): Dynmap
|
|||||||
return circle;
|
return circle;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const updateCircle = (circle: DynmapPolyline | DynmapPolygon | undefined, options: DynmapCircle, converter: Function): DynmapPolyline | DynmapPolygon => {
|
export const updateCircle = (circle: LiveAtlasPolyline | LiveAtlasPolygon | undefined, options: DynmapCircle, converter: Function): LiveAtlasPolyline | LiveAtlasPolygon => {
|
||||||
const outline = (options.style && options.style.fillOpacity && (options.style.fillOpacity <= 0)) as boolean,
|
const outline = (options.style && options.style.fillOpacity && (options.style.fillOpacity <= 0)) as boolean,
|
||||||
points = getCirclePoints(options, converter, outline);
|
points = getCirclePoints(options, converter, outline);
|
||||||
|
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
|
|
||||||
import {DynmapLine} from "@/dynmap";
|
import {DynmapLine} from "@/dynmap";
|
||||||
import {LatLngExpression} from "leaflet";
|
import {LatLngExpression} from "leaflet";
|
||||||
import DynmapPolyline from "@/leaflet/vector/DynmapPolyline";
|
import LiveAtlasPolyline from "@/leaflet/vector/LiveAtlasPolyline";
|
||||||
|
|
||||||
export const createLine = (options: DynmapLine, converter: Function): DynmapPolyline => {
|
export const createLine = (options: DynmapLine, converter: Function): LiveAtlasPolyline => {
|
||||||
const points = getLinePoints(options, converter),
|
const points = getLinePoints(options, converter),
|
||||||
line = new DynmapPolyline(points, {
|
line = new LiveAtlasPolyline(points, {
|
||||||
...options.style,
|
...options.style,
|
||||||
minZoom: options.minZoom,
|
minZoom: options.minZoom,
|
||||||
maxZoom: options.maxZoom,
|
maxZoom: options.maxZoom,
|
||||||
@ -36,7 +36,7 @@ export const createLine = (options: DynmapLine, converter: Function): DynmapPoly
|
|||||||
return line;
|
return line;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const updateLine = (line: DynmapPolyline | undefined, options: DynmapLine, converter: Function): DynmapPolyline => {
|
export const updateLine = (line: LiveAtlasPolyline | undefined, options: DynmapLine, converter: Function): LiveAtlasPolyline => {
|
||||||
const points = getLinePoints(options, converter);
|
const points = getLinePoints(options, converter);
|
||||||
|
|
||||||
if (!line) {
|
if (!line) {
|
||||||
|
@ -19,12 +19,12 @@
|
|||||||
|
|
||||||
import {LeafletMouseEvent, Marker} from "leaflet";
|
import {LeafletMouseEvent, Marker} from "leaflet";
|
||||||
import {DynmapMarker} from "@/dynmap";
|
import {DynmapMarker} from "@/dynmap";
|
||||||
import {DynmapIcon} from "@/leaflet/icon/DynmapIcon";
|
import {GenericIcon} from "@/leaflet/icon/GenericIcon";
|
||||||
import {GenericMarker} from "@/leaflet/marker/GenericMarker";
|
import {GenericMarker} from "@/leaflet/marker/GenericMarker";
|
||||||
|
|
||||||
export const createMarker = (options: DynmapMarker, converter: Function): Marker => {
|
export const createMarker = (options: DynmapMarker, converter: Function): Marker => {
|
||||||
const marker = new GenericMarker(converter(options.location.x, options.location.y, options.location.z), {
|
const marker = new GenericMarker(converter(options.location.x, options.location.y, options.location.z), {
|
||||||
icon: new DynmapIcon({
|
icon: new GenericIcon({
|
||||||
icon: options.icon,
|
icon: options.icon,
|
||||||
label: options.label,
|
label: options.label,
|
||||||
iconSize: options.dimensions,
|
iconSize: options.dimensions,
|
||||||
@ -60,7 +60,7 @@ export const updateMarker = (marker: Marker | undefined, options: DynmapMarker,
|
|||||||
if(marker instanceof GenericMarker) {
|
if(marker instanceof GenericMarker) {
|
||||||
const icon = marker.getIcon();
|
const icon = marker.getIcon();
|
||||||
|
|
||||||
if(icon && icon instanceof DynmapIcon) {
|
if(icon && icon instanceof GenericIcon) {
|
||||||
icon.update({
|
icon.update({
|
||||||
icon: options.icon,
|
icon: options.icon,
|
||||||
label: options.label,
|
label: options.label,
|
||||||
|
Loading…
Reference in New Issue
Block a user