diff --git a/externs/oli.js b/externs/oli.js index 16498949ee..36a28fea39 100644 --- a/externs/oli.js +++ b/externs/oli.js @@ -35,6 +35,12 @@ oli.DragBoxEvent = function() {}; oli.DragBoxEvent.prototype.coordinate; +/** + * @type {ol.MapBrowserEvent} + */ +oli.DragBoxEvent.prototype.mapBrowserEvent; + + /** * @interface diff --git a/src/ol/interaction/dragboxinteraction.js b/src/ol/interaction/dragboxinteraction.js index ca044f1067..b73893481a 100644 --- a/src/ol/interaction/dragboxinteraction.js +++ b/src/ol/interaction/dragboxinteraction.js @@ -46,11 +46,12 @@ ol.DragBoxEventType = { * * @param {string} type The event type. * @param {ol.Coordinate} coordinate The event coordinate. + * @param {ol.MapBrowserEvent} mapBrowserEvent Originating event. * @extends {goog.events.Event} * @constructor * @implements {oli.DragBoxEvent} */ -ol.DragBoxEvent = function(type, coordinate) { +ol.DragBoxEvent = function(type, coordinate, mapBrowserEvent) { goog.base(this, type); /** @@ -61,6 +62,13 @@ ol.DragBoxEvent = function(type, coordinate) { */ this.coordinate = coordinate; + /** + * @const + * @type {ol.MapBrowserEvent} + * @api + */ + this.mapBrowserEvent = mapBrowserEvent; + }; goog.inherits(ol.DragBoxEvent, goog.events.Event); @@ -169,7 +177,7 @@ ol.interaction.DragBox.handleUpEvent_ = function(mapBrowserEvent) { ol.DRAG_BOX_HYSTERESIS_PIXELS_SQUARED) { this.onBoxEnd(mapBrowserEvent); this.dispatchEvent(new ol.DragBoxEvent(ol.DragBoxEventType.BOXEND, - mapBrowserEvent.coordinate)); + mapBrowserEvent.coordinate, mapBrowserEvent)); } return false; }; @@ -192,7 +200,7 @@ ol.interaction.DragBox.handleDownEvent_ = function(mapBrowserEvent) { this.box_.setMap(mapBrowserEvent.map); this.box_.setPixels(this.startPixel_, this.startPixel_); this.dispatchEvent(new ol.DragBoxEvent(ol.DragBoxEventType.BOXSTART, - mapBrowserEvent.coordinate)); + mapBrowserEvent.coordinate, mapBrowserEvent)); return true; } else { return false;