0

I am building a angular website. using hammer.js for mobile gestures animations. when browsing the website form PC/laptop I don't want the mouse to be able to trigger swipe events.

I know that hammer.js on default treats the mouse as touch. I tried to configure the HammerGestureConfig and override the defaults

import * as Hammer from 'hammerjs';
import { HammerGestureConfig, HAMMER_GESTURE_CONFIG } from 
'@angular/platform-browser';

export class HammerConfig extends HammerGestureConfig {
  options : {
    inputTarget?: Hammer.TouchInput; //-----this is where i lost it ---//
   }
}


  providers: [
    ContactService,
    {
      provide: HAMMER_GESTURE_CONFIG,
      useClass: HammerConfig
    }
  ],

I expect this to set hammer.js to only read touch events but the mouse still can trigger my animations

  • Welcome! I think you could detect if the user is using a web browser in a desktop or a mobile browser [right here](https://stackoverflow.com/q/11381673/3681565) – Gaspar Apr 26 '19 at 20:52
  • If you think it is difficult to use it, use a package for it like _ngx-device-detector_ – Gaspar Apr 26 '19 at 20:54

0 Answers0