mwg API
    Preparing search index...

    Function attachSwipe

    • Turns a one-finger drag on target into a single directional action pulse - press immediately followed by release, the same shape a quick key tap produces - resolved to one of 8 directions by angle, or to actions.tap for a touch that barely moved. Movement by swipe rather than a held virtual d-pad is the more common mobile roguelike control scheme (a swipe per tile, not a held direction), so this dispatches one pulse per gesture rather than holding an action down for the drag's duration.

      Returns a function that removes the listeners this attached.

      Parameters

      Returns () => void