From 4b13e4e3cf694937aaaeda82687471779587801c Mon Sep 17 00:00:00 2001 From: Skyfuller1303 Date: Wed, 28 Oct 2026 10:00:02 +0100 Subject: [PATCH] M7: line the Home tab's divider up with the icon rail The Home tab started at x=8 and was 44 wide, so its divider sat at x=52 while the icon rail below is 56 wide. Without inset window buttons the Home tab now ends at the rail's width (shared RAIL_WIDTH constant), so the divider continues the rail's edge. The inset (macOS) title bar keeps its 44-wide Home tab. --- crates/ui-egui/src/app.rs | 2 +- crates/ui-egui/src/panels/layers.rs | 2 ++ crates/ui-egui/src/tabs.rs | 7 ++++--- crates/ui-egui/src/titlebar_tests.rs | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index c10b402c1..d2f574a08 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -264,7 +264,7 @@ impl FigApp { let right_open = (self.right_panel_shown(hidden) && !narrow) || mobile == Some(MobilePanel::Right); if !hidden && (!narrow || mobile == Some(MobilePanel::Left)) { egui::Panel::left("left_rail") - .exact_size(56.0) + .exact_size(layers::RAIL_WIDTH) .resizable(false) .frame(egui::Frame::NONE.fill(t.panel).stroke(egui::Stroke::new(1.0, t.border))) .show(ui, |ui| { diff --git a/crates/ui-egui/src/panels/layers.rs b/crates/ui-egui/src/panels/layers.rs index b52176788..8480e1ba6 100644 --- a/crates/ui-egui/src/panels/layers.rs +++ b/crates/ui-egui/src/panels/layers.rs @@ -14,6 +14,8 @@ use crate::theme::{ACCENT, COMPONENT, Tokens, regular, semibold}; use crate::{FigApp, LeftTab}; pub const ROW: f32 = 32.0; +/// Width of the icon rail left of the side panel; the Home tab above it is as wide. +pub const RAIL_WIDTH: f32 = 56.0; /// A boolean operation's icon. pub fn op_icon(op: figcraft_doc::BoolOp) -> Icon { diff --git a/crates/ui-egui/src/tabs.rs b/crates/ui-egui/src/tabs.rs index 6f17910a6..b29638d2c 100644 --- a/crates/ui-egui/src/tabs.rs +++ b/crates/ui-egui/src/tabs.rs @@ -105,8 +105,9 @@ pub fn tab_bar(app: &mut FigApp, ui: &mut Ui) { let rect = ui.max_rect(); let buttons_w = if app.ui.title_bar == TitleBar::Custom { window_buttons(app, ui, rect) } else { 0.0 }; let mut x = rect.min.x + if app.ui.title_bar == TitleBar::Inset { 76.0 } else { 8.0 }; - // Home. - let hr = Rect::from_min_size(pos2(x, rect.min.y), vec2(44.0, HEIGHT)); + // Home. Without inset window buttons its divider continues the icon rail's edge below. + let home_w = if app.ui.title_bar == TitleBar::Inset { 44.0 } else { rect.min.x + crate::layers::RAIL_WIDTH - x }; + let hr = Rect::from_min_size(pos2(x, rect.min.y), vec2(home_w, HEIGHT)); let hresp = ui.interact(hr, ui.scope_id().with("home"), Sense::click()).tip(tr("Home")); let home_active = (app.ui.home || !app.has_files()) && app.ui.present.is_none(); crate::a11y::tab(&hresp, tr("Home"), home_active); @@ -120,7 +121,7 @@ pub fn tab_bar(app: &mut FigApp, ui: &mut Ui) { pause_present(app); app.ui.home = true; } - x += 44.0; + x += home_w; ui.painter().line_segment([pos2(x, rect.min.y), pos2(x, rect.max.y)], Stroke::new(1.0, t.border)); let document_tabs: Vec = app.session.docs.iter().enumerate().filter_map(|(i, d)| app.shows(d.uid).then_some(i)).collect(); let now = ui.input(|input| input.time); diff --git a/crates/ui-egui/src/titlebar_tests.rs b/crates/ui-egui/src/titlebar_tests.rs index fff303efb..e329c7417 100644 --- a/crates/ui-egui/src/titlebar_tests.rs +++ b/crates/ui-egui/src/titlebar_tests.rs @@ -149,7 +149,7 @@ fn tabs_and_new_tab_keep_their_clicks() { assert!(!u.app.ui.home); // The `+` right of it opens a new file (found by clicking along the bar past the tab). let mut opened = false; - for x in (176..320).step_by(4) { + for x in (180..320).step_by(4) { u.time += 1.0; assert!(u.click(pos2(x as f32, 20.0)).is_empty(), "{x}"); if u.app.session.docs.len() > 1 {