Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to zoom in the view & rotate ? #45

Open
chajmz opened this issue Dec 14, 2020 · 0 comments
Open

How to zoom in the view & rotate ? #45

chajmz opened this issue Dec 14, 2020 · 0 comments

Comments

@chajmz
Copy link

chajmz commented Dec 14, 2020

Hi I'm trying to make your view rotate & zoom.
For the zooming part I can implement the gesture in the viewDidLoad :

let gesture = UIPinchGestureRecognizer(target: self, action: #selector(pinchAction(sender:))) self.drawView.addGestureRecognizer(gesture)

and adding this function :
@objc func pinchAction(sender:UIPinchGestureRecognizer) { let scale:CGFloat = previousScale * sender.scale self.view.transform = CGAffineTransform(scaleX: scale, y: scale); previousScale = sender.scale }

  • adding the variable

var previousScale:CGFloat = 1.0

but my strategy isn't working for the rotation (or translation ?) since it's not detecting this as a proper rotation event ?

Do you have any idea how to fix this ?

Thanks for you repo & awesome work by the way !

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

No branches or pull requests

1 participant