handleBrowserEvent: don't compute mouse position if it's not needed. r=erilem (closes #2880)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@10873 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Frédéric Junod
2010-11-05 14:07:40 +00:00
parent 5924c75c9b
commit 34c52fb5a8

View File

@@ -786,10 +786,15 @@ OpenLayers.Events = OpenLayers.Class({
* evt - {Event}
*/
handleBrowserEvent: function (evt) {
var type = evt.type, listeners = this.listeners[type];
if(!listeners || listeners.length == 0) {
// none's listening, bail out
return;
}
if (this.includeXY) {
evt.xy = this.getMousePosition(evt);
}
this.triggerEvent(evt.type, evt);
this.triggerEvent(type, evt);
},
/**