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

ts-pinch-zoom

v1.0.0

Published

Typescript PinchZoom

Readme

ts-pinch-zoom

Introduction

ts-pinch-zoom is a lightweight, performant library built using TypeScript for enabling pinch-zoom and scroll functionalities on HTML elements. It provides seamless interaction for touch devices and smooth zooming experiences for users.

브라우저에서는 자체 내장 기능으로 인해 pinch zoom이 가능하지만, Webview에서 사용할 때에는 제한되는 부분이 있어 ts pinch zoom을 제작하였습니다.

Features

  • Pinch-to-zoom support
  • Momentum scrolling
  • Configurable zoom range
  • Smooth animation and transitions
  • Support for touch and pointer events

Installation

Install the package using npm:

npm install ts-pinch-zoom

Or using yarn:

yarn add ts-pinch-zoom

Usage

Basic Example

  1. Import the package and initialize it with a target element.
import { PinchZoom } from 'ts-pinch-zoom';

const container = document.querySelector('#zoom-container') as HTMLElement;
const pinchZoom = new PinchZoom(container, {
  zoomMin: 1,
  zoomMax: 3,
  startZoom: 1,
});
  1. Add some basic HTML and CSS:
<div id="zoom-container" style="width: 300px; height: 300px; overflow: hidden;">
  <img src="image.jpg" alt="Zoomable Image" style="width: 100%; height: auto;">
</div>

Options

The library accepts an options object to customize its behavior:

| Option | Type | Default | Description | |------------------------|------------------------|----------------------|--------------------------------------------------------------| | zoom | boolean | true | Enables or disables zoom functionality. | | zoomMin | number | 1 | Minimum zoom scale. | | zoomMax | number | 3 | Maximum zoom scale. | | startZoom | number | 1 | Initial zoom scale when the component loads. | | scrollX | boolean | true | Enables horizontal scrolling. | | scrollY | boolean | true | Enables vertical scrolling. | | momentum | boolean | true | Enables momentum-based scrolling. | | bounce | boolean | false | Enables bounce effect when scrolling past boundaries. | | preventDefault | boolean | true | Prevents default scrolling behavior during touch events. |

For a full list of options, refer to the source code.


Methods

| Method | Description | |----------------------------|---------------------------------------------------------------------| | scrollTo(x: number, y: number, time?: number) | Scrolls to the specified position with optional animation time. | | zoom(scale: number, x?: number, y?: number, time?: number) | Zooms to a specific scale at the given coordinates. | | refresh() | Recalculates layout and updates the component. | | disable() | Disables interaction with the component. | | enable() | Enables interaction with the component. |


Example: Advanced Usage

import { PinchZoom } from 'ts-pinch-zoom';

const container = document.getElementById('zoom-container') as HTMLElement;
const pinchZoom = new PinchZoom(container, {
  zoomMin: 0.5,
  zoomMax: 5,
  startZoom: 1,
  bounce: true,
  scrollX: true,
  scrollY: true,
});

pinchZoom.on('zoomStart', () => {
  console.log('Zoom started');
});

pinchZoom.on('zoomEnd', () => {
  console.log('Zoom ended');
});

Development

To set up the project locally:

  1. Clone the repository:
git clone https://github.com/[your-username]/ts-pinch-zoom.git
  1. Install dependencies:
npm install
  1. Run the development server:
npm run dev

To build the project:

npm run build

To run tests:

npm run test

License

This project is licensed under the MIT License.


Author

yohan.kim

Feel free to contact me for questions or contributions!


Contributing

Contributions are welcome! Please fork the repository and submit a pull request.


Changelog

See CHANGELOG.md for recent updates.


Acknowledgments

Special thanks to the contributors and open-source community.