Skip to content

Commit

Permalink
add posibility of setting zoom by props (#492)
Browse files Browse the repository at this point in the history
Co-authored-by: Jakub Kolebaba <jakub@kolebaba.cz>
  • Loading branch information
MartinN3 and kolebjak authored Mar 11, 2023
1 parent d7e963e commit d55126e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ const Map = (props: MapProps) => {
if (map && center) {
const centerCoords = window.SMap.Coords.fromWGS84(center.lng, center.lat);
map.setCenter(centerCoords, animateCenterZoom);
zoom !== undefined && map.setZoom(zoom)
}
}, [center]);
}, [center, zoom, map]);

useImperativeHandle(props.mapRef, () => map);

Expand Down

0 comments on commit d55126e

Please sign in to comment.