fix(trim): honor preselected cutting boundaries

This commit is contained in:
gianlucafiore committed 2026-09-03 17:02:06 -03:00
1 parent 5ed508ce76
commit 2885898da6
2 files changed
+44 -7

No files matched your search

+33 -6
View File
@@ -149,7 +149,22 @@ impl Geo {
}
}
}
pub fn is_trim_boundary_entity(entity: &EntityType) -> bool {
matches!(
entity,
EntityType::Line(_)
| EntityType::Arc(_)
| EntityType::Circle(_)
| EntityType::Ellipse(_)
| EntityType::Ray(_)
| EntityType::XLine(_)
| EntityType::Spline(_)
| EntityType::LwPolyline(_)
| EntityType::Polyline(_)
| EntityType::Polyline2D(_)
| EntityType::Polyline3D(_)
)
}
fn build_geos(entities: &[EntityType]) -> Vec<Geo> {
let mut out = Vec::new();
for e in entities {
@@ -2169,21 +2184,33 @@ pub struct TrimCommand {
impl TrimCommand {
pub fn new(all_entities: Vec<EntityType>) -> Self {
Self::with_cutting_edges(all_entities, Vec::new())
}
pub fn with_cutting_edges(
all_entities: Vec<EntityType>,
initial_edges: Vec<Handle>,
) -> Self {
let all_entities: Vec<EntityType> = all_entities
.iter()
.map(entity_with_lwpolyline_world_xy)
.collect();
let entity_index = ModifyEntityIndex::build(&all_entities);
let geos = build_geos(&all_entities);
Self {
let mut cmd = Self {
all_entities,
entity_index,
geos,
geos: Vec::new(),
mode: TrimMode::Pick,
edge_set: Vec::new(),
edge_set: initial_edges,
implied_edges: false,
shift: false,
}
};
cmd.rebuild_geos();
cmd
}
/// Boundary geometry from the edge selection (or everything when none),