diff --git a/changelog/upgrade-notes.md b/changelog/upgrade-notes.md index d97d074f39..90a20e4cda 100644 --- a/changelog/upgrade-notes.md +++ b/changelog/upgrade-notes.md @@ -11,6 +11,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.DragBoxEventType` to `ol.interaction.DragBox.EventType` * 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 51928325fb..49a8af1d17 100644 --- a/src/ol/interaction/dragbox.js +++ b/src/ol/interaction/dragbox.js @@ -17,33 +17,6 @@ ol.DRAG_BOX_HYSTERESIS_PIXELS_SQUARED = ol.DRAG_BOX_HYSTERESIS_PIXELS; -/** - * @enum {string} - */ -ol.DragBoxEventType = { - /** - * Triggered upon drag box start. - * @event ol.interaction.DragBox.Event#boxstart - * @api stable - */ - BOXSTART: 'boxstart', - - /** - * Triggered on drag when box is active. - * @event ol.interaction.DragBox.Event#boxdrag - * @api - */ - BOXDRAG: 'boxdrag', - - /** - * Triggered upon drag box end. - * @event ol.interaction.DragBox.Event#boxend - * @api stable - */ - BOXEND: 'boxend' -}; - - /** * @classdesc * Allows the user to draw a vector box by clicking and dragging on the map, @@ -130,7 +103,7 @@ ol.interaction.DragBox.handleDragEvent_ = function(mapBrowserEvent) { this.box_.setPixels(this.startPixel_, mapBrowserEvent.pixel); - this.dispatchEvent(new ol.interaction.DragBox.Event(ol.DragBoxEventType.BOXDRAG, + this.dispatchEvent(new ol.interaction.DragBox.Event(ol.interaction.DragBox.EventType.BOXDRAG, mapBrowserEvent.coordinate, mapBrowserEvent)); }; @@ -170,7 +143,7 @@ ol.interaction.DragBox.handleUpEvent_ = function(mapBrowserEvent) { if (this.boxEndCondition_(mapBrowserEvent, this.startPixel_, mapBrowserEvent.pixel)) { this.onBoxEnd(mapBrowserEvent); - this.dispatchEvent(new ol.interaction.DragBox.Event(ol.DragBoxEventType.BOXEND, + this.dispatchEvent(new ol.interaction.DragBox.Event(ol.interaction.DragBox.EventType.BOXEND, mapBrowserEvent.coordinate, mapBrowserEvent)); } return false; @@ -193,7 +166,7 @@ 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.interaction.DragBox.Event(ol.DragBoxEventType.BOXSTART, + this.dispatchEvent(new ol.interaction.DragBox.Event(ol.interaction.DragBox.EventType.BOXSTART, mapBrowserEvent.coordinate, mapBrowserEvent)); return true; } else { @@ -202,6 +175,33 @@ ol.interaction.DragBox.handleDownEvent_ = function(mapBrowserEvent) { }; +/** + * @enum {string} + */ +ol.interaction.DragBox.EventType = { + /** + * Triggered upon drag box start. + * @event ol.interaction.DragBox.Event#boxstart + * @api stable + */ + BOXSTART: 'boxstart', + + /** + * Triggered on drag when box is active. + * @event ol.interaction.DragBox.Event#boxdrag + * @api + */ + BOXDRAG: 'boxdrag', + + /** + * Triggered upon drag box end. + * @event ol.interaction.DragBox.Event#boxend + * @api stable + */ + BOXEND: 'boxend' +}; + + /** * @classdesc * Events emitted by {@link ol.interaction.DragBox} instances are instances of