[core] [iOS] Completion handlers for animated methods
Added transition frame and finish functions to CameraOptions. Added Objective-C equivalents to the three main entry points to easeTo() in MGLMapView. Fixes #1581.
This commit is contained in:
committed by
Minh Nguyễn
parent
e3992c41c3
commit
2de0a351a0
@@ -262,6 +262,9 @@ void Transform::_easeTo(const CameraOptions& options, double new_scale, double n
|
||||
state.angle = angle;
|
||||
state.pitch = pitch;
|
||||
|
||||
if (options.transitionFinishFn) {
|
||||
options.transitionFinishFn();
|
||||
}
|
||||
view.notifyMapChange(MapChangeRegionDidChange);
|
||||
} else {
|
||||
view.notifyMapChange(MapChangeRegionWillChangeAnimated);
|
||||
@@ -291,6 +294,9 @@ void Transform::_easeTo(const CameraOptions& options, double new_scale, double n
|
||||
state.pitch = util::interpolate(startP, pitch, t);
|
||||
// At t = 1.0, a DidChangeAnimated notification should be sent from finish().
|
||||
if (t < 1.0) {
|
||||
if (options.transitionFrameFn) {
|
||||
options.transitionFrameFn(t);
|
||||
}
|
||||
view.notifyMapChange(MapChangeRegionIsChanging);
|
||||
}
|
||||
return update;
|
||||
@@ -299,6 +305,9 @@ void Transform::_easeTo(const CameraOptions& options, double new_scale, double n
|
||||
state.panning = false;
|
||||
state.scaling = false;
|
||||
state.rotating = false;
|
||||
if (options.transitionFinishFn) {
|
||||
options.transitionFinishFn();
|
||||
}
|
||||
view.notifyMapChange(MapChangeRegionDidChangeAnimated);
|
||||
}, *easeOptions.duration);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user