Standard ol controls.
This commit is contained in:
parent
9a5808741b
commit
ef8ee5e00e
|
@ -20,6 +20,7 @@ import { useGeographic as olUseGeographic } from 'ol/proj';
|
||||||
|
|
||||||
import 'ol/ol.css';
|
import 'ol/ol.css';
|
||||||
import './Map.css';
|
import './Map.css';
|
||||||
|
import { Collection } from 'ol';
|
||||||
|
|
||||||
const Map: Component = () => {
|
const Map: Component = () => {
|
||||||
const [getMap, setMap] = createSignal<OlMap | null>(null);
|
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({
|
const olMap = new OlMap({
|
||||||
view: new View({
|
view: new View({
|
||||||
center: [+state().lon, +state().lat],
|
center: [+state().lon, +state().lat],
|
||||||
|
@ -75,7 +82,7 @@ const Map: Component = () => {
|
||||||
//new VectorLayer({ source: newSource }),
|
//new VectorLayer({ source: newSource }),
|
||||||
],
|
],
|
||||||
target: target,
|
target: target,
|
||||||
// controls,
|
controls,
|
||||||
});
|
});
|
||||||
olMap.on(['moveend'], changeListener);
|
olMap.on(['moveend'], changeListener);
|
||||||
setMap(olMap);
|
setMap(olMap);
|
||||||
|
|
Loading…
Reference in New Issue