Skip to content

Commit

Permalink
Fix path color bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
nicklockwood committed Apr 28, 2022
1 parent 2554814 commit 9a3dced
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion ShapeScript/Euclid+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ extension Path {

/// Remove point colors
func removingColors() -> Path {
Path(points.map { $0.with(color: nil) })
if subpaths.count > 1 {
return Path(subpaths: subpaths.map { $0.removingColors() })
}
return Path(points.map { $0.with(color: nil) })
}

/// Create an array of text paths
Expand Down
3 changes: 2 additions & 1 deletion ShapeScript/SVGPath+Path.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ extension SVGPath {
t += step
points.append(.curve(
cubicBezier(p0.x, p1.x, p2.x, p3.x, t),
cubicBezier(p0.y, p1.y, p2.y, p3.y, t)
cubicBezier(p0.y, p1.y, p2.y, p3.y, t),
color: color
))
}
points.append(.point(Vector(p3), color: color))
Expand Down

0 comments on commit 9a3dced

Please sign in to comment.