npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rbuljan/zoompan

v1.0.0

Published

Zoomable and pannable area with scrollbars. Inspired by graphical editors like Photoshop.

Downloads

9

Readme

ZoomPan

Zoomable and pannable area with scrollbars.
Inspired by graphical editors like Photoshop.

Supports Pinch gesture for scaling

Zoom pan area - Image edit software scroll area

Example

See: example/index.html for a use-case.

Getting started

npm i @rbuljan/zoompan

HTML:

<!-- index.html -->
<div id="myEditor"></div>

I.e: using Vite.js

// main.js

import "@rbuljan/zoompan/zoompan.css";
import ZoomPan from "@rbuljan/zoompan";

const ZP = new ZoomPan("#myEditor", {
  width: 800,
  height: 600,
  onInit() {
    this.elCanvas.style.backgroundColor = "gold";
    this.elCanvas.textContent = "Hello ZoomPan!";
  },
  onChange() {
    console.log(this);
  },
  // other options here...
});

console.log(ZP);

Options

| Name | Type | Default | Description | | -------------------- | ------- | ------- | ------------------------------------- | | width | Number | 800 | Canvas width | | height | Number | 600 | Canvas height | | offsetX | Number | 0 | Canvas offset X (from center) | | offsetY | Number | 0 | Canvas offset Y (from center) | | scale | Number | 1 | Initial Scale (if not fitted on init) | | scaleOld | Number | scale | Old Scale value (before changed) | | scaleFactor | Number | 0.2 | Scale factor | | scaleMin | Number | 0.05 | Scale min value | | scaleMax | Number | 10 | Scale max value | | transitionDuration | Number | 250 | ms transition duration | | padd | Number | 40 | Min visible canvas padd | | panStep | Number | 50 | Pixels pan step value | | scrollbars | Boolean | true | Show scrollbars | | scrollbarsWidth | Number | 14 | px scrollbars size | | fitOnInit | Boolean | true | Fix canvas into viewport on init | | canDrag | Boolean | true | If canvas can be pointer-dragged | | canPinch | Boolean | true | Allow two-finger pinch |

Options — Events

| Name | Description | | -------------- | -------------------------------- | | onInit() | Triggered on class instantiation | | onScale() | Triggered on scale change | | onPan() | Triggered on pan (pointermove) | | onChange() | Triggered on: init, pan, scale | | onPanStart() | Triggered on pan (pointerdown) | | onPanEnd() | Triggered on pan (pointerup) |

Methods

| Name | Returns | Description | | ------------------------------------- | --------------------- | ---------------------------------------------- | | panTo(offsetX, offsetY) | | Pan canvas to new offset (canvas center) | | scaleTo(scale [, originX, originY]) | | Scale canvas from point origin (canvas center) | | scaleUp() | | Scale up. Alias for scaleDelta(1) | | scaleDown() | | Scale down. Alias for scaleDelta(-1) | | scaleDelta(delta) | | Scale by delta | | resize(width, height) | | Change canvas width and height | | updateScrollbars() | | Reposition and resize scrollbars | | fit() | | Fit canvas into viewport center (contain) | | getArea() | {width, height} | Get fictive "scroll area" size | | getCanvas() | {x, y, width, height} | Get Canvas data | | getViewport() | {x, y, width, height} | Get Viewport data | | getPointerOrigin(Event) | {originX, originY} | Get pointer XY relative to viewport center | | getWheelDelta(Event) | number | Get wheel delta +1 or -1 on wheel-down | | calcScaleDelta(delta) | number | Get the new scale value from delta |

Licence

MIT