Skip to main content
E
2mo ago

Implementing 3-State Buttons for Touchscreens

Hello! What’s the best way to implement a button that works for pointer events and is compatible with touch screen tapping? My proof-of-concept (POC) button has three states: 1. default, 2. small (pointer over), and 3. flat (pointer down).

I’d like this button to work on touchscreens as follows: 1. default, and 3. flat (on touch), with it reverting back to the initial default state. Ideally, it would also play the 2nd state (small) briefly in between, if possible.

Currently, tapping the screen returns the user to the 2nd state instead of 1st, because it seems pointer up is not functioning with tapping?

So yeah, I’d like to know how to professionally implement a 3-state button that works seamlessly on both pointer and touchscreens.

button-for-pointer-and-touch.rev
571 KB
2 replies
E
R
R
2mo ago

Hey! Yeah, you are correct, seems like tapping sets the pointer enter off, but not the pointer exit listener. I've made a little video and update to your file which should work for what you're trying to do.

button-for-pointer-and-touch_update.rev
572 KB
E
2mo ago

Perfect, thank you for taking the time to explain this. Again, super valuable insight for those who want to get to the bottom of concepts. Cheers!