Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- override func draw(_ rect: CGRect) {
- let path = UIBezierPath(ovalIn: rect)
- let circleColor:UIColor
- switch group {
- case .forehead:
- circleColor = UIColor.red
- case .crowsFeetRightEye:
- circleColor = UIColor.green
- case .crowsFeetLeftEye:
- circleColor = UIColor.blue
- }
- circleColor.setFill()
- path.fill()
- }
- func initGestureRecognizers() {
- let panGR = UIPanGestureRecognizer(target: self, action: #selector(DragPoint.didPan(panGR:)))
- addGestureRecognizer(panGR)
- }
- @objc func didPan(panGR: UIPanGestureRecognizer) {
- if panGR.state == .changed {
- self.superview!.bringSubview(toFront: self)
- let translation = panGR.translation(in: self)
- self.center.x += translation.x
- self.center.y += translation.y
- panGR.setTranslation(CGPoint.zero, in: self)
- }
- }
Add Comment
Please, Sign In to add comment