javascript - 如何同时收听单击和双击右键
问题描述
我正在使用带有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 = "";
}
});
}
解决方案
推荐阅读
- docker - 我必须在 kubernetes 上的 mosquitto 代理中订阅/发布哪个 IP
- php - Laravel 删除查询在哪里为空
- unity3d - 如何禁用游戏对象,使其在再次启动游戏时不会再次打开
- html - 我应该在 reactjs 中使用哪个引导程序版本,使用起来很混乱
- java - 使用 javamoney 1.3 库的 Amort 表
- javascript - ReferenceError:未定义参数
- c# - 如何设置 C# winform 控件相对于窗体右上角的位置?
- javascript - 在页面加载完成时运行 JS 函数 // Firefox 扩展
- javascript - 生成某个数字时如何播放声音?
- c# - 使用 Xamarin.Android 在 C# Windows 窗体应用程序中打开/关闭 Android 设备移动数据