From 1128a9b0ba3a1b1636218bd75fe97ea7396190cd Mon Sep 17 00:00:00 2001 From: James Lyne Date: Mon, 14 Dec 2020 15:48:58 +0000 Subject: [PATCH] Don't set a zindex on markers --- src/leaflet/marker/GenericMarker.ts | 12 ++++++++++++ src/util/markers.ts | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 src/leaflet/marker/GenericMarker.ts 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,