Closed nikitablack closed 2 weeks ago
Typically you would create your own widget by calling either InvisibleButton()
or ButtonBehavior()
(slightly lower level)
And then draw the visuals yourself (here it would be two calls).
For a timeline like this, I often found it even more practical to submit a single button from ImGui point of view and do the geometry hit-testing yourself based on mouse position. But both ways would work.
Thank you. I implemented this with multiple InvisibleButton
s.
Version/Branch of Dear ImGui:
Version v1.90.7, Branch: docking
Back-ends:
Custom
Compiler, OS:
Ubuntu 20.04
Details:
I'm making a timeline and I want each frame marker to be a button widget - it should interact on hover, mouse press, etc. Something like this: Here I hovered over a frame 20 button (though the capture software moved mouse a bit to the left).
Now I want the markers to stay the same size, but capture mouse below them: Here I hold the mouse cursor under the frame 20 button and want it to be hovered. Also, when I press the button, I want it to look pressed.
I can draw rectangles and assign a color depending on a mouse positions, but is there maybe a simper recommended way? For example, expand the active area of a button somehow?