-
Notifications
You must be signed in to change notification settings - Fork 515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add First-Class Support For Listening to onCameraIdle
events
#280
Add First-Class Support For Listening to onCameraIdle
events
#280
Conversation
I believe the use case for the `onCameraIdle` event [1] is large enough that this event should be able to be listened to directly without having to listen to extraneous events via the ChangeNotifier interface. The extraneous events which I think add too much noise when combined with the camera idle event include: * Camera Start/Move Events * Updating Map Options * Adding/Updating/Removing/Clearing a Symbol, Line, or Circle For example, the use case described in flutter-mapbox-gl#131 where a client wants to display symbols within a bounding box after a user pans the map should be able to have first-class support. FWIW, other flutter mapping plugins provide this ability, and it is very useful [2]. Usage: ``` MapboxMap( onCameraIdle: () { print("Camera has idled."); }, ); ``` [1] https://github.com/tobrun/flutter-mapbox-gl/blob/1bbe7ea7adc8030af16a3cdbf5ade2f94ddea6bd/lib/src/controller.dart#L156 [2] https://github.com/flutter/plugins/blob/61775d32f1d1f0997e0e93bb1e8676b96be9d848/packages/google_maps_flutter/google_maps_flutter/lib/src/google_map.dart#L136
95bbe90
to
c6e61e8
Compare
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.
@nicholasray Thank you for the contribution, looks great! If you don't mind, I took the liberty and added a simple one-line example in move_camera.dart, this enables others to see all the plugin's features and makes manual testing easier. Otherwise feel free to revert it, of course.
@m0nac0 Thank you, looks good to me! |
@nicholasray Great, feel free to merge then. |
I don't have write access to merge this PR, but welcome anyone who does :) |
@nicholasray Sorry, I thought you'd be able to merge it after I approved it. |
No worries, thank you! |
* master: [flutter] release v0.6.0 Change gradle version to 3.5.0 instead of 3.6.1 Update Mapbox plugins and gradle iOS: add long press handler (flutter-mapbox-gl#268) [android] Implemented long click for Android (flutter-mapbox-gl#198) [fix] Change default MyLocationTrackingMode to None (flutter-mapbox-gl#285) Add First-Class Support For Listening to `onCameraIdle` events (flutter-mapbox-gl#280) CI: use stable flutter channel also on iOS (flutter-mapbox-gl#270) Implement addImage() to style (flutter-mapbox-gl#269) Add animation duration for animateCamera (flutter-mapbox-gl#259) Document onStyleLoadedCallback (flutter-mapbox-gl#257) example: rename Page to ExamplePage (flutter-mapbox-gl#258)
I believe the use case for the
onCameraIdle
event [1] is large enoughthat this event should be able to be listened to directly without having
to listen to extraneous events via the ChangeNotifier interface. The
extraneous events which I think add too much noise when combined with
the camera idle event include:
For example, the use case described in #131 where a client wants to
display symbols within a bounding box after a user pans the map should
be able to have first-class support. FWIW, other flutter mapping plugins
provide this ability, and it is very useful [2].
Usage:
[1] https://github.com/tobrun/flutter-mapbox-gl/blob/1bbe7ea7adc8030af16a3cdbf5ade2f94ddea6bd/lib/src/controller.dart#L156
[2] https://github.com/flutter/plugins/blob/61775d32f1d1f0997e0e93bb1e8676b96be9d848/packages/google_maps_flutter/google_maps_flutter/lib/src/google_map.dart#L136