Socket
Socket
Sign inDemoInstall

react-quick-pinch-zoom-ssr

Package Overview
Dependencies
6
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-quick-pinch-zoom-ssr

A react component that providing multi-touch gestures for zooming and dragging on any DOM element.


Version published
Weekly downloads
125
increased by10.62%
Maintainers
1
Install size
64.9 kB
Created
Weekly downloads
 

Changelog

Source

3.0.0

  • Add typescript definitions
  • Reduce package size
  • Remove classnames
  • Remove css loader

Readme

Source

react-quick-pinch-zoom-ssr

This repo is forked from react-quick-pinch-zoom, just added some extra code to make it workable on server side.

react-quick-pinch-zoom on npm npm downloads react-quick-pinch-zoom bundle size CI status

A react component that lets you zooming and dragging on any DOM element using multi-touch gestures on mobile devices and mouse-events\wheel on desktop devices. Based on this module manuelstofer/pinchzoom

Component features:

  • 🔮 Simple. Easy to use;
  • 🍎 It works with mobile touch gestures and desktop mouse events;
  • ⚡ Fast, 60 FPS on mobile devices.

Install

yarn add react-quick-pinch-zoom

Screenshots

Video...

Usage

import React, { useCallback, useRef } from "react";
import QuickPinchZoom, { make3dTransformValue } from "react-quick-pinch-zoom";

const IMG_URL =
  "https://user-images.githubusercontent.com/4661784/" +
  "56037265-88219f00-5d37-11e9-95ef-9cb24be0190e.png";

export const App = () => {
  const imgRef = useRef();
  const onUpdate = useCallback(({ x, y, scale }) => {
    const { current: img } = imgRef;

    if (img) {
      const value = make3dTransformValue({ x, y, scale });

      img.style.setProperty("transform", value);
    }
  }, []);

  return (
    <QuickPinchZoom onUpdate={onUpdate}>
      <img ref={imgRef} src={IMG_URL} />
    </QuickPinchZoom>
  );
};

License

MIT © retyui

Keywords

FAQs

Last updated on 16 Sep 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc