New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-zoomable-ui

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-zoomable-ui

React library for building zoomable UI.

latest
Source
npmnpm
Version
0.11.0
Version published
Maintainers
1
Created
Source

React Zoomable UI

Make your HTML elements and React components zoomable, and build interesting zoomable UIs. Supports zooming and panning via touch and mouse interactions.

Features

  • Make your whole page zoomable and pan-able, or just part of it.
  • The zoomable space can be as large as you want, or bounded (x, y, and/or zoom).
  • Has events for different interactions, letting you control how the library responds to mouse clicks and touches.
  • Includes a basic Pressable component that can distinguish between panning, tapping, and long-tapping. It can also be used to implement more advanced interactions like dragging.
  • Has TypeScript types.
  • Supports animations.
  • Technically can be used w/o React.

Browser Support

Tested and works on:

  • Desktop Chrome, Firefox, Safari.
  • Mobile Chrome, and Mobile Safari.
  • Tested w/ a mouse, but not touch, on pre-Chromium Edge.

Not tested on, but ideally should work:

  • post-Chromium Edge, mouse and touch
  • pre-Chromium Edge, touch

Not supported:

  • IE 11 and below
  • Anything else not mentioned

Please send me issues if you run into problems.

Examples

https://aarondail.github.io/react-zoomable-ui/example/

Basic Usage

Making your entire page zoomable

html,
body,
#root {
  height: 100%;
  width: 100%;
  overflow: hidden;
}
#root {
  position: relative;
}
import React from 'react';
import ReactDOM from 'react-dom';
import { Space } from 'react-zoomable-ui';

function App() {
  return (
    <Space>
      <h1>Howdy</h1>
      <div>Try panning an zooming</div>
    </Space>
  );
}

ReactDOM.render(<App />, document.getElementById('root'));

Making one area zoomable

import { Space } from 'react-zoomable-ui';

import mountain from "./mountain.jpg";

const imageWidth = 1280;
const imageHeight = 960;

function ZoomableImage() {
  return (
    <div style={{ width: 300, height: 300, position: "relative" }}>
      <Space
        style={{ border: "solid 1px black" }}
        onCreate={viewPort => {
          viewPort.setBounds({ x: [0, imageWidth], y: [0, imageHeight] });
          viewPort.camera.centerFitAreaIntoView({
            left: 0,
            top: 0,
            width: imageWidth,
            height: imageHeight
          });
        }}
      >
        <img src={mountain} width={imageWidth} height={imageHeight} alt="A Mountain" />
      </Space>
    </div>

Documentation

License

MIT

FAQs

Package last updated on 10 Jan 2023

Did you know?

Socket

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