MCPcopy
hub / github.com/BetterTyped/react-zoom-pan-pinch

github.com/BetterTyped/react-zoom-pan-pinch @v4.0.3 sqlite

repository ↗ · DeepWiki ↗ · release v4.0.3 ↗
368 symbols 1,040 edges 185 files 7 documented · 2%
README

🖼 React Zoom Pan Pinch

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

Twitter Follow

Sources

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? Try out other projects

Hyper Fetch

⚡Hyper Fetch - Fetching and realtime data exchange framework.


Installation

npm install --save react-zoom-pan-pinch
or
yarn add react-zoom-pan-pinch
<a href="https://github.com/sponsors/prc5?tier=Gold">



        <img width="830" src="https://raw.githubusercontent.com/prc5/sponsors/main/assets/Gold.png" alt="Premium sponsor banner"/>



</a>







<a href="https://github.com/sponsors/prc5?tier=gold">



        <img width="830" src="https://raw.githubusercontent.com/prc5/sponsors/main/packages/gold/sponsorkit/sponsors.svg" alt="Premium sponsor banner"/>



</a>

Examples

import React, { Component } from "react";

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

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

or

import React, { Component } from "react";

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

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

  return (



      <button onClick={() => zoomIn()}>+</button>
      <button onClick={() => zoomOut()}>-</button>
      <button onClick={() => resetTransform()}>x</button>



  );
};

const Example = () => {
  return (
    <TransformWrapper
      initialScale={1}
      initialPositionX={200}
      initialPositionY={100}
    >
      {({ zoomIn, zoomOut, resetTransform, ...rest }) => (
        <>
          <Controls />
          <TransformComponent>
            <img src="https://github.com/BetterTyped/react-zoom-pan-pinch/raw/v4.0.3/image.jpg" alt="test" />


Example text


          </TransformComponent>
        </>
      )}
    </TransformWrapper>
  );
};
<a href="https://github.com/sponsors/prc5?tier=Silver">



        <img width="830" src="https://raw.githubusercontent.com/prc5/sponsors/main/assets/Silver.png" alt="Premium sponsor banner" />



</a>







<a href="https://github.com/sponsors/prc5?tier=Silver">



        <img width="830" src="https://raw.githubusercontent.com/prc5/sponsors/main/packages/silver/sponsorkit/sponsors.svg" alt="Premium sponsor banner" />



</a>

License

MIT © prc5

Help me keep working on this project ❤️

💖 Our sponsors

<a href="https://github.com/sponsors/prc5">
    <img src="https://raw.githubusercontent.com/prc5/sponsors/main/packages/other/sponsorkit/sponsors.svg?raw=true" alt="My Sponsors" />
</a>

Extension points exported contracts — how you extend this code

BoundsOverlayProps (Interface)
(no doc)
src/stories/utils/bounds-overlay.tsx
PanGestureOptions (Interface)
(no doc)
__tests__/utils/render-app.tsx
ExtremeExampleOptions (Interface)
(no doc)
__tests__/examples/extreme-examples.tsx
Preset (Interface)
(no doc)
src/stories/examples/initial-transform/example.tsx
RenderApp (Interface)
(no doc)
__tests__/utils/render-app.tsx
RowDef (Interface)
(no doc)
src/stories/examples/cinema/cinema-data.tsx
SeatInfo (Interface)
(no doc)
src/stories/examples/cinema/cinema-data.tsx
CinemaLayoutProps (Interface)
(no doc)
src/stories/examples/cinema/cinema-data.tsx

Core symbols most depended-on inside this repo

getContext
called by 35
src/utils/context.utils.ts
handleCallback
called by 32
src/utils/callback.utils.ts
isElementVisible
called by 22
src/components/virtualize/virtualize.utils.ts
normalizeArgs
called by 20
src/stories/utils/args.utils.ts
handleCancelAnimation
called by 11
src/core/animations/animations.utils.ts
animate
called by 8
src/core/animations/animations.utils.ts
getPaddingValue
called by 8
src/core/pan/panning.utils.ts
useTransformComponent
called by 8
src/hooks/use-transform-component.tsx

Shape

Function 327
Interface 16
Method 14
Class 10
Enum 1

Languages

TypeScript100%

Modules by API surface

__tests__/utils/render-app.tsx17 symbols
src/core/animations/animations.constants.ts14 symbols
src/stories/utils/controls.utils.tsx12 symbols
src/stories/examples/medical-viewer/example.tsx12 symbols
src/stories/examples/stadium/example.tsx11 symbols
src/stories/examples/image-annotations/example.tsx11 symbols
src/stories/examples/miro/example.tsx10 symbols
src/stories/examples/cinema/cinema-data.tsx10 symbols
src/stories/examples/velocity/example.tsx9 symbols
src/stories/examples/stadium/stadium-data.ts9 symbols
src/core/pan/panning.utils.ts9 symbols
src/core/bounds/bounds.utils.ts9 symbols

Dependencies from manifests, versioned

@babel/core7.23.7 · 1×
@babel/runtime7.23.8 · 1×
@commitlint/cli18.4.4 · 1×
@commitlint/config-conventional18.4.4 · 1×
@rollup/plugin-babel6.0.4 · 1×
@rollup/plugin-typescript11.1.6 · 1×
@semantic-release/changelog6.0.3 · 1×
@semantic-release/commit-analyzer11.1.0 · 1×
@semantic-release/git10.0.1 · 1×
@semantic-release/github9.2.6 · 1×
@semantic-release/npm11.0.2 · 1×
@semantic-release/release-notes-generator12.1.0 · 1×

For agents

$ claude mcp add react-zoom-pan-pinch \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact