地图组件和 INativeMapContext 均可控制手势与控件。组件属性 zoomGesturesEnabled、moveGesturesEnabled、rotateGesturesEnabled、overlookingGesturesEnabled 用于初始状态;运行时可调用同名 Context 方法动态切换。showScaleControl、showZoomControls 和 showCompass 分别控制比例尺、缩放控件和指南针。
map?.zoomGesturesEnabled(true)map?.moveGesturesEnabled(true)map?.rotateGesturesEnabled(true)map?.overlookingGesturesEnabled(true)map?.showCompass(true)
<baidumap-view id="demoMap":zoomGesturesEnabled="true" :moveGesturesEnabled="true":rotateGesturesEnabled="false" :overlookingGesturesEnabled="false" />
如果页面需要固定视角,可关闭旋转或俯视手势;如果地图用于导航或浏览,通常保留拖动和缩放手势。

上一篇
下一篇