Skip to content

Commit 27c74b5

Browse files
committed
Update geolocation.html
update cache
1 parent 0b3da73 commit 27c74b5

1 file changed

Lines changed: 2 additions & 13 deletions

File tree

dist/geolocation.html

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,9 @@
6363
});
6464
console.log(position.toJSON().coords.heading);
6565
// use map.easeTo to orient the camera to the user's current position and heading
66-
// Store last known heading if available
67-
if (typeof window.lastHeading === "undefined") {
68-
window.lastHeading = 0;
69-
}
70-
const currentHeading =
71-
typeof heading === "number" && !isNaN(heading)
72-
? heading
73-
: window.lastHeading;
74-
if (typeof heading === "number" && !isNaN(heading)) {
75-
window.lastHeading = heading;
76-
}
7766
map.easeTo({
7867
center: [longitude, latitude],
79-
bearing: currentHeading,
68+
bearing: heading, // Use heading if available, otherwise default to 0
8069
duration: 1000,
8170
pitch: 50,
8271
});
@@ -92,7 +81,7 @@
9281
},
9382
{
9483
enableHighAccuracy: true,
95-
maximumAge: 0,
84+
maximumAge: 1000,
9685
timeout: 5000,
9786
}
9887
);

0 commit comments

Comments
 (0)