-
Notifications
You must be signed in to change notification settings - Fork 0
[FFA-502] Parse width and height #9
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
} else if let widthAttr = attributes[ignoreCase: "width"], | ||
let heightAttr = attributes[ignoreCase: "height"], | ||
let width = SVGLengthParser.xAxis.double(string: widthAttr, context: context), | ||
let height = SVGLengthParser.yAxis.double(string: heightAttr, context: context) { |
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 SVGLengthParser
parse %
props to absolute values based on the parent width, height (fetched from context).
I wonder what would be the values parsed here for width and height, can u please check?
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.
Refer to the results in viewport-02.ref, if the %
is used in the viewport attribute, the size will be 100x100.
|
||
class SVGRectParser: SVGShapeParser { | ||
override func parseLocus(context: SVGNodeContext) -> SVGShape? { | ||
// SVGHelper.parseDimension(attributes, "markerWidth") ?? SVGLength(percent: 100) |
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 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.
Thanks. Removed in eef6057
https://goodnotes.atlassian.net/browse/FFA-502
Pedro shares the example below. The problem is that the canvas definition does not use "viewBox" and uses "width" and "height" attributes instead. As the default size of the canvas is 100 x 100, when the library parses
<rect width="100%" height="100%" fill="#f4f4f4"/>
which uses the parent context size, the rect size is 100x100, instead of 780 x 950.