Luxar Viewer API Documentation - v2026.9.22
    Preparing search index...

    Module utils/long-press

    Long-press → "secondary action" for touch-like pointers.

    Right-click is the sole route to several menus in the viewer (rail popovers, animation settings, layer visibility verbs, the element menu). A finger has no right button, and the platforms disagree on what a long press does: iOS Safari never fires contextmenu for it (it raises a callout sheet instead, which -webkit-touch-callout: none suppresses), while Android Chrome synthesises a contextmenu event. This helper makes the viewer the SINGLE opener on both: it fires its callback after durationMs, or immediately when a platform contextmenu arrives mid-press. Only a handled press swallows that event (so one press cannot open two menus) and the click the browser emits when the finger finally lifts (so the button's primary action does not run on top of the menu that just opened).

    Only touch-like pointers arm it (isTouchLikePointer): a mouse keeps its right button and never sees a timer, so desktop behaviour is unchanged.

    LongPressOptions
    LONG_PRESS_MS
    LONG_PRESS_SLOP_PX
    attachLongPress