SwipeDirectionMixin

Overview

Purpose: maps swipe gestures to direction semantics.

This mixin works in the middle of the Elix render pipeline:

events → methodsmethods → setState → updates → render DOM → post-render

Expects the component to provide:

Provides the component with:

Usage

import SwipeDirectionMixin from 'elix/src/SwipeDirectionMixin.js';
class MyElement extends SwipeDirectionMixin(HTMLElement) {}

Mapping swipe gestures to direction semantics

This mixin maps a swipeLeft call to symbols.goRight, and a swipeRight call to symbols.goLeft. Note that the reversal of direction in those mappings: e.g., a swipe to the left means the user wants to go right, because the user is typically dragging something in from the right.