Immediate-Mode-UI / Immediate-Mode-UI/Nuklear

nk_widget_bounds and nk_input_is_mouse_hovering_rect treat nk_rect differently on nk_image

Open
#863 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
11.4k
Forks
686
Avg merge
4d 1h
Merged PRs (30d)
3

Description

When trying to detect if the mouse is hovering over an nk_image, it detects the image right under the actual image.

I believe that nk_widget bounds returns a nk_rect where the x and y correspond to the x and y coordinates of the bottom left corner of the widget

While the nk_input_is_mouse_hovering_rect thinks that rect's x and y coordinates correspond to the top left corner.

I'm not entirely sure if the topleft or the bottomleft as xy coordinates is true, so I'm not really sure which one should be fixed.
But I thought this would be useful to point out.

Contributor guide

Open the contributing guide

Research direction

Reproduce the hover mismatch with an nk_image, then inspect nk_widget_bounds and nk_input_is_mouse_hovering_rect to establish their coordinate convention. Done means both functions interpret nk_rect coordinates consistently so the detected hover area matches the displayed image.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.