Latest 0.2.0
Homepage https://github.com/hristost/PanTilt
License MIT
Platforms ios 8.0
Dependencies SwifterSwift/CoreGraphics
Authors

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.

Latest podspec

{
    "name": "PanTilt",
    "version": "0.2.0",
    "summary": "A structure for describing zoom and a gesture recognizer that allows for modifying it",
    "description": "A structure for describing zoom and a gesture recognizer that allows for modifying itn* Can be incorporated into any view used for displaying a photo, drawing canvas, etc.n* Gives transformation matrices for converting between screen and context coordinatesn* Two-finger gesture supports zoom, pan and tilt",
    "homepage": "https://github.com/hristost/PanTilt",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "hristost": "[email protected]"
    },
    "source": {
        "git": "https://github.com/hristost/PanTilt.git",
        "tag": "0.2.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "swift_version": "4.2",
    "source_files": "PanTilt/Classes/**/*",
    "dependencies": {
        "SwifterSwift/CoreGraphics": []
    }
}

Pin It on Pinterest

Share This