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