Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve scroll-to-zoom on web #965

Open
Wumpf opened this issue Jan 27, 2023 · 10 comments · Fixed by #1764
Open

Improve scroll-to-zoom on web #965

Wumpf opened this issue Jan 27, 2023 · 10 comments · Fixed by #1764
Labels
😤 annoying Something in the UI / SDK is annoying to use 🪳 bug Something isn't working egui Requires egui/eframe work 📺 re_viewer affects re_viewer itself 🕸️ web regarding running the viewer in a browser

Comments

@Wumpf
Copy link
Member

Wumpf commented Jan 27, 2023

The smaller the camera distance, the smaller the orbit camera movement via scroll wheel should be (3d space view)
This is already the case, but it's often still hard to accurately zoom in.

Demonstration of problem on Linux:

zoom_jump.mov
@Wumpf Wumpf added 📺 re_viewer affects re_viewer itself 😤 annoying Something in the UI / SDK is annoying to use labels Jan 27, 2023
@Wumpf Wumpf changed the title camera FOV via mouse wheel should change should slow down when already very small camera zoom via mouse wheel should change should slow down even more when already zoomed in very far Jan 30, 2023
@Wumpf Wumpf removed the 😤 annoying Something in the UI / SDK is annoying to use label Jan 30, 2023
@jleibs jleibs added 🪳 bug Something isn't working 😤 annoying Something in the UI / SDK is annoying to use labels Feb 8, 2023
@jleibs
Copy link
Member

jleibs commented Feb 8, 2023

This is very painful and makes the colmap demo nearly unusable on systems that only have a mouse with discrete zoom steps.

This is a single zoom "step" for me at the moment. I have no way to zoom to a level between "too far out" and "too close in."

@emilk emilk changed the title camera zoom via mouse wheel should change should slow down even more when already zoomed in very far Improve camera zoom via mouse wheel Feb 24, 2023
@emilk emilk added the good first issue Good for newcomers label Feb 28, 2023
@emilk
Copy link
Member

emilk commented Feb 28, 2023

@jleibs
Copy link
Member

jleibs commented Mar 21, 2023

This has gotten somewhat better on native recently, but it's noticeably much much worse on web.

@emilk emilk self-assigned this Apr 4, 2023
emilk added a commit that referenced this issue Jun 12, 2023
Problem: when radius shrinks, scrolling no longer does much. This makes
the user think something is broken.

Solution: switch to dolly when radius is small enough. That way
scrolling will always move you closer, one way or another.

Closes #965 (but does not
address os-specific scroll/zoom speed problems)

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
@jleibs jleibs reopened this Jun 12, 2023
@jleibs
Copy link
Member

jleibs commented Jun 12, 2023

This is still quite broken on web. Here's video of scrolling a single step with scroll-wheel on linux.

scroll.mp4

@emilk
Copy link
Member

emilk commented Jun 13, 2023

Here it is on Web on my Mac, scrolling one mouse step at a time (on my mouse):

scroll-step-web

It is pretty worrying that the wheel event acts so differently on different platforms. The eframe code handling this is platform agnostic:

https://github.com/emilk/egui/blob/073f49682da20828dbd118f1d97e14a2b3879631/crates/eframe/src/web/events.rs#L390-L438

Btw, why isn't the scroll smoothed @Wumpf? I know you added code for that, and if I scroll faster I get the smoothed behavior, but @jleibs doesn't. Perhaps he get many duplicates of the wheel events?

This is what I see under the "Inspection -> Input" panel in egui.rs when I scroll very quickly with a mouse wheel:

IMG_5224

Here I get eight scroll lines in one go. If I scroll slower I only get one scroll line at a time (as expected).

If Linux is misbehaving we could consider special treatment on Linux, and just count the number of wheel events and ignore their magnitude (on Linux).

@emilk
Copy link
Member

emilk commented Jan 4, 2024

Please try #4668 on Linux and see how zooming feels these days

@Wumpf
Copy link
Member Author

Wumpf commented Jan 4, 2024

done!

@Wumpf Wumpf closed this as completed Jan 4, 2024
@jleibs jleibs reopened this Jan 4, 2024
@jleibs
Copy link
Member

jleibs commented Jan 4, 2024

The above issues are still present:

This is one wheel click forward/backward:

2024-01-04.18-34-47.mp4

@jleibs
Copy link
Member

jleibs commented Jan 4, 2024

Looks like for me the mouse wheel result is 180 but in units of Point instead of units of Line.

image

@Wumpf
Copy link
Member Author

Wumpf commented Jan 9, 2024

egui.rs also gives me points but shows +/- 13 for a single notch on the scroll wheel

@emilk emilk changed the title Improve camera zoom via mouse wheel Improve scroll-to-zoom on web Jan 29, 2024
@emilk emilk added 🕸️ web regarding running the viewer in a browser egui Requires egui/eframe work labels Jan 29, 2024
@Wumpf Wumpf removed the good first issue Good for newcomers label Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
😤 annoying Something in the UI / SDK is annoying to use 🪳 bug Something isn't working egui Requires egui/eframe work 📺 re_viewer affects re_viewer itself 🕸️ web regarding running the viewer in a browser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants