update source and fire event only if features added
This commit is contained in:
@@ -147,21 +147,21 @@ class DragAndDrop extends Interaction {
|
|||||||
featureProjection: projection,
|
featureProjection: projection,
|
||||||
});
|
});
|
||||||
if (features && features.length > 0) {
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.source_) {
|
|
||||||
this.source_.clear();
|
|
||||||
this.source_.addFeatures(features);
|
|
||||||
}
|
|
||||||
this.dispatchEvent(
|
|
||||||
new DragAndDropEvent(
|
|
||||||
DragAndDropEventType.ADD_FEATURES,
|
|
||||||
file,
|
|
||||||
features,
|
|
||||||
projection
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user