1
1
mirror of https://github.com/exyte/Macaw.git synced 2024-09-11 05:05:23 +03:00

Override toPath() for Line.

This commit is contained in:
Eduard Sergeev 2019-03-14 11:46:21 +07:00
parent 90e8c66ced
commit 78fb030e12
2 changed files with 5 additions and 3 deletions

View File

@ -19,4 +19,8 @@ open class Line: Locus {
w: abs(x1 - x2),
h: abs(y1 - y2))
}
override open func toPath() -> Path {
return MoveTo(x: x1, y: y1).lineTo(x: x2, y: y2).build()
}
}

View File

@ -20,9 +20,7 @@ open class Locus {
}
open func toPath() -> Path {
if let line = self as? Line {
return MoveTo(x: line.x1, y: line.y1).lineTo(x: line.x2, y: line.y2).build()
} else if let polygon = self as? Polygon {
if let polygon = self as? Polygon {
return pointsToPath(polygon.points, close: true)
} else if let polyline = self as? Polyline {
return pointsToPath(polyline.points)