* claim: #7371 * Browser with History under it: drag the split between the two cards (#7371) Under the browser, History took exactly half the column. The seam between the two expanded cards is now a grip with the vertical resize cursor; dragging it moves the split, as the column's right edge moves its width. The split is kept as the browser's share of the column in a new preference, browser_share, whose default is the equal split, so nothing changes until someone drags. Either card keeps at least its header and two rows. Folding either card works as before and gives the other the rest; while one is folded or folding there is no grip. A non-finite share falls back to one half. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FN5eEMrqWWXqi65FcK8GXq * Prefs: keep the browser share with the History-under-browser settings Moves the entry so it no longer sits next to the render and dialog preferences that main added after browser_width. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: sascha2101 <221609842+sascha2101@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
4 files changed
+110
-5
No files matched your search
@@ -445,6 +445,10 @@ impl SpaceMouseDriver {
|
||||
/// itself clamps what the user drags to its own range.
|
||||
pub const DEFAULT_BROWSER_WIDTH: f32 = 250.0;
|
||||
|
||||
/// The browser's first share of the column it shares with History under it (#7371): the equal
|
||||
/// split; the column clamps what the user drags so both cards keep their header and two rows.
|
||||
pub const DEFAULT_BROWSER_SHARE: f32 = 0.5;
|
||||
|
||||
// The stored fields, their defaults, page resets and simple form controls share this table.
|
||||
// Omitted pages keep fields such as grid_follows_view and added agents when restoring defaults.
|
||||
// Accepted control-channel ranges may differ from slider ranges (look_at_speed).
|
||||
@@ -656,6 +660,9 @@ preference_settings! {
|
||||
timeline_under_browser: bool = false, PAGE_INTERFACE;
|
||||
/// Fold the shared-column history to its header.
|
||||
timeline_collapsed: bool = false, PAGE_INTERFACE;
|
||||
/// The browser's share of the column's height when History sits under it, which the user
|
||||
/// drags at the seam between the two cards (#7371).
|
||||
browser_share: f32 = DEFAULT_BROWSER_SHARE, PAGE_INTERFACE;
|
||||
/// Whether the browser beside the vertical history is collapsed to its rail.
|
||||
timeline_left_browser_collapsed: bool = false, PAGE_INTERFACE;
|
||||
/// Whether the History at the left lists a sketch under the feature built from it.
|
||||
|
||||
@@ -121,9 +121,9 @@ pub(crate) fn animate_folds(app: &mut SolveApp, ctx: &egui::Context) {
|
||||
}
|
||||
}
|
||||
|
||||
/// Shared bounds keep browser and history at exactly the same width. Their split is half
|
||||
/// the available height. One folded header gives the other the remainder; two folded
|
||||
/// headers sit together at the top.
|
||||
/// Shared bounds keep browser and history at exactly the same width. Their split is the
|
||||
/// remembered share of the available height (half until the seam is dragged, #7371). One folded
|
||||
/// header gives the other the remainder; two folded headers sit together at the top.
|
||||
pub(crate) fn stacked_rects(app: &SolveApp, available: Rect) -> (Rect, Rect) {
|
||||
let progress = app
|
||||
.shell
|
||||
@@ -148,7 +148,7 @@ fn column_rects_at(app: &SolveApp, available: Rect, browser_fold: f32, history_f
|
||||
}
|
||||
let budget = (column.height() - gap).max(0.0);
|
||||
let header = header_outer_height().min(budget / 2.0);
|
||||
let expanded_browser = egui::lerp(budget / 2.0..=(budget - header).max(0.0), history_fold);
|
||||
let expanded_browser = egui::lerp(browser_split(app.preferences.browser_share, budget, header)..=(budget - header).max(0.0), history_fold);
|
||||
let browser_height = egui::lerp(expanded_browser..=header, browser_fold);
|
||||
let browser = Rect::from_min_size(column.min, vec2(column.width(), browser_height));
|
||||
let history_top = (browser.bottom() + gap).min(column.bottom());
|
||||
@@ -157,6 +157,50 @@ fn column_rects_at(app: &SolveApp, available: Rect, browser_fold: f32, history_f
|
||||
(browser, history)
|
||||
}
|
||||
|
||||
/// The expanded browser's height in a column of `budget` (both cards, without the gap): the
|
||||
/// remembered share, kept to at least a header and two rows for either card.
|
||||
pub(crate) fn browser_split(share: f32, budget: f32, header: f32) -> f32 {
|
||||
let share = if share.is_finite() { share } else { crate::prefs::DEFAULT_BROWSER_SHARE };
|
||||
let least = (header + 2.0 * crate::ui_kit::TREE_ROW_HEIGHT).min(budget / 2.0).max(0.0);
|
||||
(budget * share).clamp(least, (budget - least).max(least))
|
||||
}
|
||||
|
||||
/// How tall a grip the seam between the stacked browser and History offers, around the gap.
|
||||
const SPLIT_RAIL: f32 = 6.0;
|
||||
|
||||
/// Dragging the seam between the expanded browser and History moves their split (#7371), as the
|
||||
/// column's right edge moves its width.
|
||||
fn split_handle(app: &mut SolveApp, ui: &egui::Ui, available: Rect) {
|
||||
if !app.ui.show_browser
|
||||
|| app.preferences.timeline_left_browser_collapsed
|
||||
|| app.preferences.timeline_collapsed
|
||||
|| app.shell.history_folding.is_some_and(|p| p != [0.0, 0.0])
|
||||
{
|
||||
return;
|
||||
}
|
||||
let (browser, history) = stacked_rects(app, available);
|
||||
let budget = history.bottom() - browser.top() - (history.top() - browser.bottom());
|
||||
if !browser.is_positive() || !history.is_positive() || budget <= 0.0 {
|
||||
return;
|
||||
}
|
||||
let rail = Rect::from_x_y_ranges(browser.x_range(), browser.bottom() - SPLIT_RAIL / 2.0..=history.top() + SPLIT_RAIL / 2.0);
|
||||
Container::new(ui.ctx(), Surface::Canvas).area(egui::Id::new("sc_column_split")).order(egui::Order::Foreground).fixed_pos(rail.min).show(
|
||||
ui.ctx(),
|
||||
|ui| {
|
||||
ui.set_min_size(rail.size());
|
||||
let response = ui.interact(rail, egui::Id::new("sc_column_split_rail"), Sense::drag()).on_hover_cursor(egui::CursorIcon::ResizeVertical);
|
||||
if response.dragged() {
|
||||
let delta = ui.input(|input| input.pointer.delta().y);
|
||||
if delta.is_finite() {
|
||||
let header = header_outer_height().min(budget / 2.0);
|
||||
app.preferences.browser_share = browser_split((browser.height() + delta) / budget, budget, header) / budget;
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
crate::scenario::publish_handle("left-column-split", rail.center());
|
||||
}
|
||||
|
||||
pub(crate) fn floating_rect(app: &SolveApp, available: Rect) -> Rect {
|
||||
if stacked(app) {
|
||||
return stacked_rects(app, available).1;
|
||||
@@ -211,6 +255,7 @@ pub fn left_panel(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
if stacked(app) {
|
||||
let width = crate::browser::browser_width(app.preferences.browser_width);
|
||||
crate::browser::resize_column(app, ui, response.response.rect, width, "left-history-rail");
|
||||
split_handle(app, ui, available);
|
||||
}
|
||||
});
|
||||
app.shell.history = Some(card.response.rect);
|
||||
@@ -1882,6 +1927,57 @@ mod tests {
|
||||
assert!(narrower < wider - 20.0, "dragging it left should narrow it again: {wider} -> {narrower}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_seam_between_browser_and_history_drags_their_split_and_is_remembered() {
|
||||
// #7371: under the browser, History took exactly half the column; the seam now moves it.
|
||||
for mode in [crate::shell::LayoutMode::Floating, crate::shell::LayoutMode::Docked] {
|
||||
let mut h = Harness::new();
|
||||
h.app.home.open = false;
|
||||
h.app.ui.layout = mode;
|
||||
h.call("ui.resize", json!({"width":1400,"height":900}));
|
||||
h.app.run("view.history_layout", json!({"dock":"under_browser"})).unwrap();
|
||||
h.app.run("solid.box", json!({"length":10,"width":10,"height":10})).unwrap();
|
||||
h.settle();
|
||||
let (browser, history) = (h.app.shell.browser.unwrap(), h.app.shell.history.unwrap());
|
||||
assert!((browser.height() - history.height()).abs() < 1.0, "{mode:?}: an equal split by default: {browser:?} {history:?}");
|
||||
let seam = handle_at("left-column-split").expect("the seam between the cards is a grip");
|
||||
h.step(&json!({"drag": [[seam.x, seam.y], [seam.x, seam.y + 120.0]]})).unwrap();
|
||||
h.settle();
|
||||
let (taller, shorter) = (h.app.shell.browser.unwrap(), h.app.shell.history.unwrap());
|
||||
assert!((taller.height() - browser.height() - 120.0).abs() < 2.0, "{mode:?}: {browser:?} -> {taller:?}");
|
||||
assert!((history.height() - shorter.height() - 120.0).abs() < 2.0, "{mode:?}: {history:?} -> {shorter:?}");
|
||||
assert!((shorter.bottom() - history.bottom()).abs() < 1.0 && (taller.top() - browser.top()).abs() < 1.0);
|
||||
let share = h.app.preferences.browser_share;
|
||||
assert!(share > 0.6 && share < 0.7, "{mode:?}: {share}");
|
||||
let mut restored = SolveApp::new(Default::default(), Default::default());
|
||||
restored.load_prefs(&h.app.prefs());
|
||||
assert_eq!(restored.preferences.browser_share, share);
|
||||
// Either card keeps its header and two rows however far the seam goes.
|
||||
let least = header_outer_height() + 2.0 * crate::ui_kit::TREE_ROW_HEIGHT - 1.0;
|
||||
for dy in [2000.0, -2000.0] {
|
||||
let seam = handle_at("left-column-split").unwrap();
|
||||
h.step(&json!({"drag": [[seam.x, seam.y], [seam.x, seam.y + dy]]})).unwrap();
|
||||
h.settle();
|
||||
let (browser, history) = (h.app.shell.browser.unwrap(), h.app.shell.history.unwrap());
|
||||
assert!(browser.height() >= least && history.height() >= least, "{mode:?}, {dy}: {browser:?} {history:?}");
|
||||
}
|
||||
// Folding History still gives the browser the rest, and unfolding brings the split back.
|
||||
let split = h.app.shell.browser.unwrap().height();
|
||||
h.app.preferences.timeline_collapsed = true;
|
||||
h.frames(12);
|
||||
assert!(h.app.shell.history.unwrap().height() <= header_outer_height() + 1.0);
|
||||
assert!(handle_at("left-column-split").is_none(), "no grip while a card is folded");
|
||||
h.app.preferences.timeline_collapsed = false;
|
||||
h.frames(12);
|
||||
assert!((h.app.shell.browser.unwrap().height() - split).abs() < 1.0);
|
||||
}
|
||||
// A hostile preference falls back to the equal split; a tiny column still fits both headers.
|
||||
assert_eq!(browser_split(f32::NAN, 600.0, 40.0), 300.0);
|
||||
assert_eq!(browser_split(f32::INFINITY, 600.0, 40.0), 300.0);
|
||||
assert_eq!(browser_split(-3.0, 600.0, 40.0), 40.0 + 2.0 * crate::ui_kit::TREE_ROW_HEIGHT);
|
||||
assert_eq!(browser_split(0.9, 60.0, 30.0), 30.0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn history_follows_the_browsers_translucency_only_under_the_browser() {
|
||||
let opaque = Tokens::get().panel;
|
||||
|
||||
@@ -94,6 +94,8 @@
|
||||
back, and drag features to reorder them. Preferences can put the timeline vertically at the
|
||||
far left of the viewport, beside the browser. Its seam handle switches between icon
|
||||
chips and compact feature names; the browser can collapse to a rail beside either width.
|
||||
Docked under the browser, the two share the column: drag the seam between them to give either
|
||||
more height, and the split is remembered.
|
||||
Previous, Play and Next sit at the top. Double-click Previous to roll to the start.
|
||||
Interface › **Sketches** › **Under their feature** lists a sketch in the vertical timeline one
|
||||
level in, under the first feature built from it, behind that feature's fold arrow. Dragging the
|
||||
|
||||
@@ -310,7 +310,7 @@ labels; `prefs:measure_axis_distances` identifies the checkbox.
|
||||
| `engine.execute` → `view.layout` | `mode`: `floating` or `compact` | Apply and save the workspace layout without opening a dialog, changing the design, resetting the camera or cancelling its active tool. General preferences expose the same choice; `ui.prefs {"layout":"compact"}` also saves it. |
|
||||
| `engine.execute` → `browser.expand_all` | `path?`: occurrence ids; `component?`: id; omit both for the whole tree | Open every Browser row under that scope, including folders that start closed (Origin, Named Views, Features). Display only: not saved in the design, not an undo step. |
|
||||
| `engine.execute` → `browser.collapse_all` | same | Close those rows. The design row stays open when the whole tree is collapsed. |
|
||||
| `engine.execute` → `view.history_layout` | `width?`, `dock?`: `bottom`, `left`, `under_browser`, `collapsed?` | Resize/dock the history without opening a dialog or changing the design. Contents respond to measured width; browser-stacked history shares its width and splits height equally. One folded header gives the expanded card the rest; two folded headers stay at the top. |
|
||||
| `engine.execute` → `view.history_layout` | `width?`, `dock?`: `bottom`, `left`, `under_browser`, `collapsed?` | Resize/dock the history without opening a dialog or changing the design. Contents respond to measured width; browser-stacked history shares its width and splits the height at the remembered share (`browser_share`, half until the seam between the two cards is dragged). One folded header gives the expanded card the rest; two folded headers stay at the top. |
|
||||
| `ui.agent_chat` | `features?`, `toolbar_button?`, `connect_at_start?` and `open_at_start?` (connect the agent started last, and open the panel, when SolidCraft starts; both off by default, never with `--control`), `permissions?` (`ask`, `edits`, `all`), `add_agent?` ({`name`, `kind`: `acp`, `api` or `anthropic` (`api` is OpenAI-compatible, `anthropic` Anthropic-compatible), `command` or `base_url` + `model` + `request_timeout_s?` (seconds one model request may take, 300 by default, rounded and clamped to 30 to 3600)}; no keys), `add_dialog?` (`installed`, `custom`, `api`, `anthropic`, or `false` to close), `default_agent?`, `agent?` (the conversation's agent, by id), `mode?` (the agent's own mode), `provider?` (which provider's models the model picker lists, when they come from several), `model?` (one of its models), `open?`, `side?` (`left`, `right`), `minimized?`, `popped?` (in its own window), `width?`, `picker?`, `refresh?`, `connect?`, `stop?`, `attach?`: a file's path (a picture, a text file or a CAD file, for the next message; CAD files are imported at once), `remove_file?` (index of a file on the next message), `send?`: text (files alone make a message too), `attach_view?`, `attach_selection?`, `pick?` (true: open the context picker), `permission?`: an option id or `"cancel"` (the newest question of the agent's own), `approve?`: true, false or `"always"` (the oldest request held for Allow/Deny), `cancel?` (Stop: the queue stays), `send_now?` (stop the running step, then send the queued messages), `remove_pending?` (index), `new_chat?` (clear the chat, new session), `undo?` (the last message's changes) | the chat's state: `features`, `agents` (found and added), `currentAgent`, `state` (off, starting, ready, busy, auth, exited, failed: the agent never got ready, and Connect reads Retry), `connectAtStart`, `openAtStart`, `lastAgent` (the agent started last), `popped`, `window` (its place and size), `agent`, `modes`, `mode`, `models`, `model`, `modelWarning` (the model capability warning text, or `null` when unknown or tool support is reported; checked asynchronously and never blocks sending), `turnWarning` (the latest completed turn's no-tool notice, otherwise `null`; cleared on the next turn or new chat), `providers` (`name` and `count` of each, empty with one provider), `provider` (the one listed), `authMethods`, `toolsPort`, `pid`, `waiting`, `turn`, `pending` (queued messages, with their `files`), `attachments` (the files on the next message, by name), `loading` (pictures still being read for it, by name), `stopped`, `detection` and the conversation (`items`). With `features` off only the settings apply. Desktop only; see [Agent chat](agent-chat.md) |
|
||||
| `ui.resize` | `width`, `height` | |
|
||||
| `app.quit` | `force?` (quit without asking about unsaved designs) | `quitting` (the window closes), `asking` (a "save changes?" prompt is open) |
|
||||
|
||||
Reference in new issue
Block a user