Merge pull request #8768 from schmidtk/ts-interaction-select

Fix type check errors in ol/interaction/Select
This commit is contained in:
Andreas Hocevar
2018-10-03 11:10:50 +02:00
committed by GitHub
+4 -5
View File
@@ -254,7 +254,7 @@ class Select extends Interaction {
*/ */
this.featureLayerAssociation_ = {}; this.featureLayerAssociation_ = {};
const features = this.featureOverlay_.getSource().getFeaturesCollection(); const features = this.getFeatures();
listen(features, CollectionEventType.ADD, listen(features, CollectionEventType.ADD,
this.addFeature_, this); this.addFeature_, this);
listen(features, CollectionEventType.REMOVE, listen(features, CollectionEventType.REMOVE,
@@ -277,7 +277,7 @@ class Select extends Interaction {
* @api * @api
*/ */
getFeatures() { getFeatures() {
return this.featureOverlay_.getSource().getFeaturesCollection(); return /** @type {VectorSource} */ (this.featureOverlay_.getSource()).getFeaturesCollection();
} }
/** /**
@@ -334,8 +334,7 @@ class Select extends Interaction {
*/ */
setMap(map) { setMap(map) {
const currentMap = this.getMap(); const currentMap = this.getMap();
const selectedFeatures = const selectedFeatures = this.getFeatures();
this.featureOverlay_.getSource().getFeaturesCollection();
if (currentMap) { if (currentMap) {
selectedFeatures.forEach(currentMap.unskipFeature.bind(currentMap)); selectedFeatures.forEach(currentMap.unskipFeature.bind(currentMap));
} }
@@ -395,7 +394,7 @@ function handleEvent(mapBrowserEvent) {
const toggle = this.toggleCondition_(mapBrowserEvent); const toggle = this.toggleCondition_(mapBrowserEvent);
const set = !add && !remove && !toggle; const set = !add && !remove && !toggle;
const map = mapBrowserEvent.map; const map = mapBrowserEvent.map;
const features = this.featureOverlay_.getSource().getFeaturesCollection(); const features = this.getFeatures();
const deselected = []; const deselected = [];
const selected = []; const selected = [];
if (set) { if (set) {