emilk / egui_plot

2D plotting library in Rust for egui
Apache License 2.0
65 stars 23 forks source link

Zoom without CTRL/CMD #26

Open DasLixou opened 2 months ago

DasLixou commented 2 months ago

Is your feature request related to a problem? Please describe. I am using egui_plot to draw a plot and currently have to press ctrl/cmd in order to zoom in and out with the scroll wheel.

Describe the solution you'd like I want to zoom in and out with the scroll wheel directly without having to press ctrl/cmd.

Describe alternatives you've considered Somehow hacking that in myself. But this got even harder because now scrolling is done by egui and seems to be strictly coupled with ctrl/cmd.

YgorSouza commented 2 months ago

We do have an example at least: https://github.com/emilk/egui/tree/0f6310c598b5be92f339c9275a00d5decd838c1b/examples/custom_plot_manipulation.

emilk commented 2 months ago

When I drag two fingers across my trackpad, I get 2D scroll events. That should pan the plot, not zoom. I don't see how you would distinguish that from a 1D scroll action on a mouse.

DasLixou commented 2 months ago

When I drag two fingers across my trackpad, I get 2D scroll events. That should pan the plot, not zoom. I don't see how you would distinguish that from a 1D scroll action on a mouse.

Dragging (if that's what you mean by pan) should only be done with pressing down. I want to recreate something that feels like Google Maps or something

emilk commented 2 months ago

I can see why you would want that. For contrast, the Maps app on my Mac works pretty similar to egui_plots, with pinch-to-zoom and scroll-to-pan.

I guess we want to add some settings then so users can control this behavior.

DasLixou commented 2 months ago

How hard would that be to implement? Is that something a noobie like me could do? O.o If winit seperates scroll on trackpad and scroll on mouse I do think it could be trivial, especially with the new egui-controlled zoom stats.