File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 } ) ;
9281 } ,
9382 {
9483 enableHighAccuracy : true ,
95- maximumAge : 0 ,
84+ maximumAge : 1000 ,
9685 timeout : 5000 ,
9786 }
9887 ) ;
You can’t perform that action at this time.
0 commit comments