Standard ol controls.

This commit is contained in:
Eric van der Vlist 2022-11-25 17:10:49 +01:00
parent 9a5808741b
commit ef8ee5e00e
1 changed files with 8 additions and 1 deletions

View File

@ -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<OlMap | null>(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);