react-pinch-and-zoom
v1.2.5
Published
A react container component with pinch-to-zoom gesture interaction.
Downloads
6,410
Readme
React Pinch and Zoom
A react container component with pinch-to-zoom gesture interaction.
Getting Started
Installing
Install this package as dependency
# pwd: ~/project/dir $ npm install react-pinch-and-zoom
Import the component
import PinchToZoom from 'react-pinch-and-zoom';
Wrap the pinch-able component inside
PinchToZoom
componentrender() { return ( <div className="container"> <PinchToZoom> <img src={...}/> // child node should have intrinsic size </PinchToZoom> </div> ); }
Project structure
./react-pinch-and-zoom (master)
├── docs // compiled github demo page
├── lib // compiled react component in commonjs module (git ignored)
├── package.json
├── server.js // config local development server
└── src
├── PinchToZoom // source code of react-pinch-and-zoom
└── demo // source code of github demo page
Develop on local machine
- Pull this repository
# pwd: ~/development/dir $ git pull https://github.com/conradlo/react-pinch-and-zoom.git
- Install dependency
$ cd react-pinch-and-zoom # pwd: ~/development/dir/react-pinch-and-zoom $ npm install
- Start local development server
# pwd: ~/development/dir/react-pinch-and-zoom $ npm start
- Visit
localhost:3000
and editsrc/PinchToZoom/*
- Consult
package.json
for more npm script tasks
Production build
run npm run build
will:
- transpile the component's source code
/lib
- build and bundle the Github page
/docs
# pwd: ~/development/dir/react-pinch-and-zoom
$ npm run build
Built With
- Reactjs - A JavaScript library for building user interfaces
- Sass - Syntactically Awesome Style Sheets
- Webpack - JavaScript module bundler
- Babel - JavaScript transpiler/compiler
- Typescript - For extra type safety
- eslint, tslint, prettier, vscode
Contributing
Please refer to CONTRIBUTING.md for details on code of conduct, and the process for submitting pull requests.
Versioning
This project uses SemVer for versioning. For the versions available, see the tags on this repository.
License
see the LICENSE file for details
Acknowledgments
- https://gist.github.com/PurpleBooth/109311bb0361f32d87a2