From d54186c9bf5779eed2795b54888f7efa47eb2993 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Mon, 26 Oct 2026 08:44:25 +0700 Subject: [PATCH] #1209: port the phone layout to egui 0.37 --- crates/ui-egui/src/lib.rs | 2 +- crates/ui-egui/src/toolbar.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 2882ebecc..a5340853e 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -1939,7 +1939,7 @@ impl FigApp { fn mobile_buttons(&mut self, ctx: &egui::Context, at: egui::Pos2) { use a11y::Tip as _; let t = theme::Tokens::get(ctx); - egui::Area::new(egui::Id::new("mobile_panel_buttons")).order(egui::Order::Foreground).fixed_pos(at).show(ctx, |ui| { + egui::Area::new(egui::Id::unique("mobile_panel_buttons")).order(egui::Order::Foreground).fixed_pos(at).show(ctx, |ui| { for (side, icon, name) in [(MobilePanel::Left, icons::Icon::Layers, i18n::tr("Layers")), (MobilePanel::Right, icons::Icon::Panels, i18n::tr("Design"))] { diff --git a/crates/ui-egui/src/toolbar.rs b/crates/ui-egui/src/toolbar.rs index 531c7fc1a..2c38be212 100644 --- a/crates/ui-egui/src/toolbar.rs +++ b/crates/ui-egui/src/toolbar.rs @@ -169,11 +169,11 @@ fn main_toolbar(app: &mut FigApp, ui: &mut Ui, canvas: Rect, t: &Tokens, board: /// How far the buttons of a pill `width` wide drawn at `rect` are scrolled: wider than the pill (a /// phone), they slide sideways under a drag or the wheel. fn pill_scroll(ui: &Ui, rect: Rect, width: f32) -> f32 { - let scroll_id = ui.id().with("tb_scroll"); + let scroll_id = ui.scope_id().with("tb_scroll"); let max_scroll = (width - rect.width()).max(0.0); let mut scroll = 0.0; if max_scroll > 0.0 { - let drag = ui.ctx().read_response(ui.id().with("pill")).map_or(0.0, |r| r.drag_delta().x); + let drag = ui.ctx().read_response(ui.scope_id().with("pill")).map_or(0.0, |r| r.drag_delta().x); let wheel = if ui.rect_contains_pointer(rect) { ui.input(|i| i.smooth_scroll_delta.x + i.smooth_scroll_delta.y) } else { 0.0 }; scroll = (ui.data(|d| d.get_temp::(scroll_id)).unwrap_or(0.0) - drag - wheel).clamp(0.0, max_scroll); }