Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
vue-use-gesture
Advanced tools
Readme
Vue UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.
You can use it stand-alone, but to make the most of it you should combine it with an animation library like vue-use-spring, though you can most certainly use any other.
The demos are real (we'll add them to the codesandbox soon)
#Yarn
yarn add vue-use-gesture
#NPM
npm install vue-use-gesture
<template>
<!-- Bind it to a component -->
<div v-bind="bind()" :style="style" class="box"></div>
</template>
<script>
import { useDrag } from 'vue-use-gesture'
import { useSpring } from 'vue-use-spring'
import { defineComponent, computed } from 'vue'
export default defineComponent({
setup() {
const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))
// Set the drag hook and define component movement based on gesture data
const bind = useDrag(({ down, movement: [mx, my] }) => {
set({ x: down ? mx : 0, y: down ? my : 0 })
})
const style = computed(() => ({ transform: `translate3d(${x.value}px,${y.value}px,0)`, touchAction: 'none' }))
return { bind, style }
},
})
</script>
The example above makes a div
draggable so that it follows your mouse on drag, and returns to its initial position on release.
Make sure you always set touchAction
on a draggable element to prevent glitches with the browser native scrolling on touch devices.
vue-use-gesture
exports several hooks that can handle different gestures:
Hook | Description |
---|---|
useDrag | Handles the drag gesture |
useMove | Handles mouse move events |
useHover | Handles mouse enter and mouse leave events |
useScroll | Handles scroll events |
useWheel | Handles wheel events |
usePinch | Handles the pinch gesture |
useGesture | Handles multiple gestures in one hook |
This library is a port of React UseGesture. Thanks Polmandres 🙏
MIT
FAQs
Vue hook for receiving gestures https://vue-use-gesture.netlify.app
The npm package vue-use-gesture receives a total of 80 weekly downloads. As such, vue-use-gesture popularity was classified as not popular.
We found that vue-use-gesture demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.