tomchentw / react-google-maps

React.js Google Maps integration component

Home Page:https://tomchentw.github.io/react-google-maps/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Restricting Map Bound

GeFeSTTS opened this issue · comments

Is it possible to set restrict map bound (https://developers.google.com/maps/documentation/javascript/examples/control-bounds-restriction#maps_control_bounds_restriction-javascript) in this library? I tried different ways to block removal from center, but it doesn't work.

const GoogleMaps = withScriptjs(
  withGoogleMap(({institutes}) => (
    <GoogleMap
      defaultOptions={{
        fullscreenControl: false,
        mapTypeControl: false,
        streetViewControl: false,
        center: CENTER,
        zoom: 12,
        restriction: {
          latLngBounds: CENTER,
          strictBounds: false,
        },
      }}
    >
      {institutes.map((institute, index) =>
          renderMarker(institute, index)
        )}
    </GoogleMap>
  ))
);

@GeFeSTTS this package is unmaintained over 4 years. please use @react-google-maps/api instead.