forked from 1b-agent/opencadstudio-upstream
feat(hatch): editable gradient colors + background color
Gradient Type (One/Two color), Color 1 and Color 2 editable via a generic field-keyed colour picker path. Background colour editable and stored as HATCHBACKGROUNDCOLOR extended data (group 1071 true colour), rendered in OCS as a solid backdrop drawn behind the pattern. Hide Origin X/Y for gradients (pattern-only concept) and drop the redundant gradient rows from the pattern branch. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
22059e138c
commit
b5106c82b5
5 files changed
+190
-27
No files matched your search
@@ -149,6 +149,9 @@ pub struct PropertiesPanel {
|
||||
/// from `color_picker_open` so the entity colour and the background colour
|
||||
/// pickers are independent.
|
||||
pub bg_color_picker_open: bool,
|
||||
/// Field name of the generic per-field colour picker currently open (e.g. a
|
||||
/// hatch gradient colour), or `None`. Keeps each field's picker independent.
|
||||
pub open_color_field: Option<String>,
|
||||
/// Which vertex a multi-vertex entity (polyline) is focused on — driven by
|
||||
/// the Current Vertex ◀ / ▶ stepper. Reset to 0 when the selection changes.
|
||||
pub prop_vertex: usize,
|
||||
@@ -173,6 +176,7 @@ impl Default for PropertiesPanel {
|
||||
color_picker_open: false,
|
||||
color_palette_open: false,
|
||||
bg_color_picker_open: false,
|
||||
open_color_field: None,
|
||||
prop_vertex: 0,
|
||||
}
|
||||
}
|
||||
@@ -430,6 +434,27 @@ impl PropertiesPanel {
|
||||
);
|
||||
return prop_row_widget(label, selector);
|
||||
}
|
||||
// Generic per-field colour picker (hatch gradient colours) — routes to
|
||||
// the field, not the entity's main colour.
|
||||
if field == "gradient_color_1" || field == "gradient_color_2" {
|
||||
let open = self.open_color_field.as_deref() == Some(field);
|
||||
let fsel = field.to_string();
|
||||
let selector = crate::ui::color_select::color_selector(
|
||||
color,
|
||||
open,
|
||||
crate::ui::color_select::ColorExtras {
|
||||
by_layer: false,
|
||||
by_block: false,
|
||||
},
|
||||
move |c| Message::PropColorFieldChanged {
|
||||
field: fsel.clone(),
|
||||
color: c,
|
||||
},
|
||||
Message::PropColorFieldToggle(field.to_string()),
|
||||
Message::PropColorFieldToggle(field.to_string()),
|
||||
);
|
||||
return prop_row_widget(label, selector);
|
||||
}
|
||||
let selector = crate::ui::color_select::color_selector(
|
||||
color,
|
||||
self.color_picker_open,
|
||||
|
||||
Reference in new issue
Block a user