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.
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
contextmenufor it (it raises a callout sheet instead, which-webkit-touch-callout: nonesuppresses), while Android Chrome synthesises acontextmenuevent. This helper makes the viewer the SINGLE opener on both: it fires its callback afterdurationMs, or immediately when a platformcontextmenuarrives mid-press. Only a handled press swallows that event (so one press cannot open two menus) and theclickthe 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.