svelte-gesture
v0.1.4
Published
[](https://www.npmjs.com/package/svelte-gesture) ;
function handler({ detail }) {
const {
active,
movement: [mx, my]
} = detail;
coords.set({
x: active ? mx : 0,
y: active ? my : 0
});
}
</script>
<div use:drag on:drag="{handler}" style:transform="translate({$coords.x}px, {$coords.y}px)" />
Simple example
More examples soon...
Actions
svelte-gesture exports several actions that can handle different gestures.
| Action | Description |
| -------- | ------------------------------------------ |
| drag
| Handles the drag gesture |
| move
| Handles mouse move events |
| hover
| Handles mouse enter and mouse leave events |
| scroll
| Handles scroll events |
| wheel
| Handles wheel events |
| pinch
| Handles the pinch gesture |
License
MIT