Mobile: address code-review findings
Fixes from a review of the mobile-UI branch. - Guard the inspector size clamps so min<=max (f32::clamp panics otherwise) and set a window min_inner_size; prevents a crash / degenerate layout at small sizes. Same small-size guards for the piano-roll landscape toggle bar and the intent grid. - Landscape 2->1 edge reveal: snap to fullscreen at frac>=0.5 (the preview's phase boundary) instead of COLLAPSE_HI, so releasing mid-drag no longer jumps backward. Both edges. - Gate the double-tap-drag marquee to mobile so it can't hijack a desktop Brush/Draw drag. - Timeline mobile long-press: request a repaint while counting down so it fires even when the finger is held perfectly still. - Landscape folded top bar: lay the filename+search+overflow cluster out within a reserved center span (gutters for the pane's own label/buttons) and elide the filename, so it can't overlap or overflow the header. - Node editor connect/disconnect: assert + document the top-level-graph assumption. - Palette search field focuses only when unfocused (no per-frame focus stomp); reset the inspector tap-anchor on orientation change; remove stale main.rs.backup. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
9646eef487
commit
bb6b6fa9e3
@@ -118,15 +118,31 @@ pub fn render_inline(
|
||||
.and_then(|p| p.file_name())
|
||||
.map(|s| s.to_string_lossy().to_string())
|
||||
.unwrap_or_else(|| "Lightningbeam".to_string());
|
||||
let galley = ui
|
||||
.painter()
|
||||
.layout_no_wrap(name, egui::FontId::proportional(14.0), pal.text);
|
||||
let name_w = galley.rect.width();
|
||||
let name_h = galley.rect.height();
|
||||
let btn = header.height().min(BTN);
|
||||
let gap = 6.0;
|
||||
// Reserve gutters so the cluster never overlaps the pane header's own grip/label (left) or its
|
||||
// fullscreen / node-toggle buttons (right).
|
||||
let left_gutter = 150.0;
|
||||
let right_gutter = 2.0 * BTN + 16.0;
|
||||
let span_left = header.left() + left_gutter;
|
||||
let span_right = (header.right() - right_gutter).max(span_left);
|
||||
let span_w = span_right - span_left;
|
||||
|
||||
// Filename elided to fit whatever's left after the two buttons.
|
||||
let max_name_w = (span_w - gap - 2.0 * btn).max(0.0);
|
||||
let galley = {
|
||||
let mut job =
|
||||
egui::text::LayoutJob::simple_singleline(name, egui::FontId::proportional(14.0), pal.text);
|
||||
job.wrap.max_width = max_name_w;
|
||||
job.wrap.max_rows = 1;
|
||||
job.wrap.break_anywhere = true;
|
||||
ui.painter().layout_job(job)
|
||||
};
|
||||
let name_w = galley.rect.width();
|
||||
let name_h = galley.rect.height();
|
||||
let cluster_w = name_w + gap + 2.0 * btn;
|
||||
let x0 = (header.center().x - cluster_w / 2.0).max(header.left() + 8.0);
|
||||
// Center within the reserved span, then clamp so the right edge stays inside it.
|
||||
let x0 = (span_left + (span_w - cluster_w) / 2.0).clamp(span_left, (span_right - cluster_w).max(span_left));
|
||||
let cy = header.center().y;
|
||||
let bt = header.top() + (header.height() - btn) / 2.0;
|
||||
|
||||
@@ -223,7 +239,11 @@ fn render_palette(ui: &mut egui::Ui, full: egui::Rect, rc: &mut RenderContext, s
|
||||
.hint_text("Search commands…")
|
||||
.desired_width(inner.width()),
|
||||
);
|
||||
te.request_focus();
|
||||
// Focus the field only when it isn't already focused — re-requesting every frame would stomp
|
||||
// focus and prevent anything else in the panel from taking it.
|
||||
if !te.has_focus() {
|
||||
te.request_focus();
|
||||
}
|
||||
|
||||
// Filtered list.
|
||||
let q = state.palette_query.to_lowercase();
|
||||
|
||||
Reference in New Issue
Block a user