diff --git a/changelog/upgrade-notes.md b/changelog/upgrade-notes.md index e6ade9f5ef..6ece858999 100644 --- a/changelog/upgrade-notes.md +++ b/changelog/upgrade-notes.md @@ -24,6 +24,7 @@ A number of internal types have been renamed. This will not affect those who us * rename `ol.interaction.ExtentEventType` to `ol.interaction.Extent.EventType` * rename `ol.interaction.DragAndDropEvent` to `ol.interaction.DragAndDrop.Event` * rename `ol.interaction.DragAndDropEventType` to `ol.interaction.DragAndDrop.EventType` + * rename `ol.interaction.SelectEvent` to `ol.interaction.Select.Event` * rename `ol.interaction.TranslateEvent` to `ol.interaction.Translate.Event` * rename `ol.interaction.TranslateEventType` to `ol.interaction.Translate.EventType` * rename `ol.layer.GroupProperty` to `ol.layer.Group.Property` diff --git a/src/ol/interaction/select.js b/src/ol/interaction/select.js index 2a0d007051..ac83b48e2a 100644 --- a/src/ol/interaction/select.js +++ b/src/ol/interaction/select.js @@ -1,5 +1,4 @@ goog.provide('ol.interaction.Select'); -goog.provide('ol.interaction.SelectEvent'); goog.provide('ol.interaction.SelectEventType'); goog.require('ol'); @@ -25,54 +24,13 @@ goog.require('ol.style.Style'); ol.interaction.SelectEventType = { /** * Triggered when feature(s) has been (de)selected. - * @event ol.interaction.SelectEvent#select + * @event ol.interaction.Select.Event#select * @api */ SELECT: 'select' }; -/** - * @classdesc - * Events emitted by {@link ol.interaction.Select} instances are instances of - * this type. - * - * @param {string} type The event type. - * @param {Array.} selected Selected features. - * @param {Array.} deselected Deselected features. - * @param {ol.MapBrowserEvent} mapBrowserEvent Associated - * {@link ol.MapBrowserEvent}. - * @implements {oli.SelectEvent} - * @extends {ol.events.Event} - * @constructor - */ -ol.interaction.SelectEvent = function(type, selected, deselected, mapBrowserEvent) { - ol.events.Event.call(this, type); - - /** - * Selected features array. - * @type {Array.} - * @api - */ - this.selected = selected; - - /** - * Deselected features array. - * @type {Array.} - * @api - */ - this.deselected = deselected; - - /** - * Associated {@link ol.MapBrowserEvent}. - * @type {ol.MapBrowserEvent} - * @api - */ - this.mapBrowserEvent = mapBrowserEvent; -}; -ol.inherits(ol.interaction.SelectEvent, ol.events.Event); - - /** * @classdesc * Interaction for selecting vector features. By default, selected features are @@ -88,7 +46,7 @@ ol.inherits(ol.interaction.SelectEvent, ol.events.Event); * @constructor * @extends {ol.interaction.Interaction} * @param {olx.interaction.SelectOptions=} opt_options Options. - * @fires ol.interaction.SelectEvent + * @fires ol.interaction.Select.Event * @api stable */ ol.interaction.Select = function(opt_options) { @@ -313,7 +271,7 @@ ol.interaction.Select.handleEvent = function(mapBrowserEvent) { } if (selected.length > 0 || deselected.length > 0) { this.dispatchEvent( - new ol.interaction.SelectEvent(ol.interaction.SelectEventType.SELECT, + new ol.interaction.Select.Event(ol.interaction.SelectEventType.SELECT, selected, deselected, mapBrowserEvent)); } return ol.events.condition.pointerMove(mapBrowserEvent); @@ -389,3 +347,44 @@ ol.interaction.Select.prototype.removeFeatureLayerAssociation_ = function(featur var key = ol.getUid(feature); delete this.featureLayerAssociation_[key]; }; + + +/** + * @classdesc + * Events emitted by {@link ol.interaction.Select} instances are instances of + * this type. + * + * @param {string} type The event type. + * @param {Array.} selected Selected features. + * @param {Array.} deselected Deselected features. + * @param {ol.MapBrowserEvent} mapBrowserEvent Associated + * {@link ol.MapBrowserEvent}. + * @implements {oli.SelectEvent} + * @extends {ol.events.Event} + * @constructor + */ +ol.interaction.Select.Event = function(type, selected, deselected, mapBrowserEvent) { + ol.events.Event.call(this, type); + + /** + * Selected features array. + * @type {Array.} + * @api + */ + this.selected = selected; + + /** + * Deselected features array. + * @type {Array.} + * @api + */ + this.deselected = deselected; + + /** + * Associated {@link ol.MapBrowserEvent}. + * @type {ol.MapBrowserEvent} + * @api + */ + this.mapBrowserEvent = mapBrowserEvent; +}; +ol.inherits(ol.interaction.Select.Event, ol.events.Event);