TheGameCreators / AGK-Studio

3 stars 1 forks source link

Editboxes break sprite hit testing #1120

Open JohnStabler opened 7 months ago

JohnStabler commented 7 months ago

Using GetSpriteHitTest(spriteId, x, y), if the sprite is on top of an edit box then the hit test will fail.

For example, I've implemented my own UI modal window that pops up on top of a bunch of edit boxes to give the user feedback about the data they're entering. If they try to click a sprite button that is above an edit box, nothing is detected.

I have a workaround using SetEditBoxActive(editBoxId, 0) on all edit boxes in the layer below which fixes the problem. However, it's not ideal as GetSpriteHitTest() should always tell you if the point is inside the sprite's hitbox.

VirtualNomad19 commented 7 months ago

hey, john. i've seen the issue on the forums and similar solutions to yours but have you tried GetSpriteHitGroup() instead where i'm wondering if the edit boxes are using sprites internally in some way that may be in the same group as actual sprites?

with that, i thought i saw reference to Groups in the source regarding Edit Boxes with no way to set/get those groups similar to the built-in physics walls which we can't reference directly either while i assume both systems are basically helper-functions utilizing existing command sets that try to make things easier and acknowledging that Input commands, i expect, are precisely that (vs raw input) and are:

guaranteed to function in some way on all platforms

regardless, i'll tag it up appropriately.