feat(props): select whole value when a property field is clicked

Clicking an editable property value field now selects its entire value instead
of only placing the caret, so typing immediately replaces it. The click is
observed through a global left-press subscription (PropPointerPressed); a focus
sweep reports which widget took focus and PropSyncActive maps it back to the
active property row, then issues a select-all operation only when focus landed
on a different field.

The active row stays highlighted while its text input holds keyboard focus and
clears when focus moves elsewhere.
This commit is contained in:
Karim Jerbi 2026-08-12 23:23:50 +01:00
commit 9f68034a60
6 changed files with 336 additions and 18 deletions

View file

@ -42,6 +42,7 @@ impl OpenCADStudio {
// closes, matching the deselect / reselect / click-away expectation.
let color_palette_open = self.tabs[i].properties.color_palette_open;
let edit_buf = std::mem::take(&mut self.tabs[i].properties.edit_buf);
let active_field = std::mem::take(&mut self.tabs[i].properties.active_field);
// Expanded coordinate groups persist across rebuilds AND selection
// changes — it's a per-user view preference, not per-entity state.
let expanded_groups = std::mem::take(&mut self.tabs[i].properties.expanded_groups);
@ -1441,6 +1442,14 @@ impl OpenCADStudio {
} else {
Default::default()
};
// The active-row highlight only survives a rebuild for the same
// selection (like the edit buffer); a selection change clears it so
// an old row isn't marked active against new content.
panel.active_field = if prev_handles == new_handles {
active_field
} else {
None
};
panel.expanded_groups = expanded_groups;
panel.source_handles = new_handles;
panel.prop_vertex = prop_vertex;
@ -1458,6 +1467,7 @@ impl OpenCADStudio {
if locked_only {
make_sections_read_only(&mut panel.sections);
panel.edit_buf.clear();
panel.active_field = None;
panel.color_picker_open = false;
panel.color_palette_open = false;
panel.bg_color_picker_open = false;