refactor(ui): adopt iced color picker

Remove local Pin/PickList wrappers and the ACI grid.\nBlock viewport input behind the picker and load iced_aw glyphs.
This commit is contained in:
Hakan Seven 2026-07-30 15:19:58 +03:00
commit c9c3d3b1bf
25 changed files with 289 additions and 255 deletions

View file

@ -2120,6 +2120,9 @@ impl OpenCADStudio {
Message::PaneClicked(pane) => self.on_pane_clicked(pane),
Message::PaneDragged(ev) => self.on_pane_dragged(ev),
Message::PaneMove(idx, local) => {
if self.color_pick_target.is_some() {
return Task::none();
}
let p = self.pane_canvas_point(idx, local);
// While dragging a pane, just track the cursor (no focus swap or
// snap) so the drop target reads cleanly.
@ -5744,8 +5747,8 @@ impl OpenCADStudio {
};
Task::none()
}
Message::OpenColorWindow(target) => {
self.color_pick_target = Some(target);
Message::OpenColorWindow(target, color) => {
self.color_pick_target = Some((target, color));
self.ds_color_open = None;
self.mls_color_open = None;
self.ts_color_open = None;
@ -5753,8 +5756,7 @@ impl OpenCADStudio {
let i = self.active_tab;
self.tabs[i].properties.color_picker_open = false;
self.tabs[i].layers.color_picker_row = None;
// Shown as a nested modal over the active dialog (Plan B):
// `color_pick_target.is_some()` drives the overlay in view_main.
// `color_pick_target.is_some()` drives the iced_aw overlay.
Task::none()
}
Message::CloseColorPicker => {

View file

@ -960,7 +960,7 @@ pub(super) fn on_text_style_dialog_open(&mut self) -> Task<Message> {
pub(super) fn on_color_window_pick(&mut self, color: acadrust::types::Color) -> Task<Message> {
let s = crate::ui::color_select::color_to_aci_string(color);
let edit = match self.color_pick_target.take() {
let edit = match self.color_pick_target.take().map(|(target, _)| target) {
Some(crate::app::ColorPickTarget::DimStyle(f)) => Some(Message::DsEdit(f, s)),
Some(crate::app::ColorPickTarget::MLeader(f)) => {
Some(Message::MLeaderStyleEdit { field: f, value: s })
@ -986,10 +986,14 @@ pub(super) fn on_text_style_dialog_open(&mut self) -> Task<Message> {
}
Some(crate::app::ColorPickTarget::Layer(idx)) => {
self.tabs[self.active_tab].layers.selected = Some(idx);
match color {
acadrust::types::Color::Index(i) => Some(Message::LayerColorSet(i)),
_ => None,
}
let index = match color {
acadrust::types::Color::Index(i) => i,
acadrust::types::Color::Rgb { r, g, b } => {
crate::ui::color_select::nearest_aci(r, g, b)
}
_ => 7,
};
Some(Message::LayerColorSet(index))
}
Some(crate::app::ColorPickTarget::LayerState(idx)) => {
Some(Message::LayerStateEditorLayerColor(idx, color))

View file

@ -435,6 +435,10 @@ impl OpenCADStudio {
}
pub(super) fn on_cursor_moved(&mut self, p: Point) -> Task<Message> {
if self.color_pick_target.is_some() {
return Task::none();
}
// `p` is relative to the ViewCube hit area's top-left. Map
// it back to full-canvas coordinates so ViewportClick's
// hit-test lines up. The hit area sits in the top-right of
@ -498,7 +502,7 @@ impl OpenCADStudio {
// leaks through the stack to the pane mouse_area beneath and
// would track the crosshair over the dropdown's empty areas.
// Drop the move here instead. (#227)
if self.ribbon.open_dropdown.is_some() {
if self.ribbon.open_dropdown.is_some() || self.color_pick_target.is_some() {
return Task::none();
}
let i = self.active_tab;