|
1 | 1 | <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" |
12 | 10 |
|
13 | 11 | const { map } = getOlContext();
|
14 | 12 |
|
15 | 13 | let tracking = false;
|
16 | 14 | let position: Coordinate;
|
17 | 15 |
|
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 | + }); |
19 | 22 | geolocation.on("change", (e) => {
|
20 | 23 | position = geolocation.getPosition();
|
21 | 24 | });
|
|
0 commit comments