Skip to content

Commit

Permalink
Made Path.Command.point public.
Browse files Browse the repository at this point in the history
  • Loading branch information
richardpiazza committed Jan 28, 2021
1 parent e44c386 commit b06f94c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
11 changes: 0 additions & 11 deletions Sources/SwiftSVG/Internal/Path.Command+Internal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,6 @@ extension Path.Command {
}
}

var point: Point {
switch self {
case .moveTo(let point): return point
case .lineTo(let point): return point
case .cubicBezierCurve(_, _, let point): return point
case .quadraticBezierCurve(_, let point): return point
case .ellipticalArcCurve(_, _, _, _, _, let point): return point
case .closePath: return .zero
}
}

/// The last control point used in drawing the path.
///
/// Only valid for curves.
Expand Down
12 changes: 12 additions & 0 deletions Sources/SwiftSVG/Path.Command.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ public extension Path {
return "\(Prefix.close.rawValue)"
}
}

/// The primary point that dictates the commands action.
public var point: Point {
switch self {
case .moveTo(let point): return point
case .lineTo(let point): return point
case .cubicBezierCurve(_, _, let point): return point
case .quadraticBezierCurve(_, let point): return point
case .ellipticalArcCurve(_, _, _, _, _, let point): return point
case .closePath: return .zero
}
}
}
}

Expand Down

0 comments on commit b06f94c

Please sign in to comment.