# react-responsive-pinch-zoom-pan-with-rotation

> Enables zooming and panning an image, both mobile and desktop.

Latest version **0.2.10** (published 2019-09-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-responsive-pinch-zoom-pan-with-rotation
pnpm add react-responsive-pinch-zoom-pan-with-rotation
yarn add react-responsive-pinch-zoom-pan-with-rotation
bun add react-responsive-pinch-zoom-pan-with-rotation
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.10 |
| Published | 2019-09-22 |
| First published | 2019-08-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 363.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Brad Stiff |
| Maintainers | shavit |
| Keywords | react, reactjs, responsive, pinch, zoom, pan, image |

## Links

- npm: https://www.npmjs.com/package/react-responsive-pinch-zoom-pan-with-rotation
- Repository: https://github.com/ShavitCohen/react-responsive-pinch-zoom-pan
- Issues: https://github.com/ShavitCohen/react-responsive-pinch-zoom-pan/issues
- npm.io page: https://npm.io/package/react-responsive-pinch-zoom-pan-with-rotation

## Dependencies (6)

- [yargs](https://npm.io/package/yargs.md) ^13.3.0
- [warning](https://npm.io/package/warning.md) ^4.0.2
- [reselect](https://npm.io/package/reselect.md) ^4.0.0
- [@fortawesome/react-fontawesome](https://npm.io/package/@fortawesome/react-fontawesome.md) ^0.1.4
- [@fortawesome/fontawesome-svg-core](https://npm.io/package/@fortawesome/fontawesome-svg-core.md) ^1.2.13
- [@fortawesome/free-solid-svg-icons](https://npm.io/package/@fortawesome/free-solid-svg-icons.md) ^5.7.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.2.10 (latest) — 2019-09-22
- 0.2.9 — 2019-09-19
- 0.2.8 — 2019-09-19
- 0.2.7 — 2019-09-19
- 0.2.6 — 2019-09-19
- 0.2.5 — 2019-09-19
- 0.2.4 — 2019-08-12
- 0.2.3 — 2019-08-11

## README

# react-responsive-pinch-zoom-pan

A React component that adds pinch-zoom and pan capability to an `img` element. Both mobile and desktop browsers are supported. In desktop mode, you zoom with the mouse scrollwheel, and pan by dragging.

On render, the zoom and pan values are applied using CSS transforms. 

## Install

`npm install react-responsive-pinch-zoom-pan --save`

## Try it out

### Online

[Demo](https://bradstiff.github.io/react-responsive-pinch-zoom-pan/)

### Local

1. `git clone https://github.com/bradstiff/react-responsive-pinch-zoom-pan.git`
2. `cd react-responsive-pinch-zoom-pan`
3. `npm install`
4. `npm start`
5. Browse to http://localhost:3001

## Usage

```javascript
import React from "react";
import PinchZoomPan from "react-responsive-pinch-zoom-pan";

const App = () => {
    return (
        <div style={{ width: '500px', height: '500px' }}>
            <PinchZoomPan>
                <img alt='Test Image' src='http://picsum.photos/750/750' />
            </PinchZoomPan>
        </div>
    );
};
```

## API

Prop		| Type		| Default	| Description
------------|-----------|-----------|--------------------------------------------------------------------------------------------------------------------
initialScale| number	| 'auto'	| The initial scale of the image.  When `auto`, the image will be proportionally 'autofit' to the container.
minScale	| number	| 'auto'	| The minimum scale to which the image can be zoomed out. When `auto`, the minimum scale is the 'autofit' scale.
maxScale	| number	| 1			| The maximum scale to which the image can be zoomed in. 
position    | 'center' or 'topLeft'    | 'topLeft'  | Position of the image relative to the container. Applies when the scaled image is smaller than the container.
zoomButtons	| bool		| true		| Render plus (+) and minus (-) buttons on top of the image as another way to access the zoom feature.
doubleTapBehavior	| 'reset' or 'zoom' | 'reset'		| Whether to zoom in or reset to initial scale on double-click / double-tap.
onChange | function | oop | callback which being trigger once image is being changed (scale, top, left)
scale | number | 1 | the scale of the image
left | number | 0 | the left position
top | number | 0 | the top position

## Development

You're welcome to contribute to react-responsive-pinch-zoom-pan.

To set up the project:

1.  Fork and clone the repository
2.  `npm install`
3.  `npm start`

The example page will be available on http://localhost:3001 in watch mode, meaning you don't have to refresh the page to see your changes.

---
_Source: https://npm.io/package/react-responsive-pinch-zoom-pan-with-rotation · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
