From 6696d4d4b6a693ad166a24bd554f8e1721c1af8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20=C5=BDdila?= Date: Fri, 1 Sep 2023 17:23:27 +0200 Subject: [PATCH] cleanup --- src/leaflet-controller.ts | 6 ++---- src/maplibregl-controller.ts | 6 ++---- src/openlayers-controller.ts | 6 ++---- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/leaflet-controller.ts b/src/leaflet-controller.ts index 247aab9..41929d8 100644 --- a/src/leaflet-controller.ts +++ b/src/leaflet-controller.ts @@ -90,7 +90,7 @@ export function createLeafletMapController( }); } - const ctrl: MapController = { + return { setEventHandler(handler: undefined | ((e: MapEvent) => void)): void { if (handler) { eventHandler = handler; @@ -303,7 +303,5 @@ export function createLeafletMapController( selectedMarker?.getElement()?.classList.toggle("marker-selected", true); }, - }; - - return ctrl; + } satisfies MapController; } diff --git a/src/maplibregl-controller.ts b/src/maplibregl-controller.ts index 90016c4..46c2514 100644 --- a/src/maplibregl-controller.ts +++ b/src/maplibregl-controller.ts @@ -148,7 +148,7 @@ export function createMapLibreGlMapController( return new maplibregl.Marker({ element, offset: [1, -13] }); } - const ctrl: MapController = { + return { setEventHandler(handler: undefined | ((e: MapEvent) => void)): void { if (handler) { eventHandler = handler; @@ -366,7 +366,5 @@ export function createMapLibreGlMapController( selectedMarker?.getElement().classList.toggle("marker-selected", true); }, - }; - - return ctrl; + } satisfies MapController; } diff --git a/src/openlayers-controller.ts b/src/openlayers-controller.ts index 601ccc2..c031692 100644 --- a/src/openlayers-controller.ts +++ b/src/openlayers-controller.ts @@ -183,7 +183,7 @@ export function createOpenLayersMapController( }); }; - const ctrl: MapController = { + return { setEventHandler(handler: undefined | ((e: MapEvent) => void)): void { if (handler) { eventHandler = handler; @@ -399,7 +399,5 @@ export function createOpenLayersMapController( prevSelected = index; }, - }; - - return ctrl; + } satisfies MapController; }