onViewportChange not triggered using NavigationControl
See original GitHub issueDescribe the bug
Using default map zoom controls not triggering viewport change event in parent <MapGL>
To Reproduce Steps to reproduce the behavior:
- Go to docs example https://urbica.github.io/react-map-gl/#/Controls/NavigationControl
- Edit code block adding
onViewportChange={viewport=>console.log(JSON.stringify(viewport))}
to<MapGL>
component - Open console, drag map center…see new viewport config in console
- Change zoom using
+/-
in NavControl … no output
Expected behavior Would expect event to be triggered using NavigationControl but instead it only seems to affect the map-gl instance
Desktop (please complete the following information):
- OS: Windows
- Browser: Chrome
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Rotation control in NavigationControl doesn't work in react ...
I am having an issue with the rotation control not working for react-map-gl. The map renders without and issue and the zoom in/out...
Read more >react-map-gl | Upgrade Guide
Upgrading to v4. onChangeViewport is removed, use onViewportChange instead; Immutable.js is no longer a dependency; Export experimental.
Read more >PLAY WITH MAPS IN REACT USING MAPBOX
ADDING A MAP COMPONENT. To include a simple map, first import the MapGL and NavigationControl to show the map and the controls on...
Read more >react-map-gl - You.com | The Search Engine You Control
react-map-gl makes using Mapbox GL JS in React applications easy. ... by onViewportChanged will now contain additional state fields (tracking not only pitch ......
Read more >Fit viewport to markers using react-map-gl - DEV Community
In this post I'm gonna show you how to fit the map viewport to the markers we have ... { Marker, NavigationControl }...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for the research, @jperals!
Unfortunately we can’t remove check for
originalEvent
because it is the only way to detect user-initiated events. The most concise way to fix this issue, IMO, is to addoriginalEvent
to events initiated usingNavigationControl
.I’ve created PR for this in
mapbox-gl-js
repo https://github.com/mapbox/mapbox-gl-js/pull/8693Hey @jperals! It would be really great! PRs are welcome!