diku-canvas icon indicating copy to clipboard operation
diku-canvas copied to clipboard

Add KeyUp event

Open casperbrahe opened this issue 7 months ago • 0 comments

Using the Canvas module there is currently no way to detect when several keys is used at the same time, since KeyPress events (which are actually text events) only fire for the latest pressed button. An example of the consequences of this is that in a game-like app you are unable to move and rotate (and/or fire) at the same time.

Adding a KeyUp event that fires whenever a key is released would allow for state management, in effect allowing for the use of several keys at any given time, but without increasing the complexity of the current toolset.

Old behavior:

Key 'q' Key 'w' Key 'e' Key 'r' LeftArrow DownArrow RightArrow UpArrow

New behavior:

Key 'q' KeyUp "Q" Key 'w' KeyUp "W" Key 'e' KeyUp "E" Key 'r' KeyUp "R" LeftArrow KeyUp "Left" DownArrow KeyUp "Down" RightArrow KeyUp "Right" UpArrow KeyUp "Up"

casperbrahe avatar Nov 25 '23 16:11 casperbrahe