Merge pull request #300 from giscloud/mouseevents.fix

if map is not loaded don't fire mouse events
This commit is contained in:
Vladimir Agafonkin 2011-09-19 04:28:55 -07:00
commit 3c33167086

View File

@ -415,13 +415,15 @@ L.Map = L.Class.extend({
},
_onMouseClick: function(e) {
if (this.dragging && this.dragging.moved()) { return; }
if (!this._loaded || (this.dragging && this.dragging.moved())) { return; }
this.fire('pre' + e.type);
this._fireMouseEvent(e);
},
_fireMouseEvent: function(e) {
if (!this._loaded) return;
var type = e.type;
type = (type == 'mouseenter' ? 'mouseover' : (type == 'mouseleave' ? 'mouseout' : type));
if (!this.hasEventListeners(type)) { return; }