Skip to content

Commit 644b166

Browse files
fix(cli): check sees an SVG stroke drawing on, so it no longer calls it a dead stretch (heygen-com#7250)
1 parent 0a6746e commit 644b166

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

‎packages/cli/src/commands/motion-signature.browser.chromium.test.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,21 @@ describe.skipIf(!RUNS_CHROMIUM)("motion-signature.browser in Chromium", () => {
346346
expect(after.liveness).not.toBe(before.liveness);
347347
});
348348

349+
it("sees an SVG stroke drawing on, which moves no box and no color", async () => {
350+
await load(
351+
composition(
352+
"",
353+
'<svg width="400" height="200"><path id="line" d="M10 150 C 100 10, 300 10, 390 150" fill="none" stroke="#111" stroke-width="8" stroke-dasharray="600" stroke-dashoffset="600" /></svg>',
354+
),
355+
);
356+
const before = await sample();
357+
await mutate('document.getElementById("line").style.strokeDashoffset = "300"');
358+
const after = await sample();
359+
360+
expect(after.sweep).not.toBe(before.sweep);
361+
expect(after.liveness).not.toBe(before.liveness);
362+
});
363+
349364
it("sees an SVG shape's fill color change", async () => {
350365
await load(
351366
composition(

‎packages/cli/src/commands/motion-signature.browser.js‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,14 @@
171171
const values = STROKE_EDGES.map((edge) => drawnColor(ctx.style, edge));
172172
return values.some(Boolean) ? hashFields(values) : "";
173173
}
174-
const contentPaintChannel = paintChannel(["color", "textShadow", "fill", "stroke"]);
174+
const contentPaintChannel = paintChannel([
175+
"color",
176+
"textShadow",
177+
"fill",
178+
"stroke",
179+
"strokeDashoffset",
180+
"strokeDasharray",
181+
]);
175182

176183
// Direct text nodes only: descendants are signed separately, and a hidden
177184
// descendant's text mutation must not masquerade as visible motion.

0 commit comments

Comments
 (0)