vueuse/gesture

Expose domElement in options

IlyaSemenov opened this issue · 0 comments

I would like to be able to access the original domElement that the handler has been attached to inside gesture callbacks.

The use case would be (simplified code):

<script setup>
// Quick drag-to-scroll implementation
function handleDrag({ domElement, delta: [x, y] }) {
  domElement.scrollBy(-x, -y)
}
</script>

<template>
  <div v-drag="handleDrag">
    <div>child</div>
    <div>child</div>
  </div>
</template>

I realize I can work around this with an additional ref or even with a custom directive (as I did), my point here being reducing boilerplate for simpler ad-hoc code.