Guest User

Untitled

a guest
Feb 21st, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. override func draw(_ rect: CGRect) {
  2. let path = UIBezierPath(ovalIn: rect)
  3. let circleColor:UIColor
  4.  
  5. switch group {
  6. case .forehead:
  7. circleColor = UIColor.red
  8. case .crowsFeetRightEye:
  9. circleColor = UIColor.green
  10. case .crowsFeetLeftEye:
  11. circleColor = UIColor.blue
  12. }
  13.  
  14. circleColor.setFill()
  15. path.fill()
  16. }
  17.  
  18. func initGestureRecognizers() {
  19. let panGR = UIPanGestureRecognizer(target: self, action: #selector(DragPoint.didPan(panGR:)))
  20. addGestureRecognizer(panGR)
  21. }
  22.  
  23. @objc func didPan(panGR: UIPanGestureRecognizer) {
  24.  
  25. if panGR.state == .changed {
  26. self.superview!.bringSubview(toFront: self)
  27. let translation = panGR.translation(in: self)
  28.  
  29. self.center.x += translation.x
  30. self.center.y += translation.y
  31.  
  32. panGR.setTranslation(CGPoint.zero, in: self)
  33.  
  34. }
  35.  
  36. }
Add Comment
Please, Sign In to add comment