Created
December 18, 2020 18:20
-
-
Save jscalo/f1e59265b3b25d380763d1fd09f759af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@objc func pinchGesture(_ gc: UIPinchGestureRecognizer) { | |
switch gc.state { | |
case .changed: | |
pauseUpdates = true | |
scrollView.recenterForScale(gc.scale) | |
pauseUpdates = false | |
let newScale = viewPort.zoom * gc.scale | |
viewPort.zoom = max(newScale, 1.0) | |
gc.scale = 1.0 | |
case .ended, .cancelled, .failed: | |
break | |
default: break | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment