Skip to content

Commit dcfaf8e

Browse files
Use high accuracy mode
1 parent 3826f98 commit dcfaf8e

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/components/MapLocator.svelte

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
<script lang="ts">
2-
import type { Coordinate } from "ol/coordinate";
3-
import Geolocation from "ol/Geolocation";
4-
import Icon from "ol/style/Icon";
5-
import Style from "ol/style/Style";
6-
import MapControl from "./MapControl.svelte";
7-
import Control from "../ol/Control.svelte";
8-
import Feature from "../ol/Feature.svelte";
9-
import { getOlContext } from "../ol/Map.svelte";
10-
import VectorLayer from "../ol/VectorLayer.svelte";
11-
import onMountTick from "../utils/onMountTick";
2+
import Geolocation from "ol/Geolocation"
3+
import type { Coordinate } from "ol/coordinate"
4+
import Icon from "ol/style/Icon"
5+
import Style from "ol/style/Style"
6+
import Feature from "../ol/Feature.svelte"
7+
import { getOlContext } from "../ol/Map.svelte"
8+
import VectorLayer from "../ol/VectorLayer.svelte"
9+
import MapControl from "./MapControl.svelte"
1210
1311
const { map } = getOlContext();
1412
1513
let tracking = false;
1614
let position: Coordinate;
1715
18-
let geolocation = new Geolocation({ projection: map.getView().getProjection() });
16+
let geolocation = new Geolocation({
17+
projection: map.getView().getProjection(),
18+
trackingOptions: {
19+
enableHighAccuracy: true
20+
}
21+
});
1922
geolocation.on("change", (e) => {
2023
position = geolocation.getPosition();
2124
});

0 commit comments

Comments
 (0)