🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

gesto

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gesto

You can set up drag, pinch events in any browser.

1.19.4
latest
Source
npm
Version published
Weekly downloads
143K
-8.95%
Maintainers
1
Weekly downloads
 
Created

What is gesto?

The 'gesto' npm package is a lightweight library for handling gesture events such as drag, pinch, and rotate. It provides a simple API to manage complex gesture interactions on web applications.

What are gesto's main functionalities?

Drag

This feature allows you to handle drag events. The code sample demonstrates how to use 'gesto' to make an element draggable by updating its transform property based on the drag distance.

const Gesto = require('gesto');
const target = document.querySelector('.target');
const gesto = new Gesto(target);
gesto.on('drag', ({ distX, distY }) => {
  target.style.transform = `translate(${distX}px, ${distY}px)`;
});

Pinch

This feature allows you to handle pinch events. The code sample shows how to use 'gesto' to scale an element based on pinch gestures.

const Gesto = require('gesto');
const target = document.querySelector('.target');
const gesto = new Gesto(target);
gesto.on('pinch', ({ scale }) => {
  target.style.transform = `scale(${scale})`;
});

Rotate

This feature allows you to handle rotate events. The code sample demonstrates how to use 'gesto' to rotate an element based on rotation gestures.

const Gesto = require('gesto');
const target = document.querySelector('.target');
const gesto = new Gesto(target);
gesto.on('rotate', ({ angle }) => {
  target.style.transform = `rotate(${angle}deg)`;
});

Other packages similar to gesto

Keywords

gesture

FAQs

Package last updated on 01 Dec 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