How to use the @polymer/polymer/lib/utils/gestures.js.addListener function in @polymer/polymer

To help you get started, we’ve selected a few @polymer/polymer 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 FabricElements / skeleton-carousel / skeleton-carousel.ts View on Github external
protected firstUpdated(initProperties: PropertyValues): void {
    super.firstUpdated(initProperties);
    const container: HTMLSlotElement = this.shadowRoot.querySelector("slot");

    // Allow vertical scrolling
    const carousel: HTMLDivElement = this.shadowRoot.querySelector("#carousel");
    Gestures.addListener(carousel, "track", this._drag.bind(this));
    this.setScrollDirection("all", carousel);
    this.children = FlattenedNodesObserver.getFlattenedNodes(container)
      // @ts-ignore
      .filter((n: HTMLElement) => {
        return n.nodeType === Node.ELEMENT_NODE;
      });
    // Handle transition end
    const items = this.shadowRoot.querySelector("#items");
    items.addEventListener("transitionend", (e: any) => {
      e.preventDefault();
      if (this.swiping || e.propertyName !== "transform") {
        return;
      }
      this.animating = false;
    });
github wiredjs / wired-elements / packages / wired-slider / wired-slider.js View on Github external
_attachEvents() {
    if (!this._knobAttached) {
      addListener(this._knob, 'down', (event) => {
        if (!this.disabled) {
          this._knobdown(event);
        }
      });
      addListener(this._knob, 'up', (event) => {
        if (!this.disabled) {
          this._resetKnob(event);
        }
      });
      addListener(this._knob, 'track', (event) => {
        if (!this.disabled) {
          this._onTrack(event);
        }
      });
      this._knobAttached = true;
    }
github wiredjs / www / node_modules / wired-slider / wired-slider.js View on Github external
_attachEvents() {
    if (!this._knobAttached) {
      addListener(this._knob, 'down', (event) => {
        if (!this.disabled) {
          this._knobdown(event);
        }
      });
      addListener(this._knob, 'up', (event) => {
        if (!this.disabled) {
          this._resetKnob(event);
        }
      });
      addListener(this._knob, 'track', (event) => {
        if (!this.disabled) {
          this._onTrack(event);
        }
      });
      this._knobAttached = true;
    }
    if (!this._keyboardAttached) {
      this.addEventListener('keydown', (event) => {
        switch (event.keyCode) {
          case 38:
          case 39:
github web-padawan / lit-components / packages / button-base / lit-button-base.js View on Github external
_addActiveListeners() {
    addListener(this, 'down', () => !this.disabled && this.setAttribute('active', ''));
    addListener(this, 'up', () => this.removeAttribute('active'));
    this.addEventListener(
      'keydown',
      e => !this.disabled && [13, 32].indexOf(e.keyCode) >= 0 && this.setAttribute('active', '')
    );
    this.addEventListener('keyup', () => this.removeAttribute('active'));
    this.addEventListener('blur', () => this.removeAttribute('active'));
  }
github Scarygami / scary-cube / scary-cube.js View on Github external
updated(changedProperties) {
    if (changedProperties.has('noGestures')) {
      if (this.noGestures) {
        Gestures.removeListener(this, 'track', this._boundTrackHandler);
      } else {
        Gestures.addListener(this, 'track', this._boundTrackHandler);
      }
    }
  }
github wiredjs / wired-elements / packages / wired-slider / wired-slider.js View on Github external
_attachEvents() {
    if (!this._knobAttached) {
      addListener(this._knob, 'down', (event) => {
        if (!this.disabled) {
          this._knobdown(event);
        }
      });
      addListener(this._knob, 'up', (event) => {
        if (!this.disabled) {
          this._resetKnob(event);
        }
      });
      addListener(this._knob, 'track', (event) => {
        if (!this.disabled) {
          this._onTrack(event);
        }
      });
      this._knobAttached = true;
    }
    if (!this._keyboardAttached) {
      this.addEventListener('keydown', (event) => {
        switch (event.keyCode) {
          case 38:
          case 39:
            this._incremenent();
            break;
          case 37:
          case 40:
            this._decrement();
github wiredjs / www / node_modules / wired-slider / wired-slider.js View on Github external
_attachEvents() {
    if (!this._knobAttached) {
      addListener(this._knob, 'down', (event) => {
        if (!this.disabled) {
          this._knobdown(event);
        }
      });
      addListener(this._knob, 'up', (event) => {
        if (!this.disabled) {
          this._resetKnob(event);
        }
      });
      addListener(this._knob, 'track', (event) => {
        if (!this.disabled) {
          this._onTrack(event);
        }
      });
      this._knobAttached = true;
    }