forked from 1b-agent/opencadstudio-upstream
fix(grips): drag model grips in the drawing plane, not onto themselves
In a tilted 3D view a grip followed the cursor onto the screen plane through the orbit target, so a circle or arc jumped to another radius and a polyline vertex left its plane. A model-space grip now moves in the UCS XY plane at its own elevation (the screen plane only when seen edge-on). A solid stays drawn while its grip moves, and its own edges were still snap candidates: a cone's base radius landed on its own side. The edited entities are left out of the grip's snap set. Fixes #1033 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
df94117fe5
commit
9cc890c911
2 files changed
+72
-7
No files matched your search
@@ -1646,6 +1646,39 @@ impl InteractionCandidates {
|
||||
.map(|(rect, (view, eye, bounds))| (rect, view, eye, bounds))
|
||||
}
|
||||
|
||||
/// Leave out every wire `drop` matches, with the segments, points and
|
||||
/// triangles that belong to it.
|
||||
pub(crate) fn exclude_wires(&mut self, drop: impl Fn(&WireModel) -> bool) {
|
||||
let wires = Arc::clone(&self.wires);
|
||||
let dropped = |wire: u32| wires.get(wire as usize).is_some_and(&drop);
|
||||
match self.wire_indices.as_mut() {
|
||||
Some(indices) => indices.retain(|&wire| !dropped(wire)),
|
||||
None => {
|
||||
self.wire_indices = Some(
|
||||
(0..wires.len() as u32)
|
||||
.filter(|&wire| !dropped(wire))
|
||||
.collect(),
|
||||
);
|
||||
}
|
||||
}
|
||||
fn keep<T>(
|
||||
refs: &mut Option<Vec<T>>,
|
||||
wire: impl Fn(&T) -> u32,
|
||||
dropped: impl Fn(u32) -> bool,
|
||||
) {
|
||||
if let Some(refs) = refs.as_mut() {
|
||||
refs.retain(|item| !dropped(wire(item)));
|
||||
}
|
||||
}
|
||||
keep(&mut self.segments, |r| r.wire, dropped);
|
||||
keep(&mut self.snap_points, |r| r.wire, dropped);
|
||||
keep(&mut self.key_vertices, |r| r.wire, dropped);
|
||||
keep(&mut self.key_segments, |r| r.wire, dropped);
|
||||
keep(&mut self.fill_triangles, |r| r.wire, dropped);
|
||||
keep(&mut self.pick_triangles, |r| r.wire, dropped);
|
||||
keep(&mut self.glyphs, |r| r.wire, dropped);
|
||||
}
|
||||
|
||||
pub(crate) fn extend_indexed_area(&mut self, other: Self) {
|
||||
debug_assert!(Arc::ptr_eq(&self.wires, &other.wires));
|
||||
|
||||
|
||||
Reference in new issue
Block a user