fix: resolve precise snap at button-down before committing viewport pick

This commit is contained in:
gianlucafiore committed 2026-10-14 10:29:31 -03:00
1 parent 9954888d1d
commit d4b7e4bfb8
1 file changed
+13 -1
+13 -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",
@@ -4383,6 +4383,7 @@ impl OpenCADStudio {
// A multi-finger gesture owns the pointer while it runs.
Message::ViewportMove(_)
| Message::ViewportLeftPressAt(_)
| Message::ViewportLeftPress
| Message::ViewportLeftRelease
| Message::PaneMove(..)
@@ -4467,6 +4468,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();