forked from 1b-agent/opencadstudio-upstream
feat(polar): angle picker dropdown on the POLAR pill (#264)
The polar-tracking pill only right-click-cycled 15→30→45→90. Add an AutoCAD-style angle picker opened from a caret on the pill: presets 90/45/30/22.5/18/15/10/5/1 plus a free-text field for any custom angle, mirroring the existing units / scale status-bar popups. The chosen angle persists like the other user settings. Factor the shared chrome into one `split_pill(main, caret_msg, active, open)` helper (+ `pill_text_color`) so the OSNAP and POLAR pills stop hand-rolling the same outer border, background, caret and sizing — each pill now only supplies its own main region. The caret is sized and aligned to sit inside the single pill border on both. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
39c0a84c3c
commit
363ff614ec
6 files changed
+289
-137
No files matched your search
@@ -1561,6 +1561,37 @@ impl OpenCADStudio {
|
||||
self.polar_increment_deg = deg;
|
||||
self.polar_mode = true;
|
||||
self.ortho_mode = false;
|
||||
self.polar_popup_open = false;
|
||||
Task::none()
|
||||
}
|
||||
Message::TogglePolarPopup => {
|
||||
self.polar_popup_open ^= true;
|
||||
if self.polar_popup_open {
|
||||
// Start the custom field empty each time; picking a preset or
|
||||
// typing a value is what actually enables polar tracking.
|
||||
self.polar_custom_input.clear();
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
Message::ClosePolarPopup => {
|
||||
self.polar_popup_open = false;
|
||||
Task::none()
|
||||
}
|
||||
Message::PolarCustomInput(s) => {
|
||||
self.polar_custom_input = s;
|
||||
Task::none()
|
||||
}
|
||||
Message::SubmitPolarCustom => {
|
||||
// Accept any positive angle up to a full turn; ignore garbage.
|
||||
if let Ok(v) = self.polar_custom_input.trim().parse::<f32>() {
|
||||
if v > 0.0 && v <= 360.0 {
|
||||
self.polar_increment_deg = v;
|
||||
self.polar_mode = true;
|
||||
self.ortho_mode = false;
|
||||
}
|
||||
}
|
||||
self.polar_custom_input.clear();
|
||||
self.polar_popup_open = false;
|
||||
Task::none()
|
||||
}
|
||||
Message::SetAnnotationScale(scale) => {
|
||||
|
||||
Reference in new issue
Block a user