Skip to content

Fix marker viewport clipping with preserveAspectRatio - #1163

Merged
LaurenzV merged 3 commits into
linebender:mainfrom
Cees-Kettenis:fix-marker-viewport-clip
Oct 17, 2026
Merged

LaurenzV merged 3 commits into
linebender:mainfrom
Cees-Kettenis:fix-marker-viewport-clip

Conversation

@Cees-Kettenis

Copy link
Copy Markdown
Contributor

Markers with a viewBox whose aspect ratio differs from the marker viewport are clipped to the viewBox, cropping valid artwork with meet and allowing artwork outside the viewport with slice.

Transform the marker viewport rectangle into content coordinates before constructing its clip path, so clipping follows the viewport for meet, slice, alignment, and stroke-width scaling. A new pixel regression checks these cases at 1x and 2x scale, and the existing marker golden is updated after comparison with Chrome; the full workspace tests, formatting, copyright check, and no-default-feature checks pass.

Before and after rendering the same marker SVG

Download the SVG reproducer

@LaurenzV
LaurenzV force-pushed the fix-marker-viewport-clip branch from 825dfcd to 4241c50 Compare October 17, 2026 06:33
@LaurenzV

Copy link
Copy Markdown
Collaborator

Thanks!

@LaurenzV
LaurenzV merged commit 8fef71a into linebender:main Oct 17, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants