Skip to content

Commit

Permalink
Merge pull request #1857 from origo-map/draganddrop-style-fix
Browse files Browse the repository at this point in the history
fix: style for all types in draganddrop
  • Loading branch information
johnnyblasta authored Oct 20, 2023
2 parents 1da8d53 + e6694df commit ad28448
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/controls/draganddrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,15 @@ const DragAndDrop = function DragAndDrop(options = {}) {
features: event.features
};
if (!styleByAttribute) {
layerOptions.styleDef = featureStyles[event.features[0].getGeometry().getType()];
let styles = [];
const types = [];
event.features.forEach((feature) => {
if (!types.includes(feature.getGeometry().getType())) {
styles = styles.concat(featureStyles[feature.getGeometry().getType()]);
}
types.push(feature.getGeometry().getType());
});
layerOptions.styleDef = styles;
}
const layer = viewer.addLayer(layerOptions);
if (zoomToExtentOnLoad) {
Expand Down

0 comments on commit ad28448

Please sign in to comment.