epezent / implot

Immediate Mode Plotting
MIT License
4.55k stars 503 forks source link

Implement legend scrolling and update scroll capture behavior when zooming #504

Closed epezent closed 11 months ago

epezent commented 11 months ago

This diff implements a long requested feature -- legend scrolling! Long legend lists will now be clipped appropriately and can be scrolled with mouse wheel. This functions for both vertical and horizontal legends, inside or outside, and legends belonging to plots or subplots. This does not currently add a physical scroll bar to long legends. I will add this feature later if users absolutely need it.

scroll_v scroll_h scroll_sub

This diff also removes ImPlotFlags_NoChild, as I discovered we no longer need dummy child windows to capture scroll for plot zooming while implementing this feature. Scroll capture is now accomplished with ImGui::SetKeyOwner, and will only be captured if the scroll event can be used (i.e. we don't capture scroll for locked axes, unscrollable legends, etc.)