From 43b8a72e62122117df731f24e721f0e6e008b9e9 Mon Sep 17 00:00:00 2001 From: Antoine Abt Date: Thu, 19 Dec 2013 15:41:52 +0100 Subject: [PATCH] Add ol.DragBoxEvent --- src/ol/interaction/dragboxinteraction.exports | 3 ++ src/ol/interaction/dragboxinteraction.js | 43 +++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/src/ol/interaction/dragboxinteraction.exports b/src/ol/interaction/dragboxinteraction.exports index 13c1329169..8678205ef9 100644 --- a/src/ol/interaction/dragboxinteraction.exports +++ b/src/ol/interaction/dragboxinteraction.exports @@ -1 +1,4 @@ @exportSymbol ol.interaction.DragBox + +@exportSymbol ol.DragBoxEvent +@exportProperty ol.DragBoxEvent.prototype.getCoordinate diff --git a/src/ol/interaction/dragboxinteraction.js b/src/ol/interaction/dragboxinteraction.js index 81c03af21f..6eb31f6434 100644 --- a/src/ol/interaction/dragboxinteraction.js +++ b/src/ol/interaction/dragboxinteraction.js @@ -1,9 +1,11 @@ // FIXME draw drag box // FIXME works for View2D only +goog.provide('ol.DragBoxEvent'); goog.provide('ol.interaction.DragBox'); goog.require('goog.asserts'); +goog.require('goog.events.Event'); goog.require('ol.events.ConditionType'); goog.require('ol.events.condition'); goog.require('ol.interaction.Drag'); @@ -24,6 +26,47 @@ ol.DRAG_BOX_HYSTERESIS_PIXELS_SQUARED = ol.DRAG_BOX_HYSTERESIS_PIXELS; +/** + * @enum {string} + */ +ol.DragBoxEventType = { + BOXSTART: 'boxstart', + BOXEND: 'boxend' +}; + + + +/** + * Object representing a dragbox event. + * + * @param {string} type The event type. + * @param {ol.Coordinate} coordinate The event coordinate. + * @extends {goog.events.Event} + * @constructor + */ +ol.DragBoxEvent = function(type, coordinate) { + goog.base(this, type); + + /** + * The coordinate of the drag event. + * @type {ol.Coordinate} + * @private + */ + this.coordinate_ = coordinate; + +}; +goog.inherits(ol.DragBoxEvent, goog.events.Event); + + +/** + * Get the name of the property associated with this event. + * @return {ol.Coordinate} Event coordinate. + */ +ol.DragBoxEvent.prototype.getCoordinate = function() { + return this.coordinate_; +}; + + /** * @constructor