epezent / implot

Immediate Mode Plotting
MIT License
4.84k stars 531 forks source link

A way to create drag rects from selection (other than SelectCancel click) #566

Open v-ein opened 7 months ago

v-ein commented 7 months ago

Before the query feature got replaced with DragRect, ImPlot had seemed to allow the user to draw the query rect - either with QueryButton, or by using box-select with QueryToggleMod. With DragRect, it's not clear how to let the user draw the query area.

I don't really like the solution used in the ImPlot demo, where the user needs to click SelectCancel during selection in order to create a DragRect. This gesture is not very intuitive, and might even be difficult for some users. Holding a modifier key during a regular selection would be much easier IMHO.

I'm trying to mimick QueryToggleMod on the latest version of ImPlot and I can't figure out a good way to make it work. The main problem is that I cannot handle the mouse-up event before ImPlot does the same, and cancel the selection before ImPlot zooms in.

So what would be the recommended way to create DragRects from user input? If clicking SelectCancel is the only way, can we modify ImPlot to provide some other ways (like QueryToggleMod), or to provide some means to implement other ways on the application side?