-
Notifications
You must be signed in to change notification settings - Fork 1
[FFA-407] Parse marker in SVG #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I restored the original logic of serialization to avoid text fixtures changes. Cna you rerun it and update the files |
- Set NumberFormatter decimalSeparator to "." for consistent formatting - Update test fixtures to reflect period-separated decimal values - Ensure transform matrix serialization works regardless of system locale
| createReference(name: "paint-color-03-t", version: v12) | ||
| createReference(name: "paint-color-201-t", version: v12) | ||
| createReference(name: "paint-fill-04-t", version: v12) | ||
| createReference(name: "paint-fill-06-t", version: v12) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's in this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test is present in the orginally repo. We need this line to regenerate the ref file.
| import Combine | ||
| #endif | ||
|
|
||
| public class SVGDefs: SVGGroup {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are not parsing the defs? why have it then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DefsParser is added here
| self = .angle(0) | ||
| return | ||
| } | ||
| if rawValue == "auto" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Source/Model/Nodes/SVGMarker.swift
Outdated
| import Combine | ||
| #endif | ||
|
|
||
| public class SVGMarker: SVGNode { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably need to be a subclass of SVGGroup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is intentional because the constructor of SVGGroup (public init(contents: [SVGNode], transform: CGAffineTransform = .identity, opaque: Bool = true, opacity: Double = 1, clip: SVGUserSpaceNode? = nil, mask: SVGNode? = nil)) is very different from SVGMarker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked the SVG spec and most props allowed on SVGGroup are allowed on Marker (transform, clip, mask ...) so it makes sense for SVGMarker to be a SVGGroup imo.
Here is a patch you could apply to update the init
0001-Refactor-SVGMarker-inheritance-and-remove-code-dupli.patch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Applied in 42e1a3c
| case percent(CGFloat) | ||
| case pixels(CGFloat) | ||
|
|
||
| static let zero: SVGLength = .pixels(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd just remove this, the naming for tthis is unclear. .pixels(0) != .percent(0)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Addressed in a285e11
Co-authored-by: khoi <6994441+khoi@users.noreply.github.com>


https://goodnotes.atlassian.net/browse/FFA-407
Tested in XCode
Reviewers should check whether the changes in the test fixtures are acceptable.