forked from 1b-agent/opencadstudio-upstream
feat(dyn): locked input fields constrain the preview and the click (#356)
A typed dynamic-input value (TAB-locked angle or distance) now shapes the rubber-band: the cursor point is routed through dyn_resolve_point — the same resolution Enter commits — in the mouse-move preview and the click commit, so a locked 30° pins the line's direction while the free field keeps tracking the cursor. The lock wins over osnap/ortho/polar. TAB (and the comma advance) reshape the preview immediately instead of waiting for the next mouse move. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3dd27c6789
commit
7a93ba82b3
4 files changed
+39
No files matched your search
@@ -1060,6 +1060,21 @@ pub(super) fn on_tick(&mut self, t: Instant) -> Task<Message> {
|
||||
}
|
||||
pt
|
||||
};
|
||||
// Dynamic-input locked fields constrain the preview point
|
||||
// (#356): a typed angle pins the direction, a typed
|
||||
// distance pins the radius — the same resolution the Enter
|
||||
// commit uses, so preview and commit agree. The lock wins
|
||||
// over osnap/ortho/polar.
|
||||
let effective = {
|
||||
let locked = self.tabs[i].active_cmd.is_some()
|
||||
&& self.tabs[i].dyn_fields.iter().any(|f| f.buffer.is_some());
|
||||
if locked {
|
||||
self.tabs[i].last_cursor_world = effective;
|
||||
self.dyn_resolve_point().unwrap_or(effective)
|
||||
} else {
|
||||
effective
|
||||
}
|
||||
};
|
||||
self.tabs[i].last_cursor_world = effective;
|
||||
self.tabs[i].last_cursor_screen = p_full;
|
||||
// Project the step anchor (an explicit `dyn_anchor` or the
|
||||
@@ -1970,6 +1985,17 @@ pub(super) fn on_tick(&mut self, t: Instant) -> Task<Message> {
|
||||
}
|
||||
}
|
||||
}
|
||||
// A click while dynamic-input fields hold typed values
|
||||
// commits the CONSTRAINED point — the same resolution
|
||||
// the preview shows and Enter would commit (#356).
|
||||
if self.tabs[i].active_cmd.is_some()
|
||||
&& self.tabs[i].dyn_fields.iter().any(|f| f.buffer.is_some())
|
||||
{
|
||||
self.tabs[i].last_cursor_world = pt;
|
||||
if let Some(r) = self.dyn_resolve_point() {
|
||||
pt = r;
|
||||
}
|
||||
}
|
||||
pt
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user