epezent / implot

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

Zoom via external slider (as a poor mans replacement for multi touch pinch to zoom) #469

Open stohn opened 1 year ago

stohn commented 1 year ago

Hi Evan,

First of all, I have to say a big THANK YOU for this excellent library. Whenever I wanted another extra "bells and whistles" it was already covered and just a simple look at the demo, and "lift some code" from there.

The last major item I still need to tackle for my project is an easy way to zoom the diagram. The final version should run on a Raspberry PI with its own (multi) touch screen (panning already works with the normal touch to mouse translation from the OS). I know this problem has been brought up a few times before (here and in the ImGui project itself), but somehow I really need to find a solution or workaround.

I've already had an extensive look at SDL_MultiGesture(), but I'm having a hard time running even a simple SDL test on my particular hardware (not to mention multiple platform support...).

So my idea was to just add a horizontal and vertical slider next to the plot area and try to use them to zoom. That kinda worked, but for some reason I never figured out how to use the axis limits / links / ... (I tried many things) properly to make it work and feel "normal".

I think that ImPlot's public API is just not sufficient to achieve this.

Do you have any suggestions or ideas on how to achieve this?

Thanks in advance,

Maik