Skip to content

Conversation

@pacowong
Copy link

@pacowong pacowong commented May 27, 2025

https://goodnotes.atlassian.net/browse/FFA-407

Tested in XCode

Screenshot 2025-05-27 at 4 54 15 PM

Reviewers should check whether the changes in the test fixtures are acceptable.

@pacowong pacowong changed the title Paco/marker parser ios [FFA-407] Parse marker in SVG May 27, 2025
@khoi
Copy link
Collaborator

khoi commented May 27, 2025

I restored the original logic of serialization to avoid text fixtures changes. Cna you rerun it and update the files

khoi added 2 commits May 27, 2025 20:17
- 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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's in this?

Copy link
Author

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 {}
Copy link
Collaborator

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?

Copy link
Author

@pacowong pacowong May 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<defs> is parsed. Currently, it is parsed like <g>

Screenshot 2025-05-27 at 9 52 16 PM

Copy link
Author

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" {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CleanShot 2025-05-27 at 20 29 20@2x

do we want to support rad?

import Combine
#endif

public class SVGMarker: SVGNode {
Copy link
Collaborator

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

Copy link
Author

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.

Copy link
Collaborator

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

Copy link
Author

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)
Copy link
Collaborator

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)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Addressed in a285e11

@khoi khoi merged commit 9783d8c into main May 28, 2025
2 checks passed
@khoi khoi deleted the paco/marker_parser_ios branch September 26, 2025 09:58
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.

3 participants