Standard ol controls.
This commit is contained in:
1 parent
9a5808741b
commit
ef8ee5e00e
1 file changed
+8
-1
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user