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
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
It shouldn't be the responsibility of the view implementation to set up a timer to resend the notification after a delay -- notifications should just be dispatched at the right time.
This is not a delay; it relates to the animation timeouts used. For example, if Cocoa tells the map to move on a 300ms animation, the Map/Transform are authoritative on whether that animation completed or not, and should send the completion notification at the end of the delay.
Also MGLMapView shouldn't need to dispatch notifyMapChange manually:
It does this because each platform is responsible for the velocity-based deceleration that feels right on that platform, which means differing durations.
Sure. But the point of this bug is: given an easing operation is started on Map with a particular duration, then Map should have sole responsibility for dispatching notifications of the progress of that easing operation.
Not just the easing duration, but also the timing curve, are done Cocoa-side. This isn't done as an atomic duration on the GL side, but rather a series of sub-durations.
If this is necessary, then the notifications have to be done entirely Cocoa-side, and the MBGLView::notifyMapChange implementation should be a no-op.
The current behavior is that each call to mbglMap->moveBy generates a MapChangeRegion[Will/Did]Change[Animated] notification pair, and then MGLMapView dispatches another MapChangeRegionDidChangeAnimated notification of its own.
the MBGLView::notifyMapChange implementation should be a no-op
FWIW, I introduced this whole system in order to start tapping into render lifecycle events to an extent that we've not been able to before, in order to get at things like -[MKMapViewDelegate mapViewDidFinishRenderingMap:fullyRendered:] that devs need in order to do detailed view interplay with maps.
From the docs, it doesn't sound to me like this is true. Both - mapView:regionWillChangeAnimated: and - mapView:regionDidChangeAnimated: state:
During scrolling, this method may be called many times to report updates to the map position. Therefore, your implementation of this method should be as lightweight as possible to avoid affecting scrolling performance.
I meant one notification in the context of one per set of changes — if you make one move, you may get one notification out of MapKit, but for the equivalent change in GL, you might get a willChangeAnimated:YES because the system knows that you are kicking off an animation viewport change, then get a series of didChangeAnimated: with either YES or NO depending on how well you are tracking the kickoff notification and how the current one relates to it.
Additionally, our raster SDK improved upon Apple's implementation to make this more reliable for the user, posting only a single will and a single did notification (while still offering mapViewRegionDidChange for those who needed continuous updates), plus separated them out as to whether they were gesture- (examples: finger gestures, compass tap, or tracking mode change) or system-induced (e.g. updating user location tracking or a programmatic change related to change of another UI element).
We are basically walking a line somewhere between MapKit and up to / ideally including our raster SDK's behavior here.
Yeah, exactly — that flow captures it just right. These are things devs want (in addition to rendering start/finish and user interaction indication, which are out of scope here maybe) in order to sync up other UI elements.
Activity
incanus commentedon Mar 19, 2015
This is not a delay; it relates to the animation timeouts used. For example, if Cocoa tells the map to move on a
300msanimation, theMap/Transformare authoritative on whether that animation completed or not, and should send the completion notification at the end of the delay.incanus commentedon Mar 19, 2015
For context on the need for these, see callbacks like
-[MKMapViewDelegate mapView:regionDidChangeAnimated:].https://developer.apple.com/library/ios/documentation/MapKit/Reference/MKMapViewDelegate_Protocol/index.html#//apple_ref/occ/intfm/MKMapViewDelegate/mapView:regionDidChangeAnimated:
jfirebaugh commentedon Mar 19, 2015
They should be -- that's what I'm suggesting in this issue. But it doesn't look to me like that's the current behavior.
See, e.g.
mapbox-gl-native/src/mbgl/map/transform.cpp
Lines 286 to 289 in b4dbba9
and
mapbox-gl-native/platform/ios/MGLMapView.mm
Lines 1629 to 1637 in b4dbba9
jfirebaugh commentedon Mar 19, 2015
Also
MGLMapViewshouldn't need to dispatchnotifyMapChangemanually:mapbox-gl-native/platform/ios/MGLMapView.mm
Lines 586 to 598 in b4dbba9
incanus commentedon Mar 19, 2015
It does this because each platform is responsible for the velocity-based deceleration that feels right on that platform, which means differing durations.
jfirebaugh commentedon Mar 19, 2015
Sure. But the point of this bug is: given an easing operation is started on
Mapwith a particular duration, thenMapshould have sole responsibility for dispatching notifications of the progress of that easing operation.Make sense?
incanus commentedon Mar 19, 2015
Not just the easing duration, but also the timing curve, are done Cocoa-side. This isn't done as an atomic duration on the GL side, but rather a series of sub-durations.
mapbox-gl-native/platform/ios/MGLMapView.mm
Lines 570 to 584 in b4dbba9
But you only want one notification.
I'm not saying this is the best/only way, but giving some context for why it is how it is now and why it might be the only way.
jfirebaugh commentedon Mar 19, 2015
If this is necessary, then the notifications have to be done entirely Cocoa-side, and the
MBGLView::notifyMapChangeimplementation should be a no-op.The current behavior is that each call to
mbglMap->moveBygenerates aMapChangeRegion[Will/Did]Change[Animated]notification pair, and then MGLMapView dispatches anotherMapChangeRegionDidChangeAnimatednotification of its own.incanus commentedon Mar 19, 2015
FWIW, I introduced this whole system in order to start tapping into render lifecycle events to an extent that we've not been able to before, in order to get at things like
-[MKMapViewDelegate mapViewDidFinishRenderingMap:fullyRendered:]that devs need in order to do detailed view interplay with maps.https://developer.apple.com/library/ios/documentation/MapKit/Reference/MKMapViewDelegate_Protocol/index.html#//apple_ref/occ/intfm/MKMapViewDelegate/mapViewDidFinishRenderingMap:fullyRendered:
Perhaps using it for viewport changes as well is ill-advised. It's sounding like it.
jfirebaugh commentedon Jun 24, 2015
From the docs, it doesn't sound to me like this is true. Both
- mapView:regionWillChangeAnimated:and- mapView:regionDidChangeAnimated:state:incanus commentedon Jun 24, 2015
I meant one notification in the context of one per set of changes — if you make one move, you may get one notification out of MapKit, but for the equivalent change in GL, you might get a
willChangeAnimated:YESbecause the system knows that you are kicking off an animation viewport change, then get a series ofdidChangeAnimated:with eitherYESorNOdepending on how well you are tracking the kickoff notification and how the current one relates to it.Additionally, our raster SDK improved upon Apple's implementation to make this more reliable for the user, posting only a single
willand a singledidnotification (while still offeringmapViewRegionDidChangefor those who needed continuous updates), plus separated them out as to whether they were gesture- (examples: finger gestures, compass tap, or tracking mode change) or system-induced (e.g. updating user location tracking or a programmatic change related to change of another UI element).We are basically walking a line somewhere between MapKit and up to / ideally including our raster SDK's behavior here.
jfirebaugh commentedon Jun 25, 2015
I think you meant
mapViewRegionIsChanging-- I didn't realize this existed, and now thing make more sense. So the intended series of events:For an unanimated change:
RegionWillChangeRegionDidChangeFor an animated change:
RegionWillChangeAnimatedRegionIsChanging(repeated)RegionDidChangeAnimatedincanus commentedon Jun 25, 2015
Yeah, exactly — that flow captures it just right. These are things devs want (in addition to rendering start/finish and user interaction indication, which are out of scope here maybe) in order to sync up other UI elements.
Remove duration argument from View::notifyMapChange
Document iOS region change delegate methods
Document iOS region change delegate methods