Skip to content

Commit

Permalink
fix(MapGL): emit onViewportChange only if user interacted with map
Browse files Browse the repository at this point in the history
  • Loading branch information
stepankuzmin committed Nov 13, 2017
1 parent b8dd30a commit 73555ee
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/MapGL.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@ class MapGL extends PureComponent<Props, State> {
* @param {(mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent)} event
*/
_onViewportChange(event: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent): void {
if (!event.originalEvent) return;

const map: mapboxgl.Map = event.target;
const { lng, lat } = map.getCenter();
const zoom = map.getZoom();
Expand Down

0 comments on commit 73555ee

Please sign in to comment.