1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 04:40:03 -04:00

Create a UiBuilder for building Uis (#4969)

* Part of https://github.com/emilk/egui/issues/4634

The goals is to create fewer, more powerful entry points.


### Added
* `egui::UiBuilder`
* `Ui::allocate_new_ui`
* `Ui::new_child`

### Breaking changes
* `Ui::new` now takes a `UiBuilder`
* Deprecated
	* `ui.add_visible_ui`
	* `ui.allocate_ui_at_rect`
	* `ui.child_ui`
	* `ui.child_ui_with_id_source`
	* `ui.push_stack_info`
This commit is contained in:
Emil Ernerfeldt
2024-08-26 08:51:18 +02:00
committed by GitHub
parent 06f88e12b0
commit 5a196f6604
14 changed files with 392 additions and 172 deletions

View File

@@ -4,7 +4,7 @@
use std::sync::Arc;
use eframe::egui;
use egui::{mutex::RwLock, Id, InnerResponse, ViewportBuilder, ViewportId};
use egui::{mutex::RwLock, Id, InnerResponse, UiBuilder, ViewportBuilder, ViewportId};
// Drag-and-drop between windows is not yet implemented, but if you wanna work on it, enable this:
pub const DRAG_AND_DROP_TEST: bool = false;
@@ -460,7 +460,7 @@ fn drop_target<R>(
let available_rect = ui.available_rect_before_wrap();
let inner_rect = available_rect.shrink2(margin);
let mut content_ui = ui.child_ui(inner_rect, *ui.layout(), None);
let mut content_ui = ui.new_child(UiBuilder::new().max_rect(inner_rect));
let ret = body(&mut content_ui);
let outer_rect =