Map swipe gestures to direction semantics


Purpose: maps swipe gestures to direction semantics.

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

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

Expects the component to provide:

Provides the component with:


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

Mapping swipe gestures to direction semantics

This mixin maps a swipeLeft call to internal.goRight, and a swipeRight call to internal.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.