简体   繁体   中英

React-Native-Maps: set Map Boundaries function is not accurate

I want to limit the region in which the user can scroll over the map. For this, I use the function

this.mapViewRef.current.setMapBoundaries(
        { latitude: 52.519972, longitude: 13.348412 },
        { latitude: 52.504231, longitude: 13.318503 }
      );

As a limitation I add northeast and southwest to the function. The map is limited, but the region I can scroll over is always larger than the area I specified. For example, the SouthWest point is 52.498114, 13.313054 instead of 52.504231, 13.318503.

Thanks alot.

The setMapBoundaries method uses the lat/lng of the maps center point as it's marker. It does not stop the edges of the viewport itself from scrolling past the specified values.

So for instance, if you set your NE value as latitude: 52.519972, longitude: 13.348412 , the center of the map will not be scrollable past that point.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM