From 7135cec0fd57dce5cef81605c724f5542d35fd22 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Tue, 6 Sep 2016 09:09:23 +0200 Subject: [PATCH] Rename ol.DragBoxEvent to ol.interaction.DragBox.Event --- changelog/upgrade-notes.md | 1 + src/ol/interaction/dragbox.js | 83 +++++++++++++++++------------------ 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/changelog/upgrade-notes.md b/changelog/upgrade-notes.md index 126b0ecaa2..d97d074f39 100644 --- a/changelog/upgrade-notes.md +++ b/changelog/upgrade-notes.md @@ -10,6 +10,7 @@ A number of internal types have been renamed. This will not affect those who us * rename `ol.CollectionProperty` to `ol.Collection.Property` * rename `ol.DeviceOrientationProperty` to `ol.DeviceOrientation.Property` + * rename `ol.DragBoxEvent` to `ol.interaction.DragBox.Event` * rename `ol.GeolocationProperty` to `ol.Geolocation.Property` * rename `ol.OverlayPositioning` to `ol.Overlay.Positioning` * rename `ol.OverlayProperty` to `ol.Overlay.Property` diff --git a/src/ol/interaction/dragbox.js b/src/ol/interaction/dragbox.js index c7229f1f52..51928325fb 100644 --- a/src/ol/interaction/dragbox.js +++ b/src/ol/interaction/dragbox.js @@ -1,6 +1,5 @@ // FIXME draw drag box goog.provide('ol.interaction.DragBox'); -goog.provide('ol.DragBoxEvent'); goog.require('ol.events.Event'); goog.require('ol'); @@ -24,61 +23,27 @@ ol.DRAG_BOX_HYSTERESIS_PIXELS_SQUARED = ol.DragBoxEventType = { /** * Triggered upon drag box start. - * @event ol.DragBoxEvent#boxstart + * @event ol.interaction.DragBox.Event#boxstart * @api stable */ BOXSTART: 'boxstart', /** * Triggered on drag when box is active. - * @event ol.DragBoxEvent#boxdrag + * @event ol.interaction.DragBox.Event#boxdrag * @api */ BOXDRAG: 'boxdrag', /** * Triggered upon drag box end. - * @event ol.DragBoxEvent#boxend + * @event ol.interaction.DragBox.Event#boxend * @api stable */ BOXEND: 'boxend' }; -/** - * @classdesc - * Events emitted by {@link ol.interaction.DragBox} instances are instances of - * this type. - * - * @param {string} type The event type. - * @param {ol.Coordinate} coordinate The event coordinate. - * @param {ol.MapBrowserEvent} mapBrowserEvent Originating event. - * @extends {ol.events.Event} - * @constructor - * @implements {oli.DragBoxEvent} - */ -ol.DragBoxEvent = function(type, coordinate, mapBrowserEvent) { - ol.events.Event.call(this, type); - - /** - * The coordinate of the drag event. - * @const - * @type {ol.Coordinate} - * @api stable - */ - this.coordinate = coordinate; - - /** - * @const - * @type {ol.MapBrowserEvent} - * @api - */ - this.mapBrowserEvent = mapBrowserEvent; - -}; -ol.inherits(ol.DragBoxEvent, ol.events.Event); - - /** * @classdesc * Allows the user to draw a vector box by clicking and dragging on the map, @@ -92,7 +57,7 @@ ol.inherits(ol.DragBoxEvent, ol.events.Event); * * @constructor * @extends {ol.interaction.Pointer} - * @fires ol.DragBoxEvent + * @fires ol.interaction.DragBox.Event * @param {olx.interaction.DragBoxOptions=} opt_options Options. * @api stable */ @@ -165,7 +130,7 @@ ol.interaction.DragBox.handleDragEvent_ = function(mapBrowserEvent) { this.box_.setPixels(this.startPixel_, mapBrowserEvent.pixel); - this.dispatchEvent(new ol.DragBoxEvent(ol.DragBoxEventType.BOXDRAG, + this.dispatchEvent(new ol.interaction.DragBox.Event(ol.DragBoxEventType.BOXDRAG, mapBrowserEvent.coordinate, mapBrowserEvent)); }; @@ -205,7 +170,7 @@ ol.interaction.DragBox.handleUpEvent_ = function(mapBrowserEvent) { if (this.boxEndCondition_(mapBrowserEvent, this.startPixel_, mapBrowserEvent.pixel)) { this.onBoxEnd(mapBrowserEvent); - this.dispatchEvent(new ol.DragBoxEvent(ol.DragBoxEventType.BOXEND, + this.dispatchEvent(new ol.interaction.DragBox.Event(ol.DragBoxEventType.BOXEND, mapBrowserEvent.coordinate, mapBrowserEvent)); } return false; @@ -228,10 +193,44 @@ ol.interaction.DragBox.handleDownEvent_ = function(mapBrowserEvent) { this.startPixel_ = mapBrowserEvent.pixel; this.box_.setMap(mapBrowserEvent.map); this.box_.setPixels(this.startPixel_, this.startPixel_); - this.dispatchEvent(new ol.DragBoxEvent(ol.DragBoxEventType.BOXSTART, + this.dispatchEvent(new ol.interaction.DragBox.Event(ol.DragBoxEventType.BOXSTART, mapBrowserEvent.coordinate, mapBrowserEvent)); return true; } else { return false; } }; + + +/** + * @classdesc + * Events emitted by {@link ol.interaction.DragBox} instances are instances of + * this type. + * + * @param {string} type The event type. + * @param {ol.Coordinate} coordinate The event coordinate. + * @param {ol.MapBrowserEvent} mapBrowserEvent Originating event. + * @extends {ol.events.Event} + * @constructor + * @implements {oli.DragBoxEvent} + */ +ol.interaction.DragBox.Event = function(type, coordinate, mapBrowserEvent) { + ol.events.Event.call(this, type); + + /** + * The coordinate of the drag event. + * @const + * @type {ol.Coordinate} + * @api stable + */ + this.coordinate = coordinate; + + /** + * @const + * @type {ol.MapBrowserEvent} + * @api + */ + this.mapBrowserEvent = mapBrowserEvent; + +}; +ol.inherits(ol.interaction.DragBox.Event, ol.events.Event);