@sp1985/react-zoom-pan-pinch
TypeScript icon, indicating that this package has built-in type declarations

2.4.6 • Public • Published

@pronestor/react-zoom-pan-pinch

Super fast and light react Node.js package for zooming, panning and pinching html elements in an easy way.

This is a fork of react-zoom-pan-pinch originally created in order to fix the issue with build errors because of missing source files.

Documentation

Storybook for @pronestor/react-zoom-pan-pinch.

Quick Start

Installation

yarn add @pronestor/react-zoom-pan-pinch

or

npm install @pronestor/react-zoom-pan-pinch

Usage

Basic usage:

import {
  TransformComponent,
  TransformWrapper,
} from "@pronestor/react-zoom-pan-pinch";

export const SimpleExample = () => (
  <TransformWrapper>
    <TransformComponent>
      <img src="image.jpg" alt="test" />
    </TransformComponent>
  </TransformWrapper>
);

With controls:

import {
  TransformComponent,
  TransformWrapper,
} from "@pronestor/react-zoom-pan-pinch";

export const ExampleWithZoomControls = () => (
  <TransformWrapper
    initialPositionX={200}
    initialPositionY={100}
    initialScale={1}
  >
    {({ zoomIn, zoomOut, ...rest }) => (
      <>
        <div className="tools">
          <button onClick={() => zoomIn()}>+</button>
          <button onClick={() => zoomOut()}>-</button>
        </div>
        <TransformComponent>
          <img src="image.jpg" alt="test" />
          <div>Example text</div>
        </TransformComponent>
      </>
    )}
  </TransformWrapper>
);

License

MIT © Pronestor

Package Sidebar

Install

npm i @sp1985/react-zoom-pan-pinch

Weekly Downloads

1

Version

2.4.6

License

MIT

Unpacked Size

1.39 MB

Total Files

116

Last publish

Collaborators

  • sp1985