forked from 1b-agent/opencadstudio-upstream
feat(ui): implement themed 5-section ribbon object color dropdown
This commit is contained in:
1 parent
5f423c966a
commit
612124b84b
7 files changed
+381
-39
No files matched your search
@@ -1999,10 +1999,11 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
|
||||
}
|
||||
|
||||
pub(super) fn on_ribbon_color_changed(&mut self, color: AcadColor) -> Task<Message> {
|
||||
let i = self.active_tab;
|
||||
self.ribbon.prop_color_palette_open = false;
|
||||
self.ribbon.close_dropdown();
|
||||
let handles = self.property_target_handles(i);
|
||||
let i = self.active_tab;
|
||||
self.ribbon.prop_color_palette_open = false;
|
||||
self.ribbon.close_dropdown();
|
||||
self.note_recent_color(color);
|
||||
let handles = self.property_target_handles(i);
|
||||
if handles.is_empty() {
|
||||
if self.has_property_selection(i) {
|
||||
return Task::none();
|
||||
|
||||
+18
-15
@@ -9131,27 +9131,30 @@ impl OpenCADStudio {
|
||||
}
|
||||
|
||||
Message::ColorWindowPick(color) => {
|
||||
// Keep only real colours in the recent list. ByLayer / ByBlock / None
|
||||
// are logical CAD states rather than reusable colours.
|
||||
if matches!(
|
||||
&color,
|
||||
acadrust::types::Color::Index(_) | acadrust::types::Color::Rgb { .. }
|
||||
) {
|
||||
// No duplicates: selecting an existing colour moves it to the front.
|
||||
if let Some(pos) = self.recent_colors.iter().position(|c| c == &color) {
|
||||
self.recent_colors.remove(pos);
|
||||
}
|
||||
|
||||
self.recent_colors.insert(0, color.clone());
|
||||
self.recent_colors.truncate(12);
|
||||
}
|
||||
|
||||
self.note_recent_color(color);
|
||||
self.on_color_window_pick(color)
|
||||
}
|
||||
Message::DsSetHandle { field, value } => self.on_ds_set_handle(field, value),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn note_recent_color(&mut self, color: acadrust::types::Color) {
|
||||
// Keep only real colours in the recent list. ByLayer / ByBlock / None
|
||||
// are logical CAD states rather than reusable colours.
|
||||
if matches!(
|
||||
&color,
|
||||
acadrust::types::Color::Index(_) | acadrust::types::Color::Rgb { .. }
|
||||
) {
|
||||
// No duplicates: selecting an existing colour moves it to the front.
|
||||
if let Some(pos) = self.recent_colors.iter().position(|c| c == &color) {
|
||||
self.recent_colors.remove(pos);
|
||||
}
|
||||
|
||||
self.recent_colors.insert(0, color);
|
||||
self.recent_colors.truncate(12);
|
||||
}
|
||||
}
|
||||
|
||||
/// Load a named scale into the scale-manager editor buffers (name + the
|
||||
/// paper / drawing units); blank ratios when the scale isn't found.
|
||||
fn load_scale_editor(&mut self, name: &str) {
|
||||
|
||||
Reference in new issue
Block a user