Repository navigation
@remotion/paths: Cut the closing Z command in cutPath() - #12921
Merged
Merged
Conversation
`cutPath()` returned the whole closed path when the cut fell on the closing line, because `cutInstruction()` returned `Z` uncut. Cut it as a line back to the start of the subpath. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — initial review of the two-file diff.
cutPath()closingZhandling —packages/paths/src/cut-path.ts:23-32substitutes theZinstruction with anLto the subpath start before callingcutInstruction(), so a cut that lands on the closing line returns a truncated path instead of the whole shape.- Test coverage —
packages/paths/src/test/cut-path.test.ts:59-73adds a test asserting both the length of the result and that its endpoint matchesgetPointAtLength(path, 250).
I verified the fix against the existing suite (bun test in packages/paths, 110 pass) and manually exercised edge cases: a cut exactly at total length still preserves the trailing Z, cuts landing on a non-final subpath's Z interpolate from the correct subpath start, and the emitted L endpoint matches getPointAtLength(). The Z-to-L substitution is sound because segment.startPoint is that subpath's M point in conductAnalysis().
deepseek-v4.1-flash | 𝕏
Member
|
Thanks! |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

cutPath()returned the whole closed path when the cut length fell on the closing line.cutInstruction()returnedZuncut (there was a TODO for it), so everything up to the end of the shape came back:Zdraws a straight line back to the start of the subpath, socutPath()now cuts it as anLto that point. Cuts past theZ, and paths with more subpaths after it, stay the same.Added a test that checks the length of the result and that it ends at
getPointAtLength(path, 250).I used Claude Code to write this change.