Skip to content

Commit

Permalink
Merge pull request #355 from f3dm76/task/pathsM
Browse files Browse the repository at this point in the history
Fix #354: Paths with multiple M pairs are drawn incorrectly
  • Loading branch information
ystrot authored May 14, 2018
2 parents 73ae965 + 011d4f0 commit 7c03c5d
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions Source/svg/SVGParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7c03c5d

Please sign in to comment.