P5 mobile gestures + long-press context menus
Gestures (Stage + Timeline): - Pinch-zoom via zoom_delta() (touch pinch + Ctrl+wheel), unified with the raw-wheel path so Ctrl+wheel zooms exactly once; plain wheel zoom + trackpad pan preserved. - Double-tap empty → zoom-to-fit (Stage: artboard via zoom_to_fit; Timeline: new fit_to_project over the full duration). - Double-tap-drag on empty → transient marquee regardless of the active tool. Long-press context menu: a shared SharedPaneState.mobile_context_menu that panes populate with (label, MenuAction) items on secondary_clicked(); the mobile shell renders one persistent popup (styled like the timeline menu) and dispatches via pending_menu_actions. Stage offers Cut/Copy/Duplicate/Delete for clip instances and Cut/Copy/Convert-to-movie-clip/Delete for geometry. Fixes surfaced along the way: - Geometry delete now frees selected fills (free_fill) and GCs isolated vertices (new VectorGraph::gc_isolated_vertices) — no more orphaned fills / phantom snap points; applies to the Delete key too. - clipboard_delete_selection clears focus so deleting dismisses the mobile inspector. - Mobile inspector: appears on pointer release (not press) so drags aren't interrupted; reflows only when the tapped point is actually behind the sheet; taps outside the sheet dismiss it; rounded-corner border no longer detaches.
This commit is contained in:
@@ -351,6 +351,29 @@ impl VectorGraph {
|
||||
}
|
||||
}
|
||||
|
||||
/// Free any vertex no longer referenced by a non-deleted edge (e.g. after deleting a shape's
|
||||
/// edges), so stale vertices don't linger as snap targets.
|
||||
pub fn gc_isolated_vertices(&mut self) {
|
||||
let mut referenced = vec![false; self.vertices.len()];
|
||||
for e in &self.edges {
|
||||
if e.deleted {
|
||||
continue;
|
||||
}
|
||||
for v in e.vertices.iter() {
|
||||
if !v.is_none() {
|
||||
referenced[v.idx()] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
let to_free: Vec<VertexId> = (0..self.vertices.len())
|
||||
.filter(|&i| !self.vertices[i].deleted && !referenced[i])
|
||||
.map(|i| VertexId(i as u32))
|
||||
.collect();
|
||||
for vid in to_free {
|
||||
self.free_vertex(vid);
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Fill / hit-test queries
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user