But it came out error message Uncaught TypeError: rightButton.addEventListener is not a function
at HTMLImageElement.. The rightbutton is a button from Babylon GUI. How can I make a hold button event trigger ?
It is related to the type definition in typescript. HTMLImageElement type doesn’t have addEventListener function exposed. So cast it to the parent type HTMLElement.
you could probably attach an event onPointerDown and start a timer . Kill the timer in the pointer up function so it would only trigger if you press long enough.