You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// convert bearing so that it's numerically close to the current one so that it interpolates properly_normalizeBearing: function(bearing,currentBearing){bearing=util.wrap(bearing,-180,180);vardiff=Math.abs(bearing-currentBearing);if(Math.abs(bearing-360-currentBearing)<diff)bearing-=360;if(Math.abs(bearing+360-currentBearing)<diff)bearing+=360;returnbearing;},
Personally, I view ignoring bearing changes that end ~±7º of north as a UX enhancement (mapbox/mapbox-gl-native/pull/938), but this current implementation acts on relative bearing changes and results in small rotations resetting the rotation entirely, regardless of the current bearing.
The text was updated successfully, but these errors were encountered:
Hmm, this is not from _normalizeBearing but from a click event getting triggered on the button at the end of the gesture and thus resetting to north. Will fix.
That does make more sense, I figured I just wasn't seeing the problem with the math. Thanks @jfirebaugh, and sorry to impugn your arithmetic, @mourner. 😉
As an aside, is there enough interest in non-bug-induced compass snapping that I should spin that off into its own discussion?
When dragging the compass navigation control to rotate the map, rotations less than 4.5º are normalized to 0.
The relevant code in js/ui/easings.js (L341-L348):
Also see @mourner's original commit f5c640a.
Personally, I view ignoring bearing changes that end ~±7º of north as a UX enhancement (mapbox/mapbox-gl-native/pull/938), but this current implementation acts on relative bearing changes and results in small rotations resetting the rotation entirely, regardless of the current bearing.
The text was updated successfully, but these errors were encountered: