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