-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[ios] Provide haptic feedback when user rotates to due north #10847
Conversation
This feature requires a device that supports haptic feedback, running iOS 10 or | ||
newer. | ||
*/ | ||
@property(nonatomic, getter=isHapticFeedbackEnabled) BOOL hapticFeedbackEnabled; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we’ll eventually outgrow this single Boolean flag. Something akin to AppKit’s NSHapticFeedbackPattern
enumeration would give us a bit more flexibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which would be the events that may provide haptic feedback?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now, just compass snapping, though #10847 (comment) hints at a couple more possibilities. An enumeration with “haptic feedback levels” would give us room to add more in the future without overwhelming the default behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood, though note that this design locks us into a binary option until v5.0.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a very good point. An enum with just two values (on and off, essentially) would make this easier to extend in the #future
without the need for a deprecation and subsequent breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do we call the on
enum value if we don’t know what future options will be? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking of a bitfield along the lines of MGLDebugMaskOptions
, except perhaps with an All
option that occupies the entire width of the type.
@@ -493,6 +493,19 @@ MGL_EXPORT IB_DESIGNABLE | |||
*/ | |||
@property(nonatomic, getter=isPitchEnabled) BOOL pitchEnabled; | |||
|
|||
/** | |||
A Boolean value that determines whether the user will receive haptic feedback | |||
for certain interactions with the map. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going forward, any gesture that results in a snapping motion should trigger haptic feedback, if only for consistency. What about situations where we limit user interaction without snapping? Eventually we’ll want to implement snapping if the user tilts too far (#2191) or the developer returns NO
in -[MGLMapViewDelegate mapView:shouldChangeFromCamera:toCamera:]
, but these interactions do represent a hard stop currently.
Per discussion, I’ll look into converting |
On second thought, I’d like to just proceed with
|
5169152
to
2d8386b
Compare
2d8386b
to
ab27e24
Compare
This is an embellishment, brought about by the fact that I have a phone that supports it now. 😉
MGLMapView.hapticFeedbackEnabled
, enabled by default./cc @fabian-guerra @akitchen @1ec5