Skip to content
This repository has been archived by the owner on Nov 29, 2021. It is now read-only.

How to rotate the circle icons to keep them upright while the circle moves? #7

Open
jaag12 opened this issue Aug 14, 2019 · 1 comment

Comments

@jaag12
Copy link

jaag12 commented Aug 14, 2019

I would like to know how I can keep the icons inside the circle in an upright position, whether the circle moves and changes position, as in the initial position. A great job with the library, Thank you!

@jaag12
Copy link
Author

jaag12 commented Aug 26, 2019

I tried the following in the touchesMoved function of CircleGestureRecognizer, as indicated on the page but turn the full thumb and not the icon, I tried turning the icon only, but it did not work properly. Thank you.

  for thumb in view.thumbs {
         let thumb = thumb as! CircleThumb
         let deltaAngle: CGFloat = -CircleThumb.radiansFrom(degrees: 180) + atan2(view.transform.a, 
         view.transform.b) + atan2(thumb.iconView.transform.a, thumb.iconView.transform.b)

         let current = thumb.transform.iconView
         thumb.iconView..transform = current.rotated(by: deltaAngle)
   }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant