fix(hatch): pattern-scale edits take effect + background on/off
Property edits on a hatch were invisible: fills render from the prebuilt model cache, which move/copy refreshed but the properties path never did — so a pattern-scale change (which must also rescale the stored final pattern lines by the ratio) changed nothing on screen (#415). invalidate_property_targets now rebuilds the edited fill's cached model via Scene::refresh_fill_model. The background row gains an on/off box: off removes the HATCHBACKGROUNDCOLOR record entirely (the colour could never be reverted before), on seeds ByLayer. The codec covers the full colour-method range (ByLayer / ByBlock / RGB / ACI) and the backdrop resolves ByLayer / ByBlock through the style chain. "More Colors…" on the background picker now opens the palette window targeting the background colour — it used to just close the picker. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
a7fd9ecb45
commit
9bfcad18b9
6 changed files with 154 additions and 16 deletions
|
|
@ -708,7 +708,22 @@ impl Scene {
|
|||
if let Some(bg) = crate::entities::hatch::background_color(dxf) {
|
||||
let mut b = m.clone();
|
||||
b.pattern = model::hatch_model::HatchPattern::Solid;
|
||||
b.color = crate::scene::convert::tess_util::aci_to_rgba(&bg);
|
||||
// ByLayer / ByBlock backgrounds resolve through the
|
||||
// normal style chain instead of the raw ACI table
|
||||
// (#415).
|
||||
b.color = match bg {
|
||||
acadrust::types::Color::ByLayer => {
|
||||
crate::scene::view::render::layer_render_style(
|
||||
&self.document,
|
||||
&dxf.common.layer,
|
||||
)
|
||||
.color
|
||||
}
|
||||
acadrust::types::Color::ByBlock => self.render_style(e).0,
|
||||
other => {
|
||||
crate::scene::convert::tess_util::aci_to_rgba(&other)
|
||||
}
|
||||
};
|
||||
b.name = "SOLID".into();
|
||||
backdrop = Some(b);
|
||||
}
|
||||
|
|
@ -1585,6 +1600,27 @@ impl Scene {
|
|||
self.bump_geometry();
|
||||
}
|
||||
|
||||
/// Rebuild the cached fill model (hatch / DXF SOLID) for `handle` after
|
||||
/// its document entity was edited in place. The fill models are prebuilt
|
||||
/// at load, so a pattern-scale / background / boundary edit stays
|
||||
/// invisible until the cached model is refreshed (#415).
|
||||
pub fn refresh_fill_model(&mut self, handle: Handle) {
|
||||
let new_model = match self.document.get_entity(handle) {
|
||||
Some(EntityType::Hatch(dxf)) => {
|
||||
let color = convert::tess_util::aci_to_rgba(&dxf.common.color);
|
||||
Self::hatch_model_from_dxf(dxf, color)
|
||||
}
|
||||
Some(EntityType::Solid(s)) => {
|
||||
let color = convert::tess_util::aci_to_rgba(&s.common.color);
|
||||
Some(Self::solid_hatch_model(s, color))
|
||||
}
|
||||
_ => None,
|
||||
};
|
||||
if let Some(model) = new_model {
|
||||
self.hatches.insert(handle, model);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn populate_hatches_from_document(&mut self) {
|
||||
self.hatches.clear();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue