我想得到一些指针事件
是否有任何存档示例或文档?
注意:我将相同的问题提交给“地理信息系统”,但我再次将其添加到Stack Overflow,因为Openlayers官方的github建议将问题发布到Stack Overflow。
我自己找到了解决方案,以便长时间使用:
var longpress = false;
map.on("click",function(e){
(longpress) ? alert("Long Press") : alert("Short Press");
console.log(map.getEventCoordinate(e.pixel));
});
var startTime, endTime;
map.on('pointerdown', function () {
startTime = new Date().getTime();
});
map.on('pointerup', function () {
endTime = new Date().getTime();
console.log(endTime - startTime);
longpress = (endTime - startTime < 500) ? false : true;
});