Skip to content

Commit

Permalink
feature: adapt to image property of custom style for custom style ico…
Browse files Browse the repository at this point in the history
…n in legend (#1961)
  • Loading branch information
Grammostola authored Mar 22, 2024
1 parent 183381e commit 542542a
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/controls/legend/imagesource.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
const getSource = (style) => {
if ('image' in style) {
if (style.image.src) {
return style.image.src;
}
throw new Error('image style must have src');
}
return null;
const image = style.image || style.custom.image;
if (!image) return null;
const src = image.src || null;
if (!src) throw new Error('image style must have src');
else return src;
};

// return the image source from an origo style
Expand Down

0 comments on commit 542542a

Please sign in to comment.