defold-input icon indicating copy to clipboard operation
defold-input copied to clipboard

Incorrect offset of analog stick when parent is scaled

Open Fossean1 opened this issue 1 year ago • 3 comments
trafficstars

If you change the scale of the parent element of the analog stick, it starts to work incorrectly.

Fossean1 avatar Mar 20 '24 06:03 Fossean1

@Fossean1 could you please explain how it starts to work incorrectly. I took the example and set the analog_bg to 2x scale and it seems to work as expected.

britzl avatar Mar 25 '24 09:03 britzl

@britzl sure 🙂. Here is the problem based on an example in the "onscreen gui" project. If you make the "analog" node a parent for the "analog_bg" node and zoom in/out the "analog_bg" node, the "analog" node moves incorrectly relative to the cursor. image

https://github.com/britzl/defold-input/assets/53948838/df6db1f8-00af-4458-bf1d-5dd39716c249

Fossean1 avatar Mar 25 '24 11:03 Fossean1

Ah, ok, I see. The solution would be to somehow take the aggregated scale of the node and parent nodes into account when moving the node.

britzl avatar Mar 25 '24 12:03 britzl