Nuklear icon indicating copy to clipboard operation
Nuklear copied to clipboard

Fix nk_property not focusing when clicking mouse when the clicked property box is before the currently focused property box in the current window

Open xzn opened this issue 1 year ago • 3 comments

As titled.

Demonstration:

Current (notice when clicking the first box after the second one is focused, it immediately loses focus) https://github.com/user-attachments/assets/a04e6fb8-e638-4b7f-b0d6-fee5c297a657

Fixed (this PR): https://github.com/user-attachments/assets/e482c328-1bf3-4751-979c-6f7e63292b7a

Also ran paq.sh and added casts to match the changes in a previous PR (#682) to get rid of the type warnings introduced in that previous PR.

Update (2024-09-13):

There's another case not covered by this PR: if the content of the the edit field of an activated property was changed, focusing on an earlier property will cause the value to be discarded, while focusing on a later property will update the value. Fixing this inconsistent behavior will be a bit more involved the issue fixed in this PR.

xzn avatar Sep 11 '24 22:09 xzn

Thanks for updating this. Should we bring this in and tackle the follow up afterwards? Or wait until the other case is covered.

RobLoach avatar Sep 14 '24 18:09 RobLoach

I can certainly make a follow up PR. To cover the other case I'll have to add some fields to the context struct so it remembers the previous edit variant. It's a bit more involved and you may want to review that separately. (If you can wait that's fine too, I can get to this later tonight)

Edit:

~~I found a bug in this PR: after dragging a property with mouse, dragging an earlier property with mouse will cause it to be permanently grabbed. Will fix this as well.~~ Nvm it's because i'm using an older version of the demo, apparently mouse grabbing has been updated since then haha.

xzn avatar Sep 14 '24 19:09 xzn

Fixed the second case as well. If you want I can add an example to one of the examples though it seems to work fine for now.

xzn avatar Sep 15 '24 03:09 xzn