Merge pull request #1462 from Skyfuller1303/fix/home-tab-sidebar-alignment

M7: line the Home tab's divider up with the icon rail
This commit is contained in:
BFlat authored and GitHub committed 2026-10-29 10:45:54 +07:00
commit fbc1cc63ba
4 files changed
+11 -7

No files matched your search

+1 -1
View File
@@ -269,7 +269,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| {
+2
View File
@@ -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 {
+7 -5
View File
@@ -105,8 +105,7 @@ 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_tab(app, ui, &t, x, rect);
x += 44.0;
x += home_tab(app, ui, &t, x, rect);
ui.painter().line_segment([pos2(x, rect.min.y), pos2(x, rect.max.y)], Stroke::new(1.0, t.border));
let document_tabs: Vec<usize> = app.session.docs.iter().enumerate().filter_map(|(i, d)| app.shows(d.uid).then_some(i)).collect();
let now = ui.input(|input| input.time);
@@ -318,9 +317,11 @@ fn close_tab(app: &mut FigApp, ui: &Ui, i: usize) {
}
}
/// The Home tab at `x`.
fn home_tab(app: &mut FigApp, ui: &mut Ui, t: &Tokens, x: f32, rect: Rect) {
let hr = Rect::from_min_size(pos2(x, rect.min.y), vec2(44.0, HEIGHT));
/// The Home tab at `x`; returns its width. Without inset window buttons its divider continues the
/// icon rail's edge below.
fn home_tab(app: &mut FigApp, ui: &mut Ui, t: &Tokens, x: f32, rect: Rect) -> f32 {
let 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(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);
@@ -334,6 +335,7 @@ fn home_tab(app: &mut FigApp, ui: &mut Ui, t: &Tokens, x: f32, rect: Rect) {
pause_present(app);
app.ui.home = true;
}
w
}
/// The theme toggle, left of the window buttons; returns its rect.
+1 -1
View File
@@ -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 {