HeapsIO / heaps

Heaps : Haxe Game Framework
http://heaps.io
MIT License
3.19k stars 337 forks source link

fix mouse position not added to EKeyDown and EKeyUp #1147

Open ZwodahS opened 1 year ago

ZwodahS commented 1 year ago

https://github.com/ZwodahS/heaps-interactive-bug

When using LetterBox (and possibly other ScaleMode), Interactive is unable to capture EKeyDown and EKeyUp after the screen is resized.

The bug is due to mouse position to set in Event. On JS, this is properly handled but not in hl.

Repo provided to reproduce the bug.

Yanrishatum commented 1 year ago

To elaborate: Because those are not set, it would be equal to window's 0,0 in scene coordinates. Currently EKeyUp/Down can only be received for non-focused interactives that overlap said top-left corner of the window. With this fix - KeyUp/Down events are properly assigned current window mouse position and thus are properly sent to whatever Interactive is currently under the mouse. Notably ETextInput does have its mouse position set properly. This bug is present only on HL side, and not on JS, as here it is properly assigned.