https://kotlinlang.org logo
#korge
Title
# korge
n

nanodeath

09/23/2020, 2:26 AM
hey, so when I set a virtualWidth/virtualHeight (differently from the native width/height), it seems like
Copy code
playArea.hitTest(mouseXY)
(playArea is a
roundRect
) no longer works correctly.
Copy code
playArea.hitTest(playArea.localMouseXY(views))
also doesn't work. what's the incantation I'm missing?
alright, I figured it out. 1. View.hitTest says it requires local coords, but in fact requires global coords 2.
mouseXY
, aka
Stage.mouseXY
, return coords relative to the Stage (seems obvious now...) 3.
views.input.mouse
is undocumented but seems to return global coords. 4.
playArea.hitTest(views.input.mouse)
is the answer.
d

Deactivated User

09/23/2020, 6:03 AM
Yeah thats a bit misleading. We have to figure out a way to make it less confusing. If you have suggestions in that direction, let us know
n

nanodeath

09/23/2020, 3:13 PM
I think checking that hitTest's documentation is correct, and having `mouseXY`'s and `views.input.mouse`'s documentation reference each other, that would be sufficient. (or renaming mouse to localMouse/globalMouse, but obviously we can't do that)
d

Deactivated User

09/24/2020, 8:10 AM
Well since we are working on korge 2.0 now and compatibility breaking is allowed, we can make those renames if makes more sense