Skip to main content

實例方法

實例方法描述
trigger將畫面移至使用者位置。

trigger

trigger()

將畫面移至使用者位置。

範例

// 新增 GeolocateControl
const geolocateCtrl = new mapPlus.GeolocateControl({
positionOptions: {
enableHighAccuracy: false,
},
});
map.addControl( geolocateCtrl , 'bottom-right' );

// 當拖動地圖,將畫面移回使用者位置
map.on('dragend', () => {
geolocateCtrl.trigger();
})