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

0.1.4 • Public • Published

React Pan & Zoom

A simple pan and zoom for canvas like elements in react.

Demo

Edit q8wl1joow9

Installation

> yarn add @ajainarayanan/react-pan-zoom

Usage

import ReactPanZoom from "@ajainarayanan/react-pan-zoom";
class MyComponent extends React.PureComponent {

  public render() {
    return (
      <ReactPanZoom>
        <img src="some/src/for/image.png" />
      </ReactPanZoom>
    );
  }
}

Props

  • zoom : Provide zoom level for the cavnas'ish element. 1 by default
  • dx : Provide the initial x co-ordinate to pan the underlying element to be. 0 by default
  • dy : Provide the initial y co-ordinate to pan the underlying element to be. 0 by default

For more information on what dx and dy mean please refer here (tx == dx and ty == dy).

Readme

Keywords

none

Package Sidebar

Install

npm i @d2k/react-pan-zoom

Weekly Downloads

1

Version

0.1.4

License

MIT

Unpacked Size

303 kB

Total Files

12

Last publish

Collaborators

  • d2k