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 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-07-09 21:35:47 +03:00
commit 363ff614ec
6 changed files with 289 additions and 137 deletions

View file

@ -252,6 +252,10 @@ pub(super) struct OpenCADStudio {
snapper: Snapper,
snap_popup_open: bool,
scale_popup_open: bool,
/// True while the polar-tracking angle picker is open.
polar_popup_open: bool,
/// Live text of the polar picker's custom-angle field.
polar_custom_input: String,
/// True while the status-bar customization menu is open.
statusbar_menu_open: bool,
/// True while the leftmost hamburger's Model/layout list dropdown is open.
@ -1404,8 +1408,16 @@ pub enum Message {
ToggleLineweightDisplay,
/// Toggle polar-angle constraint — F10 / POLAR status-bar button.
TogglePolar,
/// Set polar tracking angle increment (right-click POLAR button).
/// Set polar tracking angle increment (POLAR picker / right-click cycle).
SetPolarAngle(f32),
/// Open/close the polar-tracking angle picker (POLAR pill caret).
TogglePolarPopup,
/// Close the polar-tracking angle picker.
ClosePolarPopup,
/// Live text edit of the polar picker's custom-angle field.
PolarCustomInput(String),
/// Apply the typed custom polar angle (Enter in the picker's field).
SubmitPolarCustom,
/// Set the model-space annotation scale (CANNOSCALE equivalent).
SetAnnotationScale(f32),
/// Set the active viewport's custom_scale (paper space).
@ -2045,6 +2057,8 @@ impl OpenCADStudio {
snapper: Snapper::default(),
snap_popup_open: false,
scale_popup_open: false,
polar_popup_open: false,
polar_custom_input: String::new(),
statusbar_menu_open: false,
layout_list_open: false,
units_popup_open: false,