How to use the hammerjs.DIRECTION_LEFT function in hammerjs

To help you get started, we’ve selected a few hammerjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ubyssey / dispatch / dispatch / themes / ubyssey / static / js / src / components / Gallery.jsx View on Github external
handleHammer: function(ev) {

        // disable browser scrolling
        //ev.preventDefault();

        switch(ev.type) {
            case 'panright':
            case 'panleft':
                // stick to the finger
                var pane_offset = -(100/this.pane_count) * this.current_pane;
                var drag_offset = ((100/this.pane_width) * ev.deltaX) / this.pane_count;

                // slow down at the first and last pane
                if((this.current_pane == 0  && ev.direction == Hammer.DIRECTION_RIGHT) ||
                   (this.current_pane == this.pane_count-1 && ev.direction == Hammer.DIRECTION_LEFT)) {
                  drag_offset *= .4;
                }

                this.setContainerOffset(drag_offset + pane_offset);
                break;

            case 'panend':
            case 'pancancel':
                // Left & Right
                // more then 1/3 moved, navigate
                if(Math.abs(ev.deltaX) > this.pane_width/3) {
                  if(ev.direction == Hammer.DIRECTION_RIGHT) {
                    this.prevSlide();
                  } else {
                    this.nextSlide();
                  }
github kappys1 / angular2-carousel / dist / src / carousel.component.js View on Github external
this.carouselElm.nativeElement.addEventListener('transitionstart', function (e) {
            var elm = { carousel: vm.carousel, event: e };
            if (e.propertyName === "transform") {
                _this.onTransitionStart.emit(elm);
                if (e.direction === Hammer.DIRECTION_LEFT) {
                    vm.onSlideNextTransitionStart.emit(elm);
                }
                else if (e.direction === Hammer.DIRECTION_RIGHT) {
                    vm.onSlidePrevTransitionStart.emit(elm);
                }
            }
        });
        window.addEventListener("resize", function () {
github kappys1 / angular2-carousel / src / carousel.component.ts View on Github external
this.carouselElm.nativeElement.addEventListener('transitionstart', (e : any) =>{
      let elm = {carousel:vm.carousel,event:e};
      if(e.propertyName === "transform"){
          this.onTransitionStart.emit(elm);
          if(e.direction === Hammer.DIRECTION_LEFT){
              vm.onSlideNextTransitionStart.emit(elm);
          }
          else if(e.direction === Hammer.DIRECTION_RIGHT){
              vm.onSlidePrevTransitionStart.emit(elm);
          }
      }
    });
    window.addEventListener("resize", function(){
github UnchartedBull / OctoDash / src / app / app.module.ts View on Github external
export class HammerConfig extends HammerGestureConfig {
  overrides = {
    pan: {
      direction: 6
    },
    pinch: {
      enable: false
    },
    rotate: {
      enable: false
    },
    press: {
      pointers: 1, time: 501, threshold: 15
    },
    swipe: {
      pointers: 1, direction: Hammer.DIRECTION_LEFT, threshold: 20, velocity: 0.4
    }
  };
}

@NgModule({
  declarations: [
    AppComponent,
    BottomBarComponent,
    PrinterStatusComponent,
    JobStatusComponent,
    LayerProgressComponent,
    InvalidConfigComponent,
    NoConfigComponent,
    PrintControlComponent,
    NotificationComponent,
    MainMenuComponent,
github alexhisen / mobx-schema-form / src / DateField.jsx View on Github external
onSwipe = (e) => {
    switch (e.direction) {
      case Hammer.DIRECTION_LEFT: {
        const button = document.querySelector('[data-react-toolbox=calendar] button#right');
        if (button) {
          button.click();
        }
        break;
      }
      case Hammer.DIRECTION_RIGHT: {
        const button = document.querySelector('[data-react-toolbox=calendar] button#left');
        if (button) {
          button.click();
        }
        break;
      }
    }
  };
github UnchartedBull / OctoDash / src / app / app.module.ts View on Github external
import { PrinterService } from './printer.service';

import { URLSafePipe } from './url.pipe';

import { fas } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeModule, FaIconLibrary } from '@fortawesome/angular-fontawesome';
import { NgxSpinnerModule } from 'ngx-spinner';

import * as Hammer from 'hammerjs';
import { RoundProgressModule } from 'angular-svg-round-progressbar';


export class MyHammerConfig extends HammerGestureConfig {
  overrides = {
    press: { pointers: 1, time: 501, threshold: 15 },
    swipe: { pointers: 1, direction: Hammer.DIRECTION_LEFT, threshold: 20, velocity: 0.4 }
  } as any;
}

export class HammerConfig extends HammerGestureConfig {
  overrides = {
    pan: {
      direction: 6
    },
    pinch: {
      enable: false
    },
    rotate: {
      enable: false
    },
    press: {
      pointers: 1, time: 501, threshold: 15
github arnoldczhang / fe-guide / src / vue / vue-mark-display / App.vue View on Github external
mc.on("swipe", event => {
      if (event.pointerType === "mouse") {
        return;
      }
      switch (event.direction) {
        case Hammer.DIRECTION_LEFT:
          display.goNext();
          return;
        case Hammer.DIRECTION_RIGHT:
          display.goPrev();
          return;
      }
    });
  },
github cozy / cozy-ui / react / Viewer / ViewerControls.jsx View on Github external
onSwipe = e => {
    if (e.direction === Hammer.DIRECTION_LEFT) this.props.onNext()
    else if (e.direction === Hammer.DIRECTION_RIGHT) this.props.onPrevious()
  }
github software-mansion / react-native-gesture-handler / web / PanGestureHandler.js View on Github external
const {
      activeOffsetXStart,
      activeOffsetXEnd,
      activeOffsetYStart,
      activeOffsetYEnd,
      minDist,
    } = config;
    let directions = [];
    let horizontalDirections = [];

    if (!isnan(minDist)) {
      return Hammer.DIRECTION_ALL;
    }

    if (!isnan(activeOffsetXStart))
      horizontalDirections.push(Hammer.DIRECTION_LEFT);
    if (!isnan(activeOffsetXEnd))
      horizontalDirections.push(Hammer.DIRECTION_RIGHT);
    if (horizontalDirections.length === 2)
      horizontalDirections = [Hammer.DIRECTION_HORIZONTAL];

    directions = directions.concat(horizontalDirections);
    let verticalDirections = [];

    if (!isnan(activeOffsetYStart))
      verticalDirections.push(Hammer.DIRECTION_UP);
    if (!isnan(activeOffsetYEnd))
      verticalDirections.push(Hammer.DIRECTION_DOWN);

    if (verticalDirections.length === 2)
      verticalDirections = [Hammer.DIRECTION_VERTICAL];