From ef8ee5e00eb09dc1e2860009a1667c8f6fbcda06 Mon Sep 17 00:00:00 2001 From: evlist Date: Fri, 25 Nov 2022 17:10:49 +0100 Subject: [PATCH] Standard ol controls. --- src/components/map/Map.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/map/Map.tsx b/src/components/map/Map.tsx index 4820ea5..cbb340c 100644 --- a/src/components/map/Map.tsx +++ b/src/components/map/Map.tsx @@ -20,6 +20,7 @@ import { useGeographic as olUseGeographic } from 'ol/proj'; import 'ol/ol.css'; import './Map.css'; +import { Collection } from 'ol'; const Map: Component = () => { const [getMap, setMap] = createSignal(null); @@ -62,6 +63,12 @@ const Map: Component = () => { }); }; + const controls = new Collection([ + new Attribution({ collapsible: true }), + new Rotate(), + new ScaleLine({ bar: true }), + // new Control({ element: getLocation.current ?? undefined }), + ]); const olMap = new OlMap({ view: new View({ center: [+state().lon, +state().lat], @@ -75,7 +82,7 @@ const Map: Component = () => { //new VectorLayer({ source: newSource }), ], target: target, - // controls, + controls, }); olMap.on(['moveend'], changeListener); setMap(olMap);