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 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-07-08 17:53:05 +03:00
1 parent a4f7ee376f
commit b3c8c0a2f1
12 files changed
+208 -22

No files matched your search

+3
View File
@@ -29,6 +29,9 @@ pub enum PropValue {
LinetypeChoice(String),
/// Boolean flag — rendered as a toggle button (e.g. Invisible).
BoolToggle { field: &'static str, value: bool },
/// A 0-based index navigated with ◀ / ▶ buttons (e.g. a polyline's Current
/// Vertex). `display` is the label shown between the arrows (e.g. "2 / 7").
Stepper { field: &'static str, display: String },
/// Hatch pattern name — rendered as a combo_box from the catalog.
HatchPatternChoice(String),
/// Block attribute value keyed by its (dynamic, runtime) tag — rendered as
+1
View File
@@ -299,6 +299,7 @@ impl Scene {
PropValue::HatchPatternChoice(s) => s,
PropValue::BoolToggle { value, .. } => value.to_string(),
PropValue::AttrText { value, .. } => value,
PropValue::Stepper { display, .. } => display,
PropValue::ColorVaries | PropValue::LwVaries => return None,
})
}
+20
View File
@@ -8,6 +8,26 @@ use crate::entities::traits::EntityTypeOps;
use crate::scene::model::object::{GripDef, PropSection};
use crate::scene::cache::properties;
thread_local! {
/// Which vertex a multi-vertex entity's Properties panel is focused on
/// (Current Vertex stepper). Set by the app from its `prop_vertex` state
/// before building or editing a polyline's properties; read by the
/// polyline `properties` / `apply_geom_prop` so the X/Y and per-vertex
/// width rows target that vertex. A thread-local keeps the per-entity trait
/// signatures unchanged (mirrors the curve-tolerance override).
static PROP_CURRENT_VERTEX: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
}
/// Focus the Properties panel on vertex `i` for the next properties build / edit.
pub fn set_prop_current_vertex(i: usize) {
PROP_CURRENT_VERTEX.with(|c| c.set(i));
}
/// The vertex the Properties panel is focused on.
pub fn prop_current_vertex() -> usize {
PROP_CURRENT_VERTEX.with(|c| c.get())
}
pub fn grips(entity: &EntityType) -> Vec<GripDef> {
EntityTypeOps::grips(entity)
}