Merge pull request #1792 from gianlucafiore/fix/otrack-live-distance-click-precision

Improve precise picking, OSNAP/OTRACK feedback and selection cursor
This commit is contained in:
gianlucafiore authored and GitHub committed 2026-10-14 11:33:07 -03:00
commit 8e7612c0c9
7 files changed
+138 -9

No files matched your search

+19 -1
View File
@@ -50,7 +50,7 @@ fn is_modal_blocked_key_msg(msg: &Message) -> bool {
fn perf_message_label(msg: &Message) -> &'static str {
match msg {
Message::ViewportLeftPress | Message::PanePress(_) => "pointer-down",
Message::ViewportLeftPressAt(_) | Message::ViewportLeftPress | Message::PanePress(_) => "pointer-down",
Message::ViewportLeftRelease | Message::PaneRelease(_) => "pointer-up",
Message::ViewportMove(_) | Message::PaneMove(_, _) => "pointer-move",
Message::CommandFinalize => "command-finalize",
@@ -4404,6 +4404,7 @@ impl OpenCADStudio {
// A multi-finger gesture owns the pointer while it runs.
Message::ViewportMove(_)
| Message::ViewportLeftPressAt(_)
| Message::ViewportLeftPress
| Message::ViewportLeftRelease
| Message::PaneMove(..)
@@ -4488,6 +4489,17 @@ impl OpenCADStudio {
self.update(Message::ViewportScroll(d))
}
Message::ViewportLeftPressAt(position) => {
// Use the pointer location captured by the actual button
// event. The last hover can lag behind fast cursor motion,
// particularly while expensive OSNAP/OTRACK previews run.
// Refresh the snap and world point before accepting the pick.
let moved = self.on_viewport_move(position);
self.graphic_attributes.open_menu = None;
let sweep = self.sync_active_field_if_any();
Task::batch(vec![moved, sweep, self.on_viewport_left_press()])
}
Message::ViewportLeftPress => {
self.graphic_attributes.open_menu = None;
let sweep = self.sync_active_field_if_any();
@@ -6339,6 +6351,12 @@ impl OpenCADStudio {
}
Task::none()
}
Message::DraftingSettingsOsnapApertureChanged(value) => {
if let Some(state) = &mut self.drafting_settings_state {
state.osnap_aperture_input = value;
}
Task::none()
}
Message::DraftingSettingsToggleOsnap => {
if let Some(state) = &mut self.drafting_settings_state {
state.osnap_on = !state.osnap_on;
+14 -2
View File
@@ -2663,7 +2663,15 @@ impl OpenCADStudio {
.map(|snap| snap.world)
.unwrap_or(cursor_world);
axis_lock_apply(point, base, dir)
} else if let Some(h) = otrack_hit {
} else if let Some(h) = otrack_hit.filter(|_| {
// A real object snap must win over tracking alignment.
// Otherwise the endpoint glyph can appear at the
// corner while the preview/accepted point follows the
// tracking line instead.
!self.tabs[i].snap_result.is_some_and(|s| {
s.snap_type != crate::snap::SnapType::Grid
})
}) {
h.aligned
} else {
// Snap runs in model space (viewport camera or the
@@ -4498,7 +4506,11 @@ impl OpenCADStudio {
} else {
None
};
if let Some(h) = otrack {
if let Some(h) = otrack.filter(|_| {
// Match the hover path: never override a genuine OSNAP
// endpoint/intersection with a tracking projection.
!snap_hit.is_some_and(|s| s.snap_type != crate::snap::SnapType::Grid)
}) {
pt = h.aligned;
if clamp_world_xy {
pt.z = 0.0;