perf(scene): grip drag previews the entity instead of re-tessellating
Phase 2.2 (partial). Dragging an entity's grip called scene.apply_grip on every mouse move, which bumped geometry and re-tessellated the whole model per move (plus an O(N) clone of every wire to exclude the edited one from snapping). On a large drawing that's the 30ms->400ms spike, per frame, for the duration of the drag. apply_grip no longer bumps. The drag flow now: - first move: hide the edited entity from the base tessellation (one re-tess) and record it in grip_preview_handle; - each move: apply the grip to the doc (no bump) and show the entity as a one-entity overlay preview (set_preview_wires) — the base is a cache hit; - commit on release / Esc: un-hide, drop the preview, one final re-tess. Because the edited entity is hidden, it's already absent from hit_test_wires, so snapping runs against the cached set directly — no per-move clone and no self-snap. Two re-tessellations per drag instead of one per move. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
ccb9bb832d
commit
8df9bef6f8
4 changed files with 57 additions and 8 deletions
|
|
@ -231,6 +231,12 @@ pub(super) struct OpenCADStudio {
|
|||
/// being placed (follows the cursor). `(entity handle, new-arrow grip id)`.
|
||||
/// Esc before the placement click removes it again.
|
||||
grip_add_provisional: Option<(acadrust::Handle, usize)>,
|
||||
/// Handle hidden from the base tessellation during an in-progress grip
|
||||
/// drag. While dragging, the edited entity is excluded from the cached
|
||||
/// wire set and shown as a cheap overlay preview instead, so each move
|
||||
/// updates only the overlay rather than re-tessellating the whole model.
|
||||
/// Committed (un-hidden + one re-tess) when the drag ends. `None` = idle.
|
||||
grip_preview_handle: Option<acadrust::Handle>,
|
||||
/// Open Quick Select panel state. `None` = panel closed. Filters are
|
||||
/// applied via `Message::QSelectApply`; the panel is dismissed on
|
||||
/// Apply / Cancel / Esc / outside-click.
|
||||
|
|
@ -1272,6 +1278,7 @@ impl OpenCADStudio {
|
|||
grip_popup: None,
|
||||
grip_pending: None,
|
||||
grip_add_provisional: None,
|
||||
grip_preview_handle: None,
|
||||
qselect: None,
|
||||
show_ucs_icon: true,
|
||||
show_viewcube: true,
|
||||
|
|
|
|||
Loading…
Reference in a new issue