I want to add pressed states to my buttons:
# Touchtargets States PressedtouchTargets = [btnOpenProfile,btnCloseModalWrapper]
for i in touchTargets i.states.add pressed: opacity: 0.5 i.states.animationOptions = time: 0.01
i.on Events.Click, (event, id) -> id.on Events.TouchStart, -> id.states.switch "pressed" id.on Events.TouchEnd, -> id.states.switch "default"
Initially it doesn't work, but when I tap a button the next time it does :-(
Why have the Events.Click listener?
You're only adding those listeners when you click. Add the listeners right away. FWIW "Click" is triggered on mouse/touch up.
Yes, thank you!