Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(geomap): ask for a high-accuracy position when locating
Elian Dorane3ee20f1fd64
diff --git a/apps/client/src/widgets/collections/geomap/MapToolbar.spec.tsx b/apps/client/src/widgets/collections/geomap/MapToolbar.spec.tsxindex 2ab1fb89f3..1356743033 100644--- a/apps/client/src/widgets/collections/geomap/MapToolbar.spec.tsx+++ b/apps/client/src/widgets/collections/geomap/MapToolbar.spec.tsx@@ -178,6 +178,8 @@ describe("geo map MapToolbar", () => {expect(control).toBeInstanceOf(GeolocateControl);// A toggle that follows the device rather than a button that flies there once.expect((control as GeolocateControl).options.trackUserLocation).toBe(true);+ // GPS where the device has it; MapLibre's default settles for a coarse fix.+ expect((control as GeolocateControl).options.positionOptions?.enableHighAccuracy).toBe(true);// The corner this group stands in, lifted above it (see MapToolbar.css).expect(position).toBe("bottom-right");diff --git a/apps/client/src/widgets/collections/geomap/MapToolbar.tsx b/apps/client/src/widgets/collections/geomap/MapToolbar.tsxindex e02361e791..9837559ac9 100644--- a/apps/client/src/widgets/collections/geomap/MapToolbar.tsx+++ b/apps/client/src/widgets/collections/geomap/MapToolbar.tsx@@ -129,7 +129,11 @@ function useGeolocateControl(map: MapLibreGLMap | null) {useEffect(() => {if (!map) return;- const control = new GeolocateControl({ trackUserLocation: true });+ const control = new GeolocateControl({+ trackUserLocation: true,+ // GPS where the device has it, rather than the cell or Wi-Fi fix the default settles for.+ positionOptions: { enableHighAccuracy: true }+ });map.addControl(control, "bottom-right");return () => {