Rename ol.interaction.SelectEvent to ol.interaction.Select.Event

This commit is contained in:
Frederic Junod
2016-09-07 16:46:26 +02:00
parent 82d172545c
commit fa40b59c53
2 changed files with 45 additions and 45 deletions

View File

@@ -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.ExtentEventType` to `ol.interaction.Extent.EventType`
* rename `ol.interaction.DragAndDropEvent` to `ol.interaction.DragAndDrop.Event` * rename `ol.interaction.DragAndDropEvent` to `ol.interaction.DragAndDrop.Event`
* rename `ol.interaction.DragAndDropEventType` to `ol.interaction.DragAndDrop.EventType` * 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.TranslateEvent` to `ol.interaction.Translate.Event`
* rename `ol.interaction.TranslateEventType` to `ol.interaction.Translate.EventType` * rename `ol.interaction.TranslateEventType` to `ol.interaction.Translate.EventType`
* rename `ol.layer.GroupProperty` to `ol.layer.Group.Property` * rename `ol.layer.GroupProperty` to `ol.layer.Group.Property`

View File

@@ -1,5 +1,4 @@
goog.provide('ol.interaction.Select'); goog.provide('ol.interaction.Select');
goog.provide('ol.interaction.SelectEvent');
goog.provide('ol.interaction.SelectEventType'); goog.provide('ol.interaction.SelectEventType');
goog.require('ol'); goog.require('ol');
@@ -25,54 +24,13 @@ goog.require('ol.style.Style');
ol.interaction.SelectEventType = { ol.interaction.SelectEventType = {
/** /**
* Triggered when feature(s) has been (de)selected. * Triggered when feature(s) has been (de)selected.
* @event ol.interaction.SelectEvent#select * @event ol.interaction.Select.Event#select
* @api * @api
*/ */
SELECT: 'select' SELECT: 'select'
}; };
/**
* @classdesc
* Events emitted by {@link ol.interaction.Select} instances are instances of
* this type.
*
* @param {string} type The event type.
* @param {Array.<ol.Feature>} selected Selected features.
* @param {Array.<ol.Feature>} 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.<ol.Feature>}
* @api
*/
this.selected = selected;
/**
* Deselected features array.
* @type {Array.<ol.Feature>}
* @api
*/
this.deselected = deselected;
/**
* Associated {@link ol.MapBrowserEvent}.
* @type {ol.MapBrowserEvent}
* @api
*/
this.mapBrowserEvent = mapBrowserEvent;
};
ol.inherits(ol.interaction.SelectEvent, ol.events.Event);
/** /**
* @classdesc * @classdesc
* Interaction for selecting vector features. By default, selected features are * Interaction for selecting vector features. By default, selected features are
@@ -88,7 +46,7 @@ ol.inherits(ol.interaction.SelectEvent, ol.events.Event);
* @constructor * @constructor
* @extends {ol.interaction.Interaction} * @extends {ol.interaction.Interaction}
* @param {olx.interaction.SelectOptions=} opt_options Options. * @param {olx.interaction.SelectOptions=} opt_options Options.
* @fires ol.interaction.SelectEvent * @fires ol.interaction.Select.Event
* @api stable * @api stable
*/ */
ol.interaction.Select = function(opt_options) { ol.interaction.Select = function(opt_options) {
@@ -313,7 +271,7 @@ ol.interaction.Select.handleEvent = function(mapBrowserEvent) {
} }
if (selected.length > 0 || deselected.length > 0) { if (selected.length > 0 || deselected.length > 0) {
this.dispatchEvent( this.dispatchEvent(
new ol.interaction.SelectEvent(ol.interaction.SelectEventType.SELECT, new ol.interaction.Select.Event(ol.interaction.SelectEventType.SELECT,
selected, deselected, mapBrowserEvent)); selected, deselected, mapBrowserEvent));
} }
return ol.events.condition.pointerMove(mapBrowserEvent); return ol.events.condition.pointerMove(mapBrowserEvent);
@@ -389,3 +347,44 @@ ol.interaction.Select.prototype.removeFeatureLayerAssociation_ = function(featur
var key = ol.getUid(feature); var key = ol.getUid(feature);
delete this.featureLayerAssociation_[key]; 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.<ol.Feature>} selected Selected features.
* @param {Array.<ol.Feature>} 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.<ol.Feature>}
* @api
*/
this.selected = selected;
/**
* Deselected features array.
* @type {Array.<ol.Feature>}
* @api
*/
this.deselected = deselected;
/**
* Associated {@link ol.MapBrowserEvent}.
* @type {ol.MapBrowserEvent}
* @api
*/
this.mapBrowserEvent = mapBrowserEvent;
};
ol.inherits(ol.interaction.Select.Event, ol.events.Event);