diff --git a/src/leaflet/marker/GenericMarker.ts b/src/leaflet/marker/GenericMarker.ts new file mode 100644 index 0000000..b2ba7de --- /dev/null +++ b/src/leaflet/marker/GenericMarker.ts @@ -0,0 +1,12 @@ +import {MarkerOptions, Marker, Util, LatLngExpression} from 'leaflet'; + +export class GenericMarker extends Marker { + constructor(latLng: LatLngExpression, options: MarkerOptions) { + super(latLng, options); + Util.setOptions(this, options); + } + + _resetZIndex() { + //Don't change the zindex + } +} diff --git a/src/util/markers.ts b/src/util/markers.ts index dd1e7c8..1b3a26f 100644 --- a/src/util/markers.ts +++ b/src/util/markers.ts @@ -2,9 +2,10 @@ import {Marker} from "leaflet"; import {DynmapMarker} from "@/dynmap"; import {DynmapIcon} from "@/leaflet/icon/DynmapIcon"; import {DynmapProjection} from "@/leaflet/projection/DynmapProjection"; +import {GenericMarker} from "@/leaflet/marker/GenericMarker"; export const createMarker = (options: DynmapMarker, projection: DynmapProjection): Marker => { - return new Marker(projection.locationToLatLng(options.location), { + return new GenericMarker(projection.locationToLatLng(options.location), { icon: new DynmapIcon({ icon: options.icon, label: options.label,