diff --git a/crates/snowbound/src/main.rs b/crates/snowbound/src/main.rs index e99d7e7936ea953c58d4f922901d22ccd1d9fd13..d23ba0148df95a0c43d3e085b2d375d21ea4d553 100644 --- a/crates/snowbound/src/main.rs +++ b/crates/snowbound/src/main.rs @@ -1722,9 +1722,9 @@ impl State { ); if !self.temporary { // Past the row's padding, the frame's corner and the first tab's shadow, the tabs' - // outlines start where Back and Forward end, and on the left the notebook button's - // square after them; that room shrinks on the sidebar's easing, as they move into - // its header, so the tabs ease with it. + // outlines start where Back and Forward end, after the notebook button's square on + // the left; that room shrinks on the sidebar's easing, as they move into its + // header, so the tabs ease with it. let room = sidebar::NAV + TAB_ROW - FRAME - self.rounding() - ui::SHADOW[0]; let room = if self.navigation_bar_right { room - TAB_ROW diff --git a/crates/snowbound/src/sidebar.rs b/crates/snowbound/src/sidebar.rs index 43ecc29b3c0d091638772ea5e7329472b8e1684e..0a6cd81520af16766cf5eb5f22127f4cbc4b86ae 100644 --- a/crates/snowbound/src/sidebar.rs +++ b/crates/snowbound/src/sidebar.rs @@ -196,10 +196,17 @@ fn sidebar( ..Spec::default() }, ); + // Room for what floats over the header's start: the notebook button's icon, and on the + // left Back and Forward after it. + let start = if right { + ICON + } else { + (ICON + RAIL) / 2.0 + NAV - ROW_PAD + }; ui.leaf( "icon", Spec { - size: [px(ICON), px(ui::shell::TOOL)], + size: [px(start), px(ui::shell::TOOL)], ..Spec::default() }, ); @@ -212,15 +219,16 @@ fn sidebar( ..Spec::default() }, ); - // Room for what floats over the header's end. - let end = if right { RAIL } else { NAV + MARGIN }; - ui.leaf( - "end", - Spec { - size: [px(end - MARGIN - 2.0 * ROW_PAD), px(1.0)], - ..Spec::default() - }, - ); + // Room for the notebook button floating over the header's end. + if right { + ui.leaf( + "end", + Spec { + size: [px(RAIL - MARGIN - 2.0 * ROW_PAD), px(1.0)], + ..Spec::default() + }, + ); + } ui.close(); if !rows { return; @@ -970,10 +978,10 @@ impl crate::State { } } - /// Back, Forward and the notebook button, floating at the body's corner over the section - /// tabs' row, `height` tall as it eases. While the sidebar, `width` wide as it eases, is - /// open on the left, the notebook button closes it from its header's icon, and Back and - /// Forward ride its end. + /// The notebook button, then Back and Forward, floating at the body's corner over the + /// section tabs' row, `height` tall as it eases. While the sidebar, `width` wide as it + /// eases, is open on the left, the notebook button closes it from its header's icon, Back + /// and Forward after it. pub(crate) fn sidebar_button(&mut self, height: f32, width: f32) { use crate::commands::{Choice, Id as Cmd}; if self.temporary { @@ -987,9 +995,8 @@ impl crate::State { .map_or(0.0, |[left, _, right, _]| right - left - RAIL); (0.0, edge) } else { - let open = MARGIN + ROW_PAD - (RAIL - ICON) / 2.0; - let toggle = NAV + (open - NAV) * width / WIDTH; - ((width - NAV - MARGIN).max(0.0), toggle) + let toggle = (MARGIN + ROW_PAD - (RAIL - ICON) / 2.0) * width / WIDTH; + (toggle + RAIL, toggle) }; let pad = [ (RAIL - ui::shell::TOOL) / 2.0,