Skip to content

Commit 627640c

Browse files
committed
Don't crash if image anchor is not defined
1 parent 264a271 commit 627640c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/olcs/FeatureConverter.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -718,10 +718,10 @@ class FeatureConverter {
718718
});
719719

720720
if (imageStyle instanceof olStyleIcon) {
721-
bbOptions.pixelOffset = new Cesium.Cartesian2(
722-
image.width / 2 - imageStyle.getAnchor()[0],
723-
image.height / 2 - imageStyle.getAnchor()[1]
724-
);
721+
const anchor = imageStyle.getAnchor();
722+
if (anchor) {
723+
bbOptions.pixelOffset = new Cesium.Cartesian2(image.width / 2 - anchor[0], image.height / 2 - anchor[1]);
724+
}
725725
}
726726

727727
const bb = this.csAddBillboard(billboards, bbOptions, layer, feature, olGeometry, style);

0 commit comments

Comments
 (0)