GithubHelp home page GithubHelp logo

isabella232 / gestures Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sveltejs/gestures

0.0 0.0 0.0 28 KB

Svelte actions for cross-platform gesture detection

License: Other

JavaScript 13.60% TypeScript 86.40%

gestures's Introduction

@sveltejs/gestures

A (work-in-progress) collection of gesture recognisers for Svelte components.

Each recogniser is implemented as an action that emits custom events. Pointer events are used where possible, falling back to mouse and touch events.

tap (demo)

This action fires a tap event when the user taps on an element with either a mouse or a finger (or other pointing device). If the pointer is down for more than 300ms, it doesn't count, unlike with click events.

Pressing the spacebar on a focused button will also fire a tap event. Taps on disabled form elements are disregarded.

The event.detail object has x and y properties corresponding to clientX and clientY. If the original event was a spacebar keypress, both are null.

<script>
  import { tap } from '@sveltejs/gestures';

  function handler(event) {
    console.log(`the button was tapped at ${event.detail.x}, ${event.detail.y}`);
  }
</script>

<button use:tap on:tap={handler}>
  tap the button
</button>

TODO: pan, swipe, rotate, pinch, press

License

LIL

gestures's People

Contributors

rich-harris avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.