forked from 1b-agent/opencadstudio-upstream
feat(ui): use the shared colour selector in properties, ribbon and layers
Replace the bespoke colour pickers with the shared color_selector / color_list widget so colour selection is identical everywhere: - left properties panel (selected entities' colour) - ribbon Home-tab colour dropdown - layer manager per-layer colour Each routes its "More…" entry to the standalone Select Color window via a ColorPickTarget (Properties / Ribbon / Layer). Extracted color_list as the shared popup content; the colour selector button now fills its container. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
dfb2c6f9d7
commit
f7734b698f
6 files changed
+91
-167
No files matched your search
@@ -574,6 +574,12 @@ pub enum ColorPickTarget {
|
||||
DimStyle(DsField),
|
||||
MLeader(&'static str),
|
||||
Table(u8, &'static str),
|
||||
/// Selected entities' colour (left properties panel).
|
||||
Properties,
|
||||
/// Current creation colour (ribbon).
|
||||
Ribbon,
|
||||
/// A layer's colour, by panel row index.
|
||||
Layer(usize),
|
||||
}
|
||||
|
||||
/// Identifies a DimStyle field that can be edited in the dialog.
|
||||
|
||||
@@ -7330,6 +7330,10 @@ impl OpenCADStudio {
|
||||
self.ds_color_open = None;
|
||||
self.mls_color_open = None;
|
||||
self.ts_color_open = None;
|
||||
self.ribbon.close_dropdown();
|
||||
let i = self.active_tab;
|
||||
self.tabs[i].properties.color_picker_open = false;
|
||||
self.tabs[i].layers.color_picker_row = None;
|
||||
if let Some(id) = self.color_pick_window {
|
||||
return window::gain_focus(id);
|
||||
}
|
||||
@@ -7356,6 +7360,19 @@ impl OpenCADStudio {
|
||||
value: s,
|
||||
})
|
||||
}
|
||||
Some(crate::app::ColorPickTarget::Properties) => {
|
||||
Some(Message::PropColorChanged(color))
|
||||
}
|
||||
Some(crate::app::ColorPickTarget::Ribbon) => {
|
||||
Some(Message::RibbonColorChanged(color))
|
||||
}
|
||||
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,
|
||||
}
|
||||
}
|
||||
None => None,
|
||||
};
|
||||
let mut tasks = Vec::new();
|
||||
|
||||
Reference in new issue
Block a user