From 6134cc90ff77ee7554c02f5daecda9a1fc964770 Mon Sep 17 00:00:00 2001 From: landon Date: Wed, 30 Sep 2026 17:21:51 -0500 Subject: [PATCH] story bible resize --- src/app/story_bible_editor.rs | 70 ++++++++++++++++++++++++++--------- 1 file changed, 52 insertions(+), 18 deletions(-) diff --git a/src/app/story_bible_editor.rs b/src/app/story_bible_editor.rs index 862f70a..fd6a5e2 100644 --- a/src/app/story_bible_editor.rs +++ b/src/app/story_bible_editor.rs @@ -211,6 +211,19 @@ impl App { .collapsible(false) .default_width(1000.0) .default_height(700.0) + // A window only paints as large as its content actually + // measures (`default_width`/`default_height` are no more than + // hints, silently ignored the moment content isn't a single + // top-level ScrollArea), so what actually renders is whatever + // size the tree/editor panes below claim for themselves — + // that's why they're given explicit heights rather than left to + // `auto_shrink(false)` alone, which only stops a pane from + // shrinking *below* whatever height it's handed, and doesn't + // make it claim more. This is also why the resize corner used + // to appear to do nothing: every frame's content re-measure + // snapped the drag straight back to that same small size. + .min_width(1000.0) + .min_height(700.0) .show(ctx, |ui| { self.story_bible_editor_contents(ui, &tree); }); @@ -244,10 +257,19 @@ impl App { ui.heading("Story Bible"); ui.separator(); - // Scroll area for tree + // Scroll area for tree. `auto_shrink(false)` only stops + // this from shrinking *below* whatever height the + // surrounding layout hands it — it doesn't claim more on + // its own, and `max_height` is a ceiling, not a floor (it + // can only shrink, never grow, what the ambient layout + // already offered). `min_scrolled_height` is the one + // that's actually enforced unconditionally, which is what + // establishes — and drives the window's own measured size + // up to — a real, spacious height. egui::ScrollArea::vertical() .id_salt("story_bible_editor_tree") .auto_shrink(false) + .min_scrolled_height(600.0) .show(ui, |ui| { if tree.is_empty() { ui.label("No Story Bible items found"); @@ -274,18 +296,44 @@ impl App { ui.heading("Select an item to edit"); } ui.separator(); - - // Editor area + + // The Save/Close row lives in its own panel, claimed *before* + // the editor's scroll area: a resizable window fights the + // user's own resize drag when a ScrollArea isn't the last + // thing measured in its content (the cursor shows the resize + // affordance but dragging does nothing) — reserving this + // panel's height up front, the same way file_list.rs's + // `left_pane` does for its own action row, avoids that. + egui::TopBottomPanel::bottom("story_bible_editor_actions") + .frame(egui::Frame::none().inner_margin(egui::Margin::symmetric(0.0, 4.0))) + .show_inside(ui, |ui| { + ui.separator(); + ui.horizontal(|ui| { + if ui.button("Save (Ctrl+S)").clicked() { + if let Some(ref path) = self.story_bible_editor_path { + self.save_story_bible_item(path.clone()); + } + } + + if ui.button("Close").clicked() { + self.show_story_bible_editor = false; + } + }); + }); + + // Editor area — see the tree pane's comment above on why + // `min_scrolled_height` (not `max_height`) is needed. egui::ScrollArea::vertical() .id_salt("story_bible_editor_content") .auto_shrink(false) + .min_scrolled_height(520.0) .show(ui, |ui| { let text_edit = egui::TextEdit::multiline(&mut self.story_bible_editor_content) .id_salt("story_bible_editor_textedit") .code_editor() .desired_width(f32::INFINITY) .desired_rows(20); - + let response = ui.add(text_edit); // Recorded rather than acted on: the save needs `&mut @@ -294,20 +342,6 @@ impl App { // routes Ctrl+S here instead of to the manuscript. focused = response.has_focus(); }); - - // Save button - ui.separator(); - ui.horizontal(|ui| { - if ui.button("Save (Ctrl+S)").clicked() { - if let Some(ref path) = self.story_bible_editor_path { - self.save_story_bible_item(path.clone()); - } - } - - if ui.button("Close").clicked() { - self.show_story_bible_editor = false; - } - }); }); }); self.story_bible_editor_focused = focused;