emilk / emilk/egui

Scene doesn't nest

Open
#5,682 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
30.6k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
72

Description

**Describe the bug**
I'm very aware that this is a niche use-case, and must admit that I don't have an immediate application for it, but: nesting `Scene` doesn't provide the desired effect.

**To Reproduce**
Steps to reproduce the behavior (tested on master [0db56dc](https://github.com/emilk/egui/commit/0db56dc9f1a8459b5b9376159fab7d7048b19b65)):
```rust
use eframe::egui::{self, Rect};

fn main() -> eframe::Result {
let mut scene_rect = Rect::ZERO;
let mut inner_rect = Rect::ZERO;

eframe::run_simple_native("My egui App", Default::default(), move |ctx, _frame| {

egui::CentralPanel::default().show(ctx, |ui| {
ui.label("Outside the scenes");

egui::Scene::new().show(ui, &mut scene_rect, |ui| {
ui.label("Inside first scene");

egui::Frame::canvas(ui.style()).show(ui, |ui| {
egui::Scene::new().show(ui, &mut inner_rect, |ui| {
ui.label("I'm in a nested scene!");
});
});

});
});
})
}
```

**Expected behavior**
Ideally, the contents of the sub-scene should be be scaled, transformed, and clipped appropriately.

**Screenshots**
![Image](https://github.com/user-attachments/assets/e1a05e30-52a1-46b3-a115-413c7c124570)

**Additional context**
Again, I don't have an immediate use-case for this so it probably shouldn't be a priority.

Contributor guide

Open the contributing guide

Research direction

Start with the nested egui::Scene::new calls in the provided eframe::run_simple_native reproduction and compare the outer and inner scene behavior. Run the example to observe the clipping and transformation issue. Done means the sub-scene is scaled, transformed, and clipped appropriately when nested.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.