Rename _ol_interaction_Select_ to Select
This commit is contained in:
@@ -3,7 +3,7 @@ import View from '../src/ol/View.js';
|
|||||||
import _ol_events_condition_ from '../src/ol/events/condition.js';
|
import _ol_events_condition_ from '../src/ol/events/condition.js';
|
||||||
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
||||||
import DragBox from '../src/ol/interaction/DragBox.js';
|
import DragBox from '../src/ol/interaction/DragBox.js';
|
||||||
import _ol_interaction_Select_ from '../src/ol/interaction/Select.js';
|
import Select from '../src/ol/interaction/Select.js';
|
||||||
import TileLayer from '../src/ol/layer/Tile.js';
|
import TileLayer from '../src/ol/layer/Tile.js';
|
||||||
import VectorLayer from '../src/ol/layer/Vector.js';
|
import VectorLayer from '../src/ol/layer/Vector.js';
|
||||||
import OSM from '../src/ol/source/OSM.js';
|
import OSM from '../src/ol/source/OSM.js';
|
||||||
@@ -33,7 +33,7 @@ var map = new Map({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// a normal select interaction to handle click
|
// a normal select interaction to handle click
|
||||||
var select = new _ol_interaction_Select_();
|
var select = new Select();
|
||||||
map.addInteraction(select);
|
map.addInteraction(select);
|
||||||
|
|
||||||
var selectedFeatures = select.getFeatures();
|
var selectedFeatures = select.getFeatures();
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import View from '../src/ol/View.js';
|
|||||||
import * as _ol_extent_ from '../src/ol/extent.js';
|
import * as _ol_extent_ from '../src/ol/extent.js';
|
||||||
import KML from '../src/ol/format/KML.js';
|
import KML from '../src/ol/format/KML.js';
|
||||||
import {defaults as defaultInteractions} from '../src/ol/interaction.js';
|
import {defaults as defaultInteractions} from '../src/ol/interaction.js';
|
||||||
import _ol_interaction_Select_ from '../src/ol/interaction/Select.js';
|
import Select from '../src/ol/interaction/Select.js';
|
||||||
import TileLayer from '../src/ol/layer/Tile.js';
|
import TileLayer from '../src/ol/layer/Tile.js';
|
||||||
import VectorLayer from '../src/ol/layer/Vector.js';
|
import VectorLayer from '../src/ol/layer/Vector.js';
|
||||||
import Cluster from '../src/ol/source/Cluster.js';
|
import Cluster from '../src/ol/source/Cluster.js';
|
||||||
@@ -142,7 +142,7 @@ var raster = new TileLayer({
|
|||||||
|
|
||||||
var map = new Map({
|
var map = new Map({
|
||||||
layers: [raster, vector],
|
layers: [raster, vector],
|
||||||
interactions: defaultInteractions().extend([new _ol_interaction_Select_({
|
interactions: defaultInteractions().extend([new Select({
|
||||||
condition: function(evt) {
|
condition: function(evt) {
|
||||||
return evt.type == 'pointermove' ||
|
return evt.type == 'pointermove' ||
|
||||||
evt.type == 'singleclick';
|
evt.type == 'singleclick';
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import Feature from '../src/ol/Feature.js';
|
|||||||
import Map from '../src/ol/Map.js';
|
import Map from '../src/ol/Map.js';
|
||||||
import View from '../src/ol/View.js';
|
import View from '../src/ol/View.js';
|
||||||
import Point from '../src/ol/geom/Point.js';
|
import Point from '../src/ol/geom/Point.js';
|
||||||
import _ol_interaction_Select_ from '../src/ol/interaction/Select.js';
|
import Select from '../src/ol/interaction/Select.js';
|
||||||
import TileLayer from '../src/ol/layer/Tile.js';
|
import TileLayer from '../src/ol/layer/Tile.js';
|
||||||
import VectorLayer from '../src/ol/layer/Vector.js';
|
import VectorLayer from '../src/ol/layer/Vector.js';
|
||||||
import Stamen from '../src/ol/source/Stamen.js';
|
import Stamen from '../src/ol/source/Stamen.js';
|
||||||
@@ -46,7 +46,7 @@ var map = new Map({
|
|||||||
});
|
});
|
||||||
|
|
||||||
var selectStyle = {};
|
var selectStyle = {};
|
||||||
var select = new _ol_interaction_Select_({
|
var select = new Select({
|
||||||
style: function(feature) {
|
style: function(feature) {
|
||||||
var image = feature.get('style').getImage().getImage();
|
var image = feature.get('style').getImage().getImage();
|
||||||
if (!selectStyle[image.src]) {
|
if (!selectStyle[image.src]) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import View from '../src/ol/View.js';
|
|||||||
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
||||||
import {defaults as defaultInteractions} from '../src/ol/interaction.js';
|
import {defaults as defaultInteractions} from '../src/ol/interaction.js';
|
||||||
import Modify from '../src/ol/interaction/Modify.js';
|
import Modify from '../src/ol/interaction/Modify.js';
|
||||||
import _ol_interaction_Select_ from '../src/ol/interaction/Select.js';
|
import Select from '../src/ol/interaction/Select.js';
|
||||||
import TileLayer from '../src/ol/layer/Tile.js';
|
import TileLayer from '../src/ol/layer/Tile.js';
|
||||||
import VectorLayer from '../src/ol/layer/Vector.js';
|
import VectorLayer from '../src/ol/layer/Vector.js';
|
||||||
import OSM from '../src/ol/source/OSM.js';
|
import OSM from '../src/ol/source/OSM.js';
|
||||||
@@ -22,7 +22,7 @@ var vector = new VectorLayer({
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
var select = new _ol_interaction_Select_({
|
var select = new Select({
|
||||||
wrapX: false
|
wrapX: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import View from '../src/ol/View.js';
|
|||||||
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
||||||
import {defaults as defaultInteractions} from '../src/ol/interaction.js';
|
import {defaults as defaultInteractions} from '../src/ol/interaction.js';
|
||||||
import Modify from '../src/ol/interaction/Modify.js';
|
import Modify from '../src/ol/interaction/Modify.js';
|
||||||
import _ol_interaction_Select_ from '../src/ol/interaction/Select.js';
|
import Select from '../src/ol/interaction/Select.js';
|
||||||
import VectorLayer from '../src/ol/layer/Vector.js';
|
import VectorLayer from '../src/ol/layer/Vector.js';
|
||||||
import VectorSource from '../src/ol/source/Vector.js';
|
import VectorSource from '../src/ol/source/Vector.js';
|
||||||
import _ol_style_Circle_ from '../src/ol/style/Circle.js';
|
import _ol_style_Circle_ from '../src/ol/style/Circle.js';
|
||||||
@@ -216,7 +216,7 @@ var overlayStyle = (function() {
|
|||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
var select = new _ol_interaction_Select_({
|
var select = new Select({
|
||||||
style: overlayStyle
|
style: overlayStyle
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import Map from '../src/ol/Map.js';
|
|||||||
import View from '../src/ol/View.js';
|
import View from '../src/ol/View.js';
|
||||||
import _ol_events_condition_ from '../src/ol/events/condition.js';
|
import _ol_events_condition_ from '../src/ol/events/condition.js';
|
||||||
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
||||||
import _ol_interaction_Select_ from '../src/ol/interaction/Select.js';
|
import Select from '../src/ol/interaction/Select.js';
|
||||||
import TileLayer from '../src/ol/layer/Tile.js';
|
import TileLayer from '../src/ol/layer/Tile.js';
|
||||||
import VectorLayer from '../src/ol/layer/Vector.js';
|
import VectorLayer from '../src/ol/layer/Vector.js';
|
||||||
import OSM from '../src/ol/source/OSM.js';
|
import OSM from '../src/ol/source/OSM.js';
|
||||||
@@ -31,19 +31,19 @@ var map = new Map({
|
|||||||
var select = null; // ref to currently selected interaction
|
var select = null; // ref to currently selected interaction
|
||||||
|
|
||||||
// select interaction working on "singleclick"
|
// select interaction working on "singleclick"
|
||||||
var selectSingleClick = new _ol_interaction_Select_();
|
var selectSingleClick = new Select();
|
||||||
|
|
||||||
// select interaction working on "click"
|
// select interaction working on "click"
|
||||||
var selectClick = new _ol_interaction_Select_({
|
var selectClick = new Select({
|
||||||
condition: _ol_events_condition_.click
|
condition: _ol_events_condition_.click
|
||||||
});
|
});
|
||||||
|
|
||||||
// select interaction working on "pointermove"
|
// select interaction working on "pointermove"
|
||||||
var selectPointerMove = new _ol_interaction_Select_({
|
var selectPointerMove = new Select({
|
||||||
condition: _ol_events_condition_.pointerMove
|
condition: _ol_events_condition_.pointerMove
|
||||||
});
|
});
|
||||||
|
|
||||||
var selectAltClick = new _ol_interaction_Select_({
|
var selectAltClick = new Select({
|
||||||
condition: function(mapBrowserEvent) {
|
condition: function(mapBrowserEvent) {
|
||||||
return _ol_events_condition_.click(mapBrowserEvent) &&
|
return _ol_events_condition_.click(mapBrowserEvent) &&
|
||||||
_ol_events_condition_.altKeyOnly(mapBrowserEvent);
|
_ol_events_condition_.altKeyOnly(mapBrowserEvent);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import Map from '../src/ol/Map.js';
|
|||||||
import View from '../src/ol/View.js';
|
import View from '../src/ol/View.js';
|
||||||
import Draw from '../src/ol/interaction/Draw.js';
|
import Draw from '../src/ol/interaction/Draw.js';
|
||||||
import Modify from '../src/ol/interaction/Modify.js';
|
import Modify from '../src/ol/interaction/Modify.js';
|
||||||
import _ol_interaction_Select_ from '../src/ol/interaction/Select.js';
|
import Select from '../src/ol/interaction/Select.js';
|
||||||
import _ol_interaction_Snap_ from '../src/ol/interaction/Snap.js';
|
import _ol_interaction_Snap_ from '../src/ol/interaction/Snap.js';
|
||||||
import TileLayer from '../src/ol/layer/Tile.js';
|
import TileLayer from '../src/ol/layer/Tile.js';
|
||||||
import VectorLayer from '../src/ol/layer/Vector.js';
|
import VectorLayer from '../src/ol/layer/Vector.js';
|
||||||
@@ -47,7 +47,7 @@ var map = new Map({
|
|||||||
|
|
||||||
var ExampleModify = {
|
var ExampleModify = {
|
||||||
init: function() {
|
init: function() {
|
||||||
this.select = new _ol_interaction_Select_();
|
this.select = new Select();
|
||||||
map.addInteraction(this.select);
|
map.addInteraction(this.select);
|
||||||
|
|
||||||
this.modify = new Modify({
|
this.modify = new Modify({
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import Map from '../src/ol/Map.js';
|
|||||||
import View from '../src/ol/View.js';
|
import View from '../src/ol/View.js';
|
||||||
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
||||||
import {defaults as defaultInteractions} from '../src/ol/interaction.js';
|
import {defaults as defaultInteractions} from '../src/ol/interaction.js';
|
||||||
import _ol_interaction_Select_ from '../src/ol/interaction/Select.js';
|
import Select from '../src/ol/interaction/Select.js';
|
||||||
import _ol_interaction_Translate_ from '../src/ol/interaction/Translate.js';
|
import _ol_interaction_Translate_ from '../src/ol/interaction/Translate.js';
|
||||||
import TileLayer from '../src/ol/layer/Tile.js';
|
import TileLayer from '../src/ol/layer/Tile.js';
|
||||||
import VectorLayer from '../src/ol/layer/Vector.js';
|
import VectorLayer from '../src/ol/layer/Vector.js';
|
||||||
@@ -21,7 +21,7 @@ var vector = new VectorLayer({
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
var select = new _ol_interaction_Select_();
|
var select = new Select();
|
||||||
|
|
||||||
var translate = new _ol_interaction_Translate_({
|
var translate = new _ol_interaction_Translate_({
|
||||||
features: select.getFeatures()
|
features: select.getFeatures()
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import EsriJSON from '../src/ol/format/EsriJSON.js';
|
|||||||
import {defaults as defaultInteractions} from '../src/ol/interaction.js';
|
import {defaults as defaultInteractions} from '../src/ol/interaction.js';
|
||||||
import Draw from '../src/ol/interaction/Draw.js';
|
import Draw from '../src/ol/interaction/Draw.js';
|
||||||
import Modify from '../src/ol/interaction/Modify.js';
|
import Modify from '../src/ol/interaction/Modify.js';
|
||||||
import _ol_interaction_Select_ from '../src/ol/interaction/Select.js';
|
import Select from '../src/ol/interaction/Select.js';
|
||||||
import TileLayer from '../src/ol/layer/Tile.js';
|
import TileLayer from '../src/ol/layer/Tile.js';
|
||||||
import VectorLayer from '../src/ol/layer/Vector.js';
|
import VectorLayer from '../src/ol/layer/Vector.js';
|
||||||
import _ol_loadingstrategy_ from '../src/ol/loadingstrategy.js';
|
import _ol_loadingstrategy_ from '../src/ol/loadingstrategy.js';
|
||||||
@@ -67,7 +67,7 @@ var draw = new Draw({
|
|||||||
type: 'Polygon'
|
type: 'Polygon'
|
||||||
});
|
});
|
||||||
|
|
||||||
var select = new _ol_interaction_Select_();
|
var select = new Select();
|
||||||
select.setActive(false);
|
select.setActive(false);
|
||||||
var selected = select.getFeatures();
|
var selected = select.getFeatures();
|
||||||
|
|
||||||
|
|||||||
@@ -33,10 +33,10 @@ import _ol_style_Style_ from '../style/Style.js';
|
|||||||
* @fires ol.interaction.Select.Event
|
* @fires ol.interaction.Select.Event
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
var _ol_interaction_Select_ = function(opt_options) {
|
var Select = function(opt_options) {
|
||||||
|
|
||||||
Interaction.call(this, {
|
Interaction.call(this, {
|
||||||
handleEvent: _ol_interaction_Select_.handleEvent
|
handleEvent: Select.handleEvent
|
||||||
});
|
});
|
||||||
|
|
||||||
var options = opt_options ? opt_options : {};
|
var options = opt_options ? opt_options : {};
|
||||||
@@ -94,7 +94,7 @@ var _ol_interaction_Select_ = function(opt_options) {
|
|||||||
wrapX: options.wrapX
|
wrapX: options.wrapX
|
||||||
}),
|
}),
|
||||||
style: options.style ? options.style :
|
style: options.style ? options.style :
|
||||||
_ol_interaction_Select_.getDefaultStyleFunction(),
|
Select.getDefaultStyleFunction(),
|
||||||
updateWhileAnimating: true,
|
updateWhileAnimating: true,
|
||||||
updateWhileInteracting: true
|
updateWhileInteracting: true
|
||||||
});
|
});
|
||||||
@@ -142,7 +142,7 @@ var _ol_interaction_Select_ = function(opt_options) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inherits(_ol_interaction_Select_, Interaction);
|
inherits(Select, Interaction);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -150,7 +150,7 @@ inherits(_ol_interaction_Select_, Interaction);
|
|||||||
* @param {ol.layer.Layer} layer Layer.
|
* @param {ol.layer.Layer} layer Layer.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Select_.prototype.addFeatureLayerAssociation_ = function(feature, layer) {
|
Select.prototype.addFeatureLayerAssociation_ = function(feature, layer) {
|
||||||
var key = getUid(feature);
|
var key = getUid(feature);
|
||||||
this.featureLayerAssociation_[key] = layer;
|
this.featureLayerAssociation_[key] = layer;
|
||||||
};
|
};
|
||||||
@@ -161,7 +161,7 @@ _ol_interaction_Select_.prototype.addFeatureLayerAssociation_ = function(feature
|
|||||||
* @return {ol.Collection.<ol.Feature>} Features collection.
|
* @return {ol.Collection.<ol.Feature>} Features collection.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Select_.prototype.getFeatures = function() {
|
Select.prototype.getFeatures = function() {
|
||||||
return this.featureOverlay_.getSource().getFeaturesCollection();
|
return this.featureOverlay_.getSource().getFeaturesCollection();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ _ol_interaction_Select_.prototype.getFeatures = function() {
|
|||||||
* @returns {number} Hit tolerance in pixels.
|
* @returns {number} Hit tolerance in pixels.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Select_.prototype.getHitTolerance = function() {
|
Select.prototype.getHitTolerance = function() {
|
||||||
return this.hitTolerance_;
|
return this.hitTolerance_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -185,7 +185,7 @@ _ol_interaction_Select_.prototype.getHitTolerance = function() {
|
|||||||
* @return {ol.layer.Vector} Layer.
|
* @return {ol.layer.Vector} Layer.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Select_.prototype.getLayer = function(feature) {
|
Select.prototype.getLayer = function(feature) {
|
||||||
var key = getUid(feature);
|
var key = getUid(feature);
|
||||||
return /** @type {ol.layer.Vector} */ (this.featureLayerAssociation_[key]);
|
return /** @type {ol.layer.Vector} */ (this.featureLayerAssociation_[key]);
|
||||||
};
|
};
|
||||||
@@ -199,7 +199,7 @@ _ol_interaction_Select_.prototype.getLayer = function(feature) {
|
|||||||
* @this {ol.interaction.Select}
|
* @this {ol.interaction.Select}
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Select_.handleEvent = function(mapBrowserEvent) {
|
Select.handleEvent = function(mapBrowserEvent) {
|
||||||
if (!this.condition_(mapBrowserEvent)) {
|
if (!this.condition_(mapBrowserEvent)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -280,7 +280,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_Select_.Event(_ol_interaction_Select_.EventType_.SELECT,
|
new Select.Event(Select.EventType_.SELECT,
|
||||||
selected, deselected, mapBrowserEvent));
|
selected, deselected, mapBrowserEvent));
|
||||||
}
|
}
|
||||||
return _ol_events_condition_.pointerMove(mapBrowserEvent);
|
return _ol_events_condition_.pointerMove(mapBrowserEvent);
|
||||||
@@ -294,7 +294,7 @@ _ol_interaction_Select_.handleEvent = function(mapBrowserEvent) {
|
|||||||
* @param {number} hitTolerance Hit tolerance in pixels.
|
* @param {number} hitTolerance Hit tolerance in pixels.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Select_.prototype.setHitTolerance = function(hitTolerance) {
|
Select.prototype.setHitTolerance = function(hitTolerance) {
|
||||||
this.hitTolerance_ = hitTolerance;
|
this.hitTolerance_ = hitTolerance;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -306,7 +306,7 @@ _ol_interaction_Select_.prototype.setHitTolerance = function(hitTolerance) {
|
|||||||
* @override
|
* @override
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Select_.prototype.setMap = function(map) {
|
Select.prototype.setMap = function(map) {
|
||||||
var currentMap = this.getMap();
|
var currentMap = this.getMap();
|
||||||
var selectedFeatures =
|
var selectedFeatures =
|
||||||
this.featureOverlay_.getSource().getFeaturesCollection();
|
this.featureOverlay_.getSource().getFeaturesCollection();
|
||||||
@@ -324,7 +324,7 @@ _ol_interaction_Select_.prototype.setMap = function(map) {
|
|||||||
/**
|
/**
|
||||||
* @return {ol.StyleFunction} Styles.
|
* @return {ol.StyleFunction} Styles.
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Select_.getDefaultStyleFunction = function() {
|
Select.getDefaultStyleFunction = function() {
|
||||||
var styles = _ol_style_Style_.createDefaultEditing();
|
var styles = _ol_style_Style_.createDefaultEditing();
|
||||||
extend(styles[GeometryType.POLYGON], styles[GeometryType.LINE_STRING]);
|
extend(styles[GeometryType.POLYGON], styles[GeometryType.LINE_STRING]);
|
||||||
extend(styles[GeometryType.GEOMETRY_COLLECTION], styles[GeometryType.LINE_STRING]);
|
extend(styles[GeometryType.GEOMETRY_COLLECTION], styles[GeometryType.LINE_STRING]);
|
||||||
@@ -342,7 +342,7 @@ _ol_interaction_Select_.getDefaultStyleFunction = function() {
|
|||||||
* @param {ol.Collection.Event} evt Event.
|
* @param {ol.Collection.Event} evt Event.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Select_.prototype.addFeature_ = function(evt) {
|
Select.prototype.addFeature_ = function(evt) {
|
||||||
var map = this.getMap();
|
var map = this.getMap();
|
||||||
if (map) {
|
if (map) {
|
||||||
map.skipFeature(/** @type {ol.Feature} */ (evt.element));
|
map.skipFeature(/** @type {ol.Feature} */ (evt.element));
|
||||||
@@ -354,7 +354,7 @@ _ol_interaction_Select_.prototype.addFeature_ = function(evt) {
|
|||||||
* @param {ol.Collection.Event} evt Event.
|
* @param {ol.Collection.Event} evt Event.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Select_.prototype.removeFeature_ = function(evt) {
|
Select.prototype.removeFeature_ = function(evt) {
|
||||||
var map = this.getMap();
|
var map = this.getMap();
|
||||||
if (map) {
|
if (map) {
|
||||||
map.unskipFeature(/** @type {ol.Feature} */ (evt.element));
|
map.unskipFeature(/** @type {ol.Feature} */ (evt.element));
|
||||||
@@ -366,7 +366,7 @@ _ol_interaction_Select_.prototype.removeFeature_ = function(evt) {
|
|||||||
* @param {ol.Feature|ol.render.Feature} feature Feature.
|
* @param {ol.Feature|ol.render.Feature} feature Feature.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Select_.prototype.removeFeatureLayerAssociation_ = function(feature) {
|
Select.prototype.removeFeatureLayerAssociation_ = function(feature) {
|
||||||
var key = getUid(feature);
|
var key = getUid(feature);
|
||||||
delete this.featureLayerAssociation_[key];
|
delete this.featureLayerAssociation_[key];
|
||||||
};
|
};
|
||||||
@@ -386,7 +386,7 @@ _ol_interaction_Select_.prototype.removeFeatureLayerAssociation_ = function(feat
|
|||||||
* @extends {ol.events.Event}
|
* @extends {ol.events.Event}
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Select_.Event = function(type, selected, deselected, mapBrowserEvent) {
|
Select.Event = function(type, selected, deselected, mapBrowserEvent) {
|
||||||
Event.call(this, type);
|
Event.call(this, type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -410,14 +410,14 @@ _ol_interaction_Select_.Event = function(type, selected, deselected, mapBrowserE
|
|||||||
*/
|
*/
|
||||||
this.mapBrowserEvent = mapBrowserEvent;
|
this.mapBrowserEvent = mapBrowserEvent;
|
||||||
};
|
};
|
||||||
inherits(_ol_interaction_Select_.Event, Event);
|
inherits(Select.Event, Event);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {string}
|
* @enum {string}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Select_.EventType_ = {
|
Select.EventType_ = {
|
||||||
/**
|
/**
|
||||||
* Triggered when feature(s) has been (de)selected.
|
* Triggered when feature(s) has been (de)selected.
|
||||||
* @event ol.interaction.Select.Event#select
|
* @event ol.interaction.Select.Event#select
|
||||||
@@ -425,4 +425,4 @@ _ol_interaction_Select_.EventType_ = {
|
|||||||
*/
|
*/
|
||||||
SELECT: 'select'
|
SELECT: 'select'
|
||||||
};
|
};
|
||||||
export default _ol_interaction_Select_;
|
export default Select;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js
|
|||||||
import View from '../../../../src/ol/View.js';
|
import View from '../../../../src/ol/View.js';
|
||||||
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||||
import Interaction from '../../../../src/ol/interaction/Interaction.js';
|
import Interaction from '../../../../src/ol/interaction/Interaction.js';
|
||||||
import _ol_interaction_Select_ from '../../../../src/ol/interaction/Select.js';
|
import Select from '../../../../src/ol/interaction/Select.js';
|
||||||
import VectorLayer from '../../../../src/ol/layer/Vector.js';
|
import VectorLayer from '../../../../src/ol/layer/Vector.js';
|
||||||
import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js';
|
import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js';
|
||||||
import VectorSource from '../../../../src/ol/source/Vector.js';
|
import VectorSource from '../../../../src/ol/source/Vector.js';
|
||||||
@@ -103,8 +103,8 @@ describe('ol.interaction.Select', function() {
|
|||||||
describe('constructor', function() {
|
describe('constructor', function() {
|
||||||
|
|
||||||
it('creates a new interaction', function() {
|
it('creates a new interaction', function() {
|
||||||
var select = new _ol_interaction_Select_();
|
var select = new Select();
|
||||||
expect(select).to.be.a(_ol_interaction_Select_);
|
expect(select).to.be.a(Select);
|
||||||
expect(select).to.be.a(Interaction);
|
expect(select).to.be.a(Interaction);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ describe('ol.interaction.Select', function() {
|
|||||||
|
|
||||||
it('uses the user-provided collection', function() {
|
it('uses the user-provided collection', function() {
|
||||||
var features = new Collection();
|
var features = new Collection();
|
||||||
var select = new _ol_interaction_Select_({features: features});
|
var select = new Select({features: features});
|
||||||
expect(select.getFeatures()).to.be(features);
|
expect(select.getFeatures()).to.be(features);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ describe('ol.interaction.Select', function() {
|
|||||||
var select;
|
var select;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
select = new _ol_interaction_Select_();
|
select = new Select();
|
||||||
map.addInteraction(select);
|
map.addInteraction(select);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -190,7 +190,7 @@ describe('ol.interaction.Select', function() {
|
|||||||
var select;
|
var select;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
select = new _ol_interaction_Select_({
|
select = new Select({
|
||||||
multi: true
|
multi: true
|
||||||
});
|
});
|
||||||
map.addInteraction(select);
|
map.addInteraction(select);
|
||||||
@@ -239,7 +239,7 @@ describe('ol.interaction.Select', function() {
|
|||||||
var select;
|
var select;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
select = new _ol_interaction_Select_({
|
select = new Select({
|
||||||
multi: true
|
multi: true
|
||||||
});
|
});
|
||||||
map.addInteraction(select);
|
map.addInteraction(select);
|
||||||
@@ -272,7 +272,7 @@ describe('ol.interaction.Select', function() {
|
|||||||
describe('with multi set to true', function() {
|
describe('with multi set to true', function() {
|
||||||
|
|
||||||
it('only selects features that pass the filter', function() {
|
it('only selects features that pass the filter', function() {
|
||||||
var select = new _ol_interaction_Select_({
|
var select = new Select({
|
||||||
multi: true,
|
multi: true,
|
||||||
filter: function(feature, layer) {
|
filter: function(feature, layer) {
|
||||||
return feature.get('type') === 'bar';
|
return feature.get('type') === 'bar';
|
||||||
@@ -289,7 +289,7 @@ describe('ol.interaction.Select', function() {
|
|||||||
|
|
||||||
it('only selects features that pass the filter ' +
|
it('only selects features that pass the filter ' +
|
||||||
'using shift single-click', function() {
|
'using shift single-click', function() {
|
||||||
var select = new _ol_interaction_Select_({
|
var select = new Select({
|
||||||
multi: true,
|
multi: true,
|
||||||
filter: function(feature, layer) {
|
filter: function(feature, layer) {
|
||||||
return feature.get('type') === 'bar';
|
return feature.get('type') === 'bar';
|
||||||
@@ -309,7 +309,7 @@ describe('ol.interaction.Select', function() {
|
|||||||
describe('with multi set to false', function() {
|
describe('with multi set to false', function() {
|
||||||
|
|
||||||
it('only selects the first feature that passes the filter', function() {
|
it('only selects the first feature that passes the filter', function() {
|
||||||
var select = new _ol_interaction_Select_({
|
var select = new Select({
|
||||||
multi: false,
|
multi: false,
|
||||||
filter: function(feature, layer) {
|
filter: function(feature, layer) {
|
||||||
return feature.get('type') === 'bar';
|
return feature.get('type') === 'bar';
|
||||||
@@ -324,7 +324,7 @@ describe('ol.interaction.Select', function() {
|
|||||||
|
|
||||||
it('only selects the first feature that passes the filter ' +
|
it('only selects the first feature that passes the filter ' +
|
||||||
'using shift single-click', function() {
|
'using shift single-click', function() {
|
||||||
var select = new _ol_interaction_Select_({
|
var select = new Select({
|
||||||
multi: false,
|
multi: false,
|
||||||
filter: function(feature, layer) {
|
filter: function(feature, layer) {
|
||||||
return feature.get('type') === 'bar';
|
return feature.get('type') === 'bar';
|
||||||
@@ -344,7 +344,7 @@ describe('ol.interaction.Select', function() {
|
|||||||
var interaction;
|
var interaction;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
interaction = new _ol_interaction_Select_();
|
interaction = new Select();
|
||||||
map.addInteraction(interaction);
|
map.addInteraction(interaction);
|
||||||
});
|
});
|
||||||
afterEach(function() {
|
afterEach(function() {
|
||||||
@@ -372,7 +372,7 @@ describe('ol.interaction.Select', function() {
|
|||||||
var interaction;
|
var interaction;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
interaction = new _ol_interaction_Select_();
|
interaction = new Select();
|
||||||
|
|
||||||
expect(interaction.getActive()).to.be(true);
|
expect(interaction.getActive()).to.be(true);
|
||||||
|
|
||||||
@@ -412,7 +412,7 @@ describe('ol.interaction.Select', function() {
|
|||||||
var interaction;
|
var interaction;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
interaction = new _ol_interaction_Select_();
|
interaction = new Select();
|
||||||
expect(interaction.getActive()).to.be(true);
|
expect(interaction.getActive()).to.be(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user