smoothing out the lines

This commit is contained in:
Kevin G Christiano 2020-07-13 16:16:42 -04:00
parent db5f51dd92
commit 5894387fd1

View File

@ -106,17 +106,18 @@ open class OrderTracker: View {
} }
context.setStrokeColor(lineColor) context.setStrokeColor(lineColor)
let relativeOrigin = convert(step.stateImage.frame, from: step.stateImage) let relativeRect = convert(step.stateImage.frame, from: step.stateImage)
let point = CGPoint(x: halfDimension, y: relativeOrigin.origin.y + halfDimension) let point = CGPoint(x: halfDimension, y: relativeRect.origin.y + halfDimension)
context.addLine(to: point) context.addLine(to: point)
context.strokePath() context.strokePath()
// Break out of loop since we're on the last step.
if i == steps.count - 2 { if i == steps.count - 2 {
break break
} }
let nextPoint = CGPoint(x: halfDimension, y: relativeOrigin.origin.y + imageDimension) let nextPoint = CGPoint(x: halfDimension, y: relativeRect.origin.y + halfDimension)
lineColor = (step.state?.color() ?? defaultGrey).cgColor lineColor = (step.state?.color() ?? defaultGrey).cgColor
context.move(to: nextPoint) context.move(to: nextPoint)
} }