MCPcopy
hub / github.com/Lightricks/ComfyUI-LTXVideo / syncWidgets

Function syncWidgets

web/js/sparse_track_editor.js:568–583  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

566// ---------------------------------------------------------------------------
567
568function 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

Callers 5

initEditorFunction · 0.85
reloadStateFunction · 0.85
loadBgImageFunction · 0.85
showMenuFunction · 0.85
setupEventsFunction · 0.85

Calls 1

interpolateSplineFunction · 0.85

Tested by

no test coverage detected