update source and fire event only if features added

This commit is contained in:
mike-000
2020-07-20 16:08:00 +01:00
committed by GitHub
parent c2376455ad
commit 1812ce8b28

View File

@@ -147,21 +147,21 @@ class DragAndDrop extends Interaction {
featureProjection: projection,
});
if (features && features.length > 0) {
if (this.source_) {
this.source_.clear();
this.source_.addFeatures(features);
}
this.dispatchEvent(
new DragAndDropEvent(
DragAndDropEventType.ADD_FEATURES,
file,
features,
projection
)
);
break;
}
}
if (this.source_) {
this.source_.clear();
this.source_.addFeatures(features);
}
this.dispatchEvent(
new DragAndDropEvent(
DragAndDropEventType.ADD_FEATURES,
file,
features,
projection
)
);
}
/**