openlayers 注册事件例子

 registerEvents:function() {
this.events = new OpenLayers.Events(this, this.div, null, true);

function onTouchstart(evt) {
OpenLayers.Event.stop(evt, true);
}
this.events.on({
"mousedown": this.onmousedown,
"mousemove": this.onmousemove,
"mouseup": this.onmouseup,
"click": this.onclick,
"mouseout": this.onmouseout,
"dblclick": this.ondblclick,
"touchstart": onTouchstart,
scope: this
});

},

/**
* Method: onmousedown
* When mouse goes down within the popup, make a note of
* it locally, and then do not propagate the mousedown
* (but do so safely so that user can select text inside)
*
* Parameters:
* evt - {Event}
*/
onmousedown: function (evt) {
this.mousedown = true;
OpenLayers.Event.stop(evt, true);
},
原文地址:https://www.cnblogs.com/aoldman/p/4654244.html