Skip to content

Commit 553cd6c

Browse files
committed
For some reason maplibre now complains that anchors are not serializable
So we do a manual conversion to an object Signed-off-by: Tristram Gräbener <[email protected]>
1 parent 380193a commit 553cd6c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

wasm/html_demo/index.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,17 @@ async function file_selected(el) {
1818
const curves_features = []
1919
const anchors_features = []
2020
for (let lrm_index = 0; lrm_index < lrs.lrm_len(); lrm_index++) {
21-
const anchors = lrs.get_anchors(lrm_index)
21+
const anchors = lrs.get_anchors(lrm_index).map(a => {
22+
return {
23+
name: a.name,
24+
curve_position: a.curve_position,
25+
scale_position: a.scale_position,
26+
position: (a.position !== undefined) ? {
27+
x: a.position.x,
28+
y: a.position.y,
29+
} : undefined,
30+
}
31+
})
2232
const lrm_id = lrs.get_lrm_scale_id(lrm_index);
2333
const geom = lrs.get_lrm_geom(lrm_index);
2434
const feature = turf.lineString(geom.map(p => [p.x, p.y]), { id: lrm_id, anchors }, {

0 commit comments

Comments
 (0)