Clean up ahead of PR.

pull/1/head
Matthew Chen 6 years ago
parent 04cd6c3495
commit bf734d5959

@ -37,7 +37,6 @@ public class ImageEditorView: UIView, ImageEditorModelDelegate {
public func handleTouchGesture(_ gestureRecognizer: UIGestureRecognizer) {
AssertIsOnMainThread()
let removeCurrentStroke = {
if let stroke = self.currentStroke {
self.model.remove(item: stroke)
@ -48,14 +47,16 @@ public class ImageEditorView: UIView, ImageEditorModelDelegate {
let referenceView = self
let unitSampleForGestureLocation = { () -> CGPoint in
// TODO: Smooth touch samples before converting into stroke samples.
let location = gestureRecognizer.location(in: referenceView)
let x = CGFloatClamp01(CGFloatInverseLerp(location.x, 0, referenceView.bounds.width))
let y = CGFloatClamp01(CGFloatInverseLerp(location.y, 0, referenceView.bounds.height))
return CGPoint(x: x, y: y)
}
// TODO:
// TODO: Color picker.
let strokeColor = UIColor.blue
// TODO: Tune stroke width.
let unitStrokeWidth = ImageEditorStrokeItem.defaultUnitStrokeWidth()
switch gestureRecognizer.state {
@ -237,16 +238,6 @@ public class ImageEditorView: UIView, ImageEditorModelDelegate {
}
lastForwardVector = forwardVector
}
var hasSample = false
for unitSample in unitSamples {
let point = transformSampleToPoint(unitSample)
if hasSample {
bezierPath.addLine(to: point)
} else {
bezierPath.move(to: point)
hasSample = true
}
}
shapeLayer.path = bezierPath.cgPath
shapeLayer.fillColor = nil

Loading…
Cancel
Save