mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-09 12:32:52 +00:00
Notice bar: stack the buttons only where the message still has room
Below about 100 pt of content width the stacked message wrapped to a column thousands of points tall and pushed the hotbar off screen, which broke the narrow-viewport hotbar picker test merged from main. That width is under the smallest supported window, so the single row stays there. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
abcfc1cade
commit
761fd4ff51
1 file changed
+5
-1
@@ -253,9 +253,13 @@ fn notice_bar(ui: &mut egui::Ui, t: &Tokens, icon: &str, icon_color: Color32, te
|
||||
const ICON: f32 = 16.0;
|
||||
/// Content width below which the buttons stack under the message.
|
||||
const STACK_BELOW: f32 = 200.0;
|
||||
/// Content width under which stacking is not tried: the message would wrap to a column of a
|
||||
/// few characters, thousands of points tall, and push the hotbar off the screen. Such a width
|
||||
/// is below the smallest supported window, so the single row stays as it was.
|
||||
const STACK_ABOVE: f32 = 100.0;
|
||||
egui::Frame::NONE.fill(t.accent_soft).inner_margin(egui::Margin::symmetric(14, 7)).show(ui, |ui| {
|
||||
let width = ui.available_width();
|
||||
if width < STACK_BELOW {
|
||||
if (STACK_ABOVE..STACK_BELOW).contains(&width) {
|
||||
// A narrow document area (a half-width window): the message takes the full width and
|
||||
// the buttons sit on a row of their own below it, rather than squeezing it to nothing.
|
||||
ui.with_layout(egui::Layout::left_to_right(egui::Align::Min), |ui| {
|
||||
|
||||
Reference in new issue
Block a user