New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-free-viewport

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-free-viewport

A viewport with drag and zoom support.

  • 1.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

A drag and zoom supported viewport.

Using CSS transform.

Installation

npm install --save react-free-viewport

Usage

import * as React from "react";
import * as ReactDOM from "react-dom";
import ViewPort from "react-free-viewport";

const element = (
    <div>
        <ViewPort id="view-port">
            <div>
                Hello World!
            </div>
        </ViewPort>
    </div>
);
const $ = selector => document.querySelector(selector);

ReactDOM.render(element, $("#root"));
#view-port{
    font-size: 24pt;
    padding: 20px;
    width: 400px;
    height: 300px;
    overflow: hidden;
}

DEMO

Documentation

Props

NameTypeDefaultDescription
buttonnumber0Indicate which mouse button can be used to drag. 0: left, 1: mid, 2: right
scaleFactornumber1.2The scale factor when the mouse wheel scroll up. If the value is less then 1, the viewport will zoom out when scroll up, and zoom in when scroll down.
grabCursorstring"-webkit-grabbing"The CSS cursor property value while dragging.

Keywords

FAQs

Package last updated on 20 Sep 2018

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc