PanTilt 0.3.1

PanTilt 0.3.1

Maintained by Hristo.



PanTilt 0.3.1

  • By
  • hristost

PanTilt

CI Status Version License Platform

A structure for describing zoom and a gesture recognizer that allows for modifying it

  • Can be incorporated into any view used for displaying a photo, drawing canvas, etc.
  • Gives transformation matrices for converting between screen and context coordinates
  • Two-finger gesture supports zoom, pan and tilt

Example

Example project running on simulator

To run the example project, clone the repo, and run pod install from the Example directory first.

Implementation

  1. Make your view conform to ZoomableView
  2. At each drawing pass, use the canvasToView() function of the zoom property to get a matrix for drawing your content
  3. Initialise and attach a PanTiltGestureRecognizer to your view
  4. (Optional) You can make the gesture delegate conform to PanTiltGestureRecognizerDelegate if you want to handle events such as start or update of zoom gesture.
  5. (Optional) You can restrict the zoom range by creating an object implementing the PanTiltGestureRecognizerZoomDelegate and attaching it to the zoomSnap property of the gesture. You can see how this is done in the example project.

Requirements

  • Swift 4.2

This is an iOS project, but is should be easy to adapt it for macOS too if needed.

Installation

PanTilt is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'PanTilt'

Author

hristost, [email protected]

License

PanTilt is available under the MIT license. See the LICENSE file for more info.