mirror of
https://github.com/exyte/Macaw.git
synced 2024-09-11 05:05:23 +03:00
Prevent percent from being parsed as unit
This commit is contained in:
parent
b07f097e49
commit
e63e6f2407
@ -1649,12 +1649,12 @@ open class SVGParser {
|
||||
}
|
||||
|
||||
fileprivate func dimensionFromString(_ string: String) -> SVGLength? {
|
||||
if string.hasSuffix("%"), let value = Double(string.dropLast()) {
|
||||
return SVGLength(percent: value)
|
||||
}
|
||||
if let value = doubleFromString(string) {
|
||||
return SVGLength(pixels: value)
|
||||
}
|
||||
if string.hasSuffix("%") {
|
||||
return SVGLength(percent: Double(string.dropLast())!)
|
||||
}
|
||||
return .none
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user