fix(svg): note that moveto accepts more than one coordinate pair - #45391
Open
rajanpanth wants to merge 1 commit into
Open
fix(svg): note that moveto accepts more than one coordinate pair#45391rajanpanth wants to merge 1 commit into
rajanpanth wants to merge 1 commit into
Conversation
The SVG paths tutorial said the Move To command takes two parameters. Per the SVG path grammar, M and m accept a coordinate pair sequence: only the first pair moves the cursor, and each pair after it is drawn as an implicit lineto. So M 10 10 90 10 90 90 draws a polyline rather than performing three moves. Changed the count to at least two and added a short paragraph with an equivalence example. Kept it brief since this is an introductory tutorial.
Contributor
|
Preview URLs (1 page) |
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.
Description
Corrects the SVG paths tutorial's claim that the "Move To" command takes two parameters, and adds a short paragraph explaining what additional coordinate pairs do.
Motivation
Fixes #45289.
The "Line commands" section said
M"takes two parameters, a coordinate (x) and coordinate (y) to move to". Per the SVG path grammar,Mandmtake a coordinate pair sequence: only the first pair moves the current point, and every pair after it is drawn as an implicitlineto. SoM 10 10 90 10 90 90draws a polyline rather than performing three moves, and a path can trace a whole polygon without an explicitLat all. Since the page presents the two-parameter form as the definition, a reader has no way to predict what a path like that does.Changed the count to "at least two parameters" and added one paragraph after the syntax block giving the equivalence,
M 10 10 90 10 90 90is the same asM 10 10 L 90 10 L 90 90, plus a note that pairs after a relativemare relative lines.Additional details
The issue also raises several points about
Z/z, implicit closing lines, and stroke rendering differences between an explicit finallinetoand a close. Those are correct but they are a separate, larger topic, and this page is an introductory tutorial that coversZfurther down in its own section. I have kept this change to the factual error aboutmovetoparameters so it stays reviewable. Happy to open a follow-up for theZbehavior if you would like it documented here.Related issues and pull requests
Fixes #45289