Fix: disable snap during entity-pick and selection-gathering modes
Snap is now suppressed (both cursor indicator and coordinate snapping) when a command is in entity-pick mode (needs_entity_pick) or selection-gathering mode (is_selection_gathering), and restored automatically when the mode ends. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
f01e4f69be
commit
748d90af7e
3 changed files with 14 additions and 6 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -4,7 +4,7 @@ version = 4
|
|||
|
||||
[[package]]
|
||||
name = "H7CAD"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
dependencies = [
|
||||
"acadrust",
|
||||
"bytemuck",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "H7CAD"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
edition = "2021"
|
||||
build = "build.rs"
|
||||
|
||||
|
|
|
|||
|
|
@ -750,9 +750,15 @@ impl H7CAD {
|
|||
let cursor_world = self.tabs[i].scene.paper_to_model(cursor_paper);
|
||||
|
||||
let all_wires = self.tabs[i].scene.hit_test_wires();
|
||||
let needs_entity = self.tabs[i]
|
||||
.active_cmd.as_ref().map(|c| c.needs_entity_pick()).unwrap_or(false);
|
||||
let is_gathering = self.tabs[i]
|
||||
.active_cmd.as_ref().map(|c| c.is_selection_gathering()).unwrap_or(false);
|
||||
let needs_tan = self.tabs[i]
|
||||
.active_cmd.as_ref().map(|c| c.needs_tangent_pick()).unwrap_or(false);
|
||||
self.tabs[i].snap_result = if needs_tan {
|
||||
self.tabs[i].snap_result = if needs_entity || is_gathering {
|
||||
None
|
||||
} else if needs_tan {
|
||||
self.snapper.snap_tangent_only(cursor_world, p, &all_wires, view_proj, bounds)
|
||||
} else {
|
||||
self.snapper.snap(cursor_world, p, &all_wires, view_proj, bounds)
|
||||
|
|
@ -775,8 +781,6 @@ impl H7CAD {
|
|||
};
|
||||
self.tabs[i].last_cursor_world = effective;
|
||||
|
||||
let needs_entity = self.tabs[i]
|
||||
.active_cmd.as_ref().map(|c| c.needs_entity_pick()).unwrap_or(false);
|
||||
let previews = if needs_entity {
|
||||
let hover_handle =
|
||||
scene::hit_test::click_hit(p, &all_wires, view_proj, bounds)
|
||||
|
|
@ -902,7 +906,11 @@ impl H7CAD {
|
|||
let all_wires = self.tabs[i].scene.hit_test_wires();
|
||||
let needs_tan = self.tabs[i].active_cmd.as_ref()
|
||||
.map(|c| c.needs_tangent_pick()).unwrap_or(false);
|
||||
let snap_hit = if needs_tan {
|
||||
let needs_entity_click = self.tabs[i].active_cmd.as_ref()
|
||||
.map(|c| c.needs_entity_pick()).unwrap_or(false);
|
||||
let snap_hit = if needs_entity_click {
|
||||
None
|
||||
} else if needs_tan {
|
||||
self.snapper.snap_tangent_only(raw, p, &all_wires, vp_mat, bounds)
|
||||
} else {
|
||||
self.snapper.snap(raw, p, &all_wires, vp_mat, bounds)
|
||||
|
|
|
|||
Loading…
Reference in a new issue