forked from 1b-agent/opencadstudio-upstream
Redesign Select Color panel: index and true color tabs
Replace the old index page and the iced_aw ColorPicker popup with one Select Color panel: - Index Color tab: standard colors, ACI 10-249 grid, grays; arrow keys move through the palette. - True Color tab: HSB, RGB and gradient-field modes built on two new widgets (GradientSlider, ColorArea) and iced_aw NumberInput boxes, an editable hex field and a nearest/exact index color button. - Current/New swatch: clicking Current reverts. A mixed selection opens on the color of the most recently drawn object with *VARIES* on top. - Color field accepts an index, a color name, r,g,b or hex. - Enter confirms, Esc cancels, other keys stay in the panel. - New labels translated in all 22 locales. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013rGmDUNr1hUf4zo1X3dak8
This commit is contained in:
36 files changed
+2173
-276
No files matched your search
+9
-36
@@ -2474,42 +2474,15 @@ bg={bg_ms:.1}ms n={view_count}"
|
||||
}
|
||||
}
|
||||
|
||||
if let Some((_, current)) = self.color_pick_target.as_ref() {
|
||||
match self.color_picker_tab {
|
||||
super::ColorPickerTab::Index => {
|
||||
let content =
|
||||
crate::ui::color_select::index_color_page(*current, &self.recent_colors);
|
||||
|
||||
crate::ui::modal::modal(
|
||||
base,
|
||||
t!("Select Color"),
|
||||
content,
|
||||
Message::CloseColorPicker,
|
||||
self.modal_offset,
|
||||
crate::ui::modal::ModalOptions::NOTICE,
|
||||
)
|
||||
}
|
||||
|
||||
super::ColorPickerTab::TrueColor => {
|
||||
let initial = crate::ui::properties::acad_color_display(*current).0;
|
||||
let modal_base = crate::ui::modal::backdrop(base, Message::CloseColorPicker);
|
||||
|
||||
iced_aw::ColorPicker::new(
|
||||
true,
|
||||
initial,
|
||||
modal_base,
|
||||
// Cancel inside True Color returns to the indexed page instead
|
||||
// of closing the whole CAD colour picker.
|
||||
Message::ColorPickerTabChanged(super::ColorPickerTab::Index),
|
||||
|color| {
|
||||
Message::ColorWindowPick(crate::ui::color_select::iced_to_acad_color(
|
||||
color,
|
||||
))
|
||||
},
|
||||
)
|
||||
.into()
|
||||
}
|
||||
}
|
||||
if let Some(picker) = self.color_picker.as_ref() {
|
||||
crate::ui::modal::modal(
|
||||
base,
|
||||
t!("Select Color"),
|
||||
picker.view(),
|
||||
Message::CloseColorPicker,
|
||||
self.modal_offset,
|
||||
crate::ui::modal::ModalOptions::NOTICE,
|
||||
)
|
||||
} else {
|
||||
base
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user