首页 > 解决方案 > 如何同时收听单击和双击右键

问题描述

我正在使用带有openlayers的角度。在下面的代码中,map.on方法是监听鼠标左键点击地图区域,左键双击需要使用如下功能:

        this.map.on('dblclick', (evt) =>{

我的问题是,如何同时听单击右键和双击?

代码

    this.map.on('click', (evt) =>{
    ++this.mLeftClicksCount;
    if (this.mLeftClicksCount > 2) {
      this.mLeftClicksCount = 1;
      //(document.getElementById("originLngTextId") as HTMLInputElement).value = "";
      //(document.getElementById("originLngTextId") as HTMLInputElement).value = "";
    }
    
  });
 }
 

标签: javascriptangularmouseeventopenlayers

解决方案


推荐阅读