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
@@ -607,6 +607,9 @@ impl NodeGraphPane {
|
||||
|
||||
/// Cable an output port → input port: update the frontend graph + dispatch `Connect`.
|
||||
fn mobile_connect(&mut self, out_node: NodeId, out_port: usize, in_node: NodeId, in_port: usize) {
|
||||
// Mobile has no subgraph navigation yet, so cables always target the track-level graph. If
|
||||
// subgraph nav is added, route through `va_context()` / `graph_connect_in_template` like desktop.
|
||||
debug_assert!(self.subgraph_stack.is_empty(), "mobile node connect assumes the top-level graph");
|
||||
let Some(track_id) = self.track_id else { return };
|
||||
let output_id = self.state.graph.nodes.get(out_node).and_then(|n| n.outputs.get(out_port)).map(|(_, id)| *id);
|
||||
let input_id = self.state.graph.nodes.get(in_node).and_then(|n| n.inputs.get(in_port)).map(|(_, id)| *id);
|
||||
@@ -625,8 +628,10 @@ impl NodeGraphPane {
|
||||
}
|
||||
}
|
||||
|
||||
/// Remove a cable: update the frontend graph + dispatch `Disconnect`.
|
||||
/// Remove a cable: update the frontend graph + dispatch `Disconnect`. Like `mobile_connect`, this
|
||||
/// assumes the track-level graph (mobile has no subgraph navigation).
|
||||
fn mobile_disconnect(&mut self, out_node: NodeId, out_port: usize, in_node: NodeId, in_port: usize) {
|
||||
debug_assert!(self.subgraph_stack.is_empty(), "mobile node disconnect assumes the top-level graph");
|
||||
let Some(track_id) = self.track_id else { return };
|
||||
let output_id = self.state.graph.nodes.get(out_node).and_then(|n| n.outputs.get(out_port)).map(|(_, id)| *id);
|
||||
let input_id = self.state.graph.nodes.get(in_node).and_then(|n| n.inputs.get(in_port)).map(|(_, id)| *id);
|
||||
|
||||
@@ -392,7 +392,9 @@ impl PianoRollPane {
|
||||
// the conventional piano roll. (Portrait uses the keyboard-primary "Synthesia" view below.)
|
||||
let mut rect = rect;
|
||||
if shared.is_mobile && !shared.is_portrait {
|
||||
let bar = Rect::from_min_max(rect.min, pos2(rect.right(), rect.min.y + 30.0));
|
||||
// Clamp the bar height so a very short pane can't invert the remaining content rect.
|
||||
let bar_h = 30.0_f32.min(rect.height());
|
||||
let bar = Rect::from_min_max(rect.min, pos2(rect.right(), rect.min.y + bar_h));
|
||||
rect = Rect::from_min_max(pos2(rect.left(), bar.bottom()), rect.max);
|
||||
self.render_keys_notes_toggle(ui, bar, shared);
|
||||
if self.landscape_keys {
|
||||
|
||||
@@ -11407,12 +11407,12 @@ impl StagePane {
|
||||
}
|
||||
}
|
||||
|
||||
// P5 gesture: double-tap-drag on empty space → transient marquee, regardless of the active
|
||||
// tool. The second tap arms it; a drag then drives ToolState::MarqueeSelecting (resolved by
|
||||
// the release handler above). While armed we suppress the normal tool dispatch so a
|
||||
// P5 gesture (mobile): double-tap-drag on empty space → transient marquee, regardless of the
|
||||
// active tool. The second tap arms it; a drag then drives ToolState::MarqueeSelecting (resolved
|
||||
// by the release handler above). While armed we suppress the normal tool dispatch so a
|
||||
// brush/etc. doesn't paint during the gesture. A double-tap without a drag falls through
|
||||
// (Select tool handles zoom-to-fit).
|
||||
if !is_replaying && !alt_held {
|
||||
// (Select tool handles zoom-to-fit). Mobile-only so it can't hijack a desktop Brush/Draw drag.
|
||||
if shared.is_mobile && !is_replaying && !alt_held {
|
||||
use vello::kurbo::Point;
|
||||
let point = Point::new(world_pos.x as f64, world_pos.y as f64);
|
||||
let press_pos = mouse_canvas_pos.to_pos2();
|
||||
|
||||
@@ -5891,6 +5891,11 @@ impl PaneRenderer for TimelinePane {
|
||||
} else if now - t0 >= 0.4 {
|
||||
self.lp_time = None;
|
||||
long_press = Some(self.lp_pos);
|
||||
} else {
|
||||
// Still counting down — request a repaint so the threshold is re-evaluated even if
|
||||
// the finger is perfectly still and egui would otherwise go idle (no input events).
|
||||
let remaining = (0.4 - (now - t0)).max(0.0);
|
||||
ui.ctx().request_repaint_after(std::time::Duration::from_secs_f64(remaining));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user