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

Add egui::Scene for panning/zooming a Ui #5505

Merged
merged 18 commits into from
Jan 28, 2025
Merged

Conversation

grtlr
Copy link
Collaborator

@grtlr grtlr commented Dec 19, 2024

This is similar to ScrollArea, but:

  • Supports zooming
  • Has no scroll bars
  • Has no limits on the scrolling

TODO

  • Automatic sizing of Scenes outer bounds
  • Fix text selection in scenes
  • Implement fit_rect
  • Document / improve API

Copy link

Preview available at https://egui-pr-preview.github.io/pr/5505-grtlrzoom-and-pan-area
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

@emilk
Copy link
Owner

emilk commented Dec 19, 2024

I wonder if we can come up with a better name for this? 🤔

@grtlr
Copy link
Collaborator Author

grtlr commented Dec 20, 2024

Some things that come to my mind (lower entries of the list are augmented by our AI overlords, you might guess which):

  • (infinite) Canvas (but might be too close to <canvas />)
  • Scene
  • View (too general; Viewport is already taken)
  • Pad
  • Board
  • Expanse

@xTibor
Copy link
Contributor

xTibor commented Dec 28, 2024

Viewfinder?

This idea comes from photography. Short Wikipedia definition:

... a viewfinder is a device on a camera that a photographer uses to determine exactly where the camera is pointed, and approximately how much of that view will be photographed

I think this kinda describes what this container does.

@YgorSouza
Copy link
Contributor

Viewbox is a term that is sometimes used for this kind of thing, although often it refers to the coordinates of the inner element that are in view, rather than the container widget itself.

@emilk emilk mentioned this pull request Jan 21, 2025
@grtlr grtlr force-pushed the grtlr/zoom-and-pan-area branch from 70f804b to d794d83 Compare January 27, 2025 09:26
@emilk emilk changed the title Implement new ZoomPanArea container Add egui::Scene for panning/zooming a Ui Jan 28, 2025
@emilk emilk force-pushed the grtlr/zoom-and-pan-area branch from 302ebaa to f101d39 Compare January 28, 2025 13:56
@emilk emilk added feature New feature or request egui labels Jan 28, 2025
@emilk emilk marked this pull request as ready for review January 28, 2025 15:37
Copy link
Collaborator Author

@grtlr grtlr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very nice—thank you @emilk for picking this up!

I can't approve my own PR, so here is a ✅.

@emilk emilk merged commit e8f351b into master Jan 28, 2025
46 checks passed
@emilk emilk deleted the grtlr/zoom-and-pan-area branch January 28, 2025 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
egui feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants