react-zoom-pan-pinch

Zoom and pan html elements in easy way.

react-zoom-pan-pinch downloads react-zoom-pan-pinch version react-zoom-pan-pinch license

react-zoom-pan-pinch类似的npm包:

npm下载趋势

3 年
🌟 在 react-zoom-pan-pinch 的 README.md 中显示实时使用量图表,只需复制下面的代码。
## Usage Trend
[![Usage Trend of react-zoom-pan-pinch](https://npm-compare.com/img/npm-trend/THREE_YEARS/react-zoom-pan-pinch.png)](https://npm-compare.com/react-zoom-pan-pinch#timeRange=THREE_YEARS)

Cumulative GitHub Star Trend

🌟 在 react-zoom-pan-pinch 的 README.md 中显示 GitHub stars 趋势图表,只需复制下面的代码。
## GitHub Stars Trend
[![GitHub Stars Trend of react-zoom-pan-pinch](https://npm-compare.com/img/github-trend/react-zoom-pan-pinch.png)](https://npm-compare.com/react-zoom-pan-pinch)

统计详情

npm包名称
下载量
Stars
大小
Issues
发布时间
License
react-zoom-pan-pinch01,911667 kB13218 天前MIT

react-zoom-pan-pinch的README

🖼 React Zoom Pan Pinch

Super fast and light react npm package for zooming, panning and pinching html elements in easy way

Twitter Follow

Join our Discord community

🏢 Using this library in production?

If your application depends on react-zoom-pan-pinch, I offer paid support to help you resolve issues quickly and avoid blocking releases.

Sources

Premium sponsor banner

Premium sponsor banner

Key Features

  • 🚀 Fast and easy to use
  • 🏭 Light, without external dependencies
  • 💎 Mobile gestures, touchpad gestures and desktop mouse events support
  • 🎁 Powerful context usage, which gives you a lot of freedom
  • 🔧 Highly customizable
  • 👑 Animations and Utils to create own tools
  • 🔮 Advanced hooks and components

Try other BetterTyped projects

Do you like this library? Here is another BetterTyped project — the whole preview below is a single link to GitHub.


Installation

npm install --save react-zoom-pan-pinch
or
yarn add react-zoom-pan-pinch

Premium sponsor banner

Premium sponsor banner

Examples

import React, { Component } from "react";

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

const Example = () => {
  return (
    <TransformWrapper>
      <TransformComponent>
        <img src="https://raw.githubusercontent.com/BetterTyped/react-zoom-pan-pinch/HEAD/image.jpg" alt="test" />
      </TransformComponent>
    </TransformWrapper>
  );
};

or

import {
  TransformWrapper,
  TransformComponent,
  useControls,
} from "react-zoom-pan-pinch";

const Controls = () => {
  const { zoomIn, zoomOut, resetTransform } = useControls();

  return (
    <div className="tools">
      <button type="button" onClick={() => zoomIn()}>
        +
      </button>
      <button type="button" onClick={() => zoomOut()}>
        -
      </button>
      <button type="button" onClick={() => resetTransform()}>
        x
      </button>
    </div>
  );
};

const Example = () => {
  return (
    <TransformWrapper
      initialScale={1}
      initialPositionX={200}
      initialPositionY={100}
    >
      <Controls />
      <TransformComponent>
        <img src="https://raw.githubusercontent.com/BetterTyped/react-zoom-pan-pinch/HEAD/image.jpg" alt="test" />
        <div>Example text</div>
      </TransformComponent>
    </TransformWrapper>
  );
};

Premium sponsor banner

Premium sponsor banner

Help me keep working on this project ❤️

💖 Our sponsors

My Sponsors

🏢 Commercial Support

If you're using this library in production, I offer paid support:

  • Priority issue resolution
  • Help with debugging production issues
  • Direct contact with the maintainer

Plans start at $400/month.

📩 Contact: maciekpyrc@gmail.com

License

MIT © prc5