(node)
| 566 | // --------------------------------------------------------------------------- |
| 567 | |
| 568 | function syncWidgets(node) { |
| 569 | const ed = node._ed; |
| 570 | const pointsW = node.widgets.find((w) => w.name === "points_store"); |
| 571 | const coordsW = node.widgets.find((w) => w.name === "coordinates"); |
| 572 | const samplesW = node.widgets.find((w) => w.name === "points_to_sample"); |
| 573 | |
| 574 | if (pointsW) pointsW.value = JSON.stringify(ed.splines); |
| 575 | |
| 576 | const numSamples = samplesW ? samplesW.value : 121; |
| 577 | const interpolated = ed.splines.map((sp) => interpolateSpline(sp, numSamples)); |
| 578 | // Round to integers for pixel-level coordinates |
| 579 | const rounded = interpolated.map((track) => |
| 580 | track.map((p) => ({ x: Math.round(p.x), y: Math.round(p.y) })) |
| 581 | ); |
| 582 | if (coordsW) coordsW.value = JSON.stringify(rounded); |
| 583 | } |
| 584 | |
| 585 | // --------------------------------------------------------------------------- |
| 586 | // Rendering |
no test coverage detected