bsdfzzzy / vue2-hammer

Hammer.js wrapper for Vue 2.x to support some touching operation in the mobile.
MIT License
253 stars 48 forks source link

Pan and pan start event #12

Open RomainFrancony opened 6 years ago

RomainFrancony commented 6 years ago

Hello, thanks for this wrapper!

When trying to add panstart or panleft events alone, it failed with error invalid direction and they are not called.

But if you set the pan event, they will be called at the right timing (panstart on the first event and panleftwhen panning on the left.

Could it be possible to have the panstart event alone please.

Here a simple example to try it, remove the v-hammer:pan="pan" line and see how no other event are called.

<template>
  <div id="app"
  v-hammer:pan="pan"
  v-hammer:panstart="panStart"
  v-hammer:panleft="panLeft">
  </div>
</template>

<script>

export default {
  name: 'app',
  methods: {
    panStart(e) {
      console.log('Pan start called');
    },
    pan(e) {
      console.log('Pan called');
    },
    panLeft(e) {
      console.log('Pan left called');
    }
  }
}
</script>

<style>
#app {
  height: 100vh;
}
</style>