feat(properties): navigate polyline vertices from the panel

The Current Vertex row is now a ◀ / ▶ stepper (new PropValue::Stepper)
showing "i / N". Stepping it moves the panel's focus through the
polyline's vertices — Vertex X/Y and the per-vertex start/end widths show
and edit the focused vertex instead of always the first — and the focused
vertex's grip is drawn hot (filled) in the drawing so it's visible while
navigating. Focus wraps around and resets to the first vertex when the
selection changes. Adds Area and Length to the LwPolyline Geometry group
(Polyline2D already had them). Applies to LwPolyline and Polyline2D.

The focused vertex is threaded to the per-entity property builder/editor
through a dispatch thread-local (like the curve-tolerance override), so
the PropertyEditable trait signatures are unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-07-08 17:53:05 +03:00
commit b3c8c0a2f1
12 changed files with 208 additions and 22 deletions

View file

@ -2200,6 +2200,29 @@ impl OpenCADStudio {
Task::none()
}
Message::PropVertexStep(delta) => {
let i = self.active_tab;
let handles = self.property_target_handles(i);
// Vertex navigation applies to a single selected polyline.
let n = if handles.len() == 1 {
match self.tabs[i].scene.document.get_entity(handles[0]) {
Some(acadrust::EntityType::LwPolyline(p)) => p.vertices.len(),
Some(acadrust::EntityType::Polyline2D(p)) => p.vertices.len(),
_ => 0,
}
} else {
0
};
if n > 0 {
let cur = self.tabs[i].properties.prop_vertex.min(n - 1) as i64;
// Wrap around so ◀ from the first vertex lands on the last.
let next = (cur + delta as i64).rem_euclid(n as i64) as usize;
self.tabs[i].properties.prop_vertex = next;
self.refresh_properties();
}
Task::none()
}
Message::PropGeomChoiceChanged { field, value } => {
self.on_prop_geom_choice_changed(field, value)
}