| ... | ... | @@ -196,10 +196,17 @@ fn sidebar( |
| 196 | 196 | ..Spec::default() |
| 197 | 197 | }, |
| 198 | 198 | ); |
| 199 | // Room for what floats over the header's start: the notebook button's icon, and on the |
| 200 | // left Back and Forward after it. |
| 201 | let start = if right { |
| 202 | ICON |
| 203 | } else { |
| 204 | (ICON + RAIL) / 2.0 + NAV - ROW_PAD |
| 205 | }; |
| 199 | 206 | ui.leaf( |
| 200 | 207 | "icon", |
| 201 | 208 | Spec { |
| 202 | | size: [px(ICON), px(ui::shell::TOOL)], |
| 209 | size: [px(start), px(ui::shell::TOOL)], |
| 203 | 210 | ..Spec::default() |
| 204 | 211 | }, |
| 205 | 212 | ); |
| ... | ... | @@ -212,15 +219,16 @@ fn sidebar( |
| 212 | 219 | ..Spec::default() |
| 213 | 220 | }, |
| 214 | 221 | ); |
| 215 | | // Room for what floats over the header's end. |
| 216 | | let end = if right { RAIL } else { NAV + MARGIN }; |
| 217 | | ui.leaf( |
| 218 | | "end", |
| 219 | | Spec { |
| 220 | | size: [px(end - MARGIN - 2.0 * ROW_PAD), px(1.0)], |
| 221 | | ..Spec::default() |
| 222 | | }, |
| 223 | | ); |
| 222 | // Room for the notebook button floating over the header's end. |
| 223 | if right { |
| 224 | ui.leaf( |
| 225 | "end", |
| 226 | Spec { |
| 227 | size: [px(RAIL - MARGIN - 2.0 * ROW_PAD), px(1.0)], |
| 228 | ..Spec::default() |
| 229 | }, |
| 230 | ); |
| 231 | } |
| 224 | 232 | ui.close(); |
| 225 | 233 | if !rows { |
| 226 | 234 | return; |
| ... | ... | @@ -970,10 +978,10 @@ impl crate::State { |
| 970 | 978 | } |
| 971 | 979 | } |
| 972 | 980 | |
| 973 | | /// Back, Forward and the notebook button, floating at the body's corner over the section |
| 974 | | /// tabs' row, `height` tall as it eases. While the sidebar, `width` wide as it eases, is |
| 975 | | /// open on the left, the notebook button closes it from its header's icon, and Back and |
| 976 | | /// Forward ride its end. |
| 981 | /// The notebook button, then Back and Forward, floating at the body's corner over the |
| 982 | /// section tabs' row, `height` tall as it eases. While the sidebar, `width` wide as it |
| 983 | /// eases, is open on the left, the notebook button closes it from its header's icon, Back |
| 984 | /// and Forward after it. |
| 977 | 985 | pub(crate) fn sidebar_button(&mut self, height: f32, width: f32) { |
| 978 | 986 | use crate::commands::{Choice, Id as Cmd}; |
| 979 | 987 | if self.temporary { |
| ... | ... | @@ -987,9 +995,8 @@ impl crate::State { |
| 987 | 995 | .map_or(0.0, |[left, _, right, _]| right - left - RAIL); |
| 988 | 996 | (0.0, edge) |
| 989 | 997 | } else { |
| 990 | | let open = MARGIN + ROW_PAD - (RAIL - ICON) / 2.0; |
| 991 | | let toggle = NAV + (open - NAV) * width / WIDTH; |
| 992 | | ((width - NAV - MARGIN).max(0.0), toggle) |
| 998 | let toggle = (MARGIN + ROW_PAD - (RAIL - ICON) / 2.0) * width / WIDTH; |
| 999 | (toggle + RAIL, toggle) |
| 993 | 1000 | }; |
| 994 | 1001 | let pad = [ |
| 995 | 1002 | (RAIL - ui::shell::TOOL) / 2.0, |