1
1
mirror of https://github.com/exyte/Macaw.git synced 2024-09-21 09:59:10 +03:00

Merge pull request #232 from amarunko/bug/path-parsing

Fix for values parsing (dot separated)
This commit is contained in:
Yuri Strot 2017-11-29 20:42:26 +07:00 committed by GitHub
commit 724c28c36a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1097,7 +1097,7 @@ open class SVGParser {
let commandParams = command.expression.components(separatedBy: characterSet)
var separatedValues = [String]()
commandParams.forEach { param in
separatedValues.append(contentsOf: separateNegativeValuesIfNeeded(param))
separatedValues.append(contentsOf: separateValuesIfNeeded(param))
}
switch command.type {
@ -1186,7 +1186,7 @@ open class SVGParser {
}
}
fileprivate func separateNegativeValuesIfNeeded(_ expression: String) -> [String] {
fileprivate func separateValuesIfNeeded(_ expression: String) -> [String] {
var values = [String]()
var value = String()
var e = false
@ -1202,6 +1202,15 @@ open class SVGParser {
}
e = false
}
if scalar == "."
&& !e
&& value.contains(".") {
values.append(value)
value = String()
e = false
}
value.append("\(scalar)")
}