onMouseDown(btn: MouseButton | MouseButton[], action: (m: MouseButton)=>void): KEventController
Register an event that runs every frame when certain mouse buttons are being held down.
param
btn- The mouse button(s) to listen for. See
param
action- The function that is run when certain mouse buttons are being held down.
// count time with left mouse button down let mouseTime = 0; onMouseDown("left", () => { mouseTime += dt(); debug.log(`Time with mouse down: ${mouseTime}); });
returns
The event controller.
since
v3001.0