Skip to content

Commit

Permalink
refactor: migrate to ui builder
Browse files Browse the repository at this point in the history
  • Loading branch information
theoparis committed Sep 30, 2024
1 parent 9e6ba1c commit acf7bea
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
//! ```
use derivative::Derivative;
use egui::UiBuilder;
use std::collections::HashMap;

mod link;
Expand Down Expand Up @@ -160,10 +161,10 @@ impl Context {

{
ui.set_min_size(self.canvas_rect_screen_space.size());
let mut ui = ui.child_ui(
self.canvas_rect_screen_space,
egui::Layout::top_down(egui::Align::Center),
None,
let mut ui = ui.new_child(
UiBuilder::new()
.max_rect(self.canvas_rect_screen_space)
.layout(egui::Layout::top_down(egui::Align::Center)),
);
{
let ui = &mut ui;
Expand Down Expand Up @@ -508,8 +509,11 @@ impl Context {
let node_size = node.size;
let title_space = node.layout_style.padding.y;

let response = ui.allocate_ui_at_rect(
egui::Rect::from_min_size(self.grid_space_to_screen_space(node_origin), node_size),
let response = ui.allocate_new_ui(
UiBuilder::new().max_rect(egui::Rect::from_min_size(
self.grid_space_to_screen_space(node_origin),
node_size,
)),
|ui| {
let mut title_info = None;
if let Some(title) = title {
Expand Down

0 comments on commit acf7bea

Please sign in to comment.