[英]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. 例如,西南点是52.498114,13.313054,而不是52.504231,13.318503。
Thanks alot. 非常感谢。
The setMapBoundaries
method uses the lat/lng of the maps center point as it's marker. setMapBoundaries
方法使用地图中心点的经度/纬度作为标记。 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. 因此,例如,如果将NE值设置为latitude: 52.519972, longitude: 13.348412
,则地图的中心将无法滚动到该点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.