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

Merge pull request #355 from f3dm76/task/pathsM

Fix #354: Paths with multiple M pairs are drawn incorrectly
This commit is contained in:
Yuri Strot 2018-05-14 15:17:30 +07:00 committed by GitHub
commit 7c03c5d2c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1404,14 +1404,23 @@ private class PathDataReader {
var result = [PathSegment]()
let data = readData()
var index = 0
while (index < data.count) {
var isFirstSegment = true
while index < data.count {
let end = index + count
if (end > data.count) {
if end > data.count {
// TODO need to generate error:
// "Path '\(type)' has invalid number of arguments: \(data.count)"
break
}
result.append(PathSegment(type: type, data: Array(data[index..<end])))
var currentType = type
if type == .M && !isFirstSegment {
currentType = .L
}
if type == .m && !isFirstSegment {
currentType = .l
}
result.append(PathSegment(type: currentType, data: Array(data[index..<end])))
isFirstSegment = false
index = end
}
return result