How does the onTap event type CLICK_EVENT_HOLD or CLICK_EVENT_RELEASE work?

I'm testing on an Epix 2 Pro 47mm, both in the simulator and on the physical device. So far, I can only trigger CLICK_EVENT_TAP. Holding the screen longer doesn't seem to trigger CLICK_EVENT_HOLD, and CLICK_EVENT_RELEASE never fires either.

I noticed that simulator.json includes entries for hold and release under displayBehaviors, but they don’t have an id assigned - similar to swipeLeft, which does work.

    "display": {
        "behaviors": [
            {
                "gesture": "swipeRight",
                "id": "onBack",
                "maxDistToEdge": 81,
                "minSwipeDeltaX": 65,
                "minSwipeDeltaY": 65
            },
            {
                "gesture": "swipeLeft"
            },
            {
                "gesture": "swipeUp",
                "id": "nextPage"
            },
            {
                "gesture": "swipeDown",
                "id": "previousPage"
            },
            {
                "gesture": "hold"
            },
            {
                "gesture": "release"
            },
            {
                "gesture": "tap",
                "id": "onSelect"
            }
        ],
        "isTouch": true,
        "landscapeOrientation": 0,
        "location": {
            "height": 416,
            "width": 416,
            "x": 122,
            "y": 238
        },
        "shape": "round"
    }

  • It's probably not clear from the docs but CLICK_EVENT_HOLD and CLICK_EVENT_RELEASE aren't onTap() event types. CLICK_EVENT_HOLD corresponds to InputDelegate.onHold() and CLICK_EVENT_RELEASE corresponds to onRelease(). (Ofc, CLICK_EVENT_TAP corresponds to onTap()).

    This can be seen in the sim for epix2pro47mm (and other devices), using the SDK Input sample, which handles onHold() and onRelease(). I was able to trigger hold and release events in both Windows and Mac.

    Yes, this raises a couple of questions, like:

    - why isn't there an event handler like onClick() which handles all the click events?

    - since there isn't an onClick() handler, what's the point of having click event enums in the first place? (The click event type is redundant information given that each click event has a different handler.)

    - why is ClickEvent different from DragEvent, KeyEvent, SwipeEvent, etc., each of which has a "catch-all" event handler which handles all the possible events of that type, rather than having a separate handler for each event?

    I'm gonna go ahead and speculate that somebody thought it would be confusing to have a function named "onClick" which also handles hold and release events, and/or it was tough to figure out a word that intuitively refers to taps, holds and releases. (But then again they already used ClickEvent / CLICK_EVENT to describe all 3 of those things.)

  • Ah, great, that works!

    You're right - it is a bit confusing. When I was looking for the hold event, I first saw onTap() with a ClickEvent that could have different types. That led me to think it was a general event handler, similar to onSwipe() or onKey(). It did seem a bit odd that the event type shared the exact name with the function, but I didn’t pay enough attention to that detail at the time.