北京经济技术开发区经开区虚拟城市项目-【前端】-移动端Web
少年
2024-03-13 290aa4c2bcd83c584e0b10cab76131c069bf64b7
src/utils/map2.js
@@ -2245,6 +2245,7 @@
//openlayer 地图点击事件
export function setClick(state) {
    function handleClick(e) {
        console.log(e,'地图点击')
        store.setLayerPanelShow(false);
        // 土地管理
        if (store.tdglInfo.flag) {
@@ -2481,4 +2482,24 @@
        zoom: 15,
        duration: 1500
    })
}
}
//监听地图双击事件
export function touchClick() {
    let dom = document.getElementById('openlayerContainer');
    dom.addEventListener('touchstart', onTouchStart);
    function onTouchStart(e) {
        let len = e.touches.length;
        if (len === 2) {
            window.mapapi.getView().animate({
                center: window.mapapi.getView().getCenter(),
                zoom: window.mapapi.getView().getZoom() - 1,
                duration: 1000,
            });
        }
    }
}