Skip to content

Fork of react-zoom-pan-pinch that fixes an issue with build warnings and another with pixelated results in Safari.

License

Notifications You must be signed in to change notification settings

margox/react-zoom-pan-pinch-mp

 
 

Repository files navigation

@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

About

Fork of react-zoom-pan-pinch that fixes an issue with build warnings and another with pixelated results in Safari.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 94.0%
  • JavaScript 4.2%
  • CSS 1.6%
  • HTML 0.2%