fix(properties): close the color dropdown on selection change and viewport click
The Properties color dropdown stayed open after deselecting, reselecting, or clicking into the viewport. refresh_properties carried color_picker_open across rebuilds, so a selection change never closed it; and a viewport press starts a box selection, so it only closed on the second click. Stop preserving the picker state across rebuilds and dismiss both color dropdowns on the first viewport press. Fixes #104. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
25bf371290
commit
6376080336
2 changed files with 8 additions and 2 deletions
|
|
@ -10,7 +10,9 @@ impl OpenCADStudio {
|
||||||
/// Preserves UI state (open pickers, edit buffer) across refreshes.
|
/// Preserves UI state (open pickers, edit buffer) across refreshes.
|
||||||
pub(super) fn refresh_properties(&mut self) {
|
pub(super) fn refresh_properties(&mut self) {
|
||||||
let i = self.active_tab;
|
let i = self.active_tab;
|
||||||
let color_picker_open = self.tabs[i].properties.color_picker_open;
|
// Note: the color-picker dropdown is intentionally NOT carried over — a
|
||||||
|
// rebuild means the selection (or a property) changed, so the dropdown
|
||||||
|
// closes, matching the deselect / reselect / click-away expectation.
|
||||||
let color_palette_open = self.tabs[i].properties.color_palette_open;
|
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 edit_buf = std::mem::take(&mut self.tabs[i].properties.edit_buf);
|
||||||
let selected_group = self.tabs[i].properties.selected_group.clone();
|
let selected_group = self.tabs[i].properties.selected_group.clone();
|
||||||
|
|
@ -307,7 +309,6 @@ impl OpenCADStudio {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
panel.color_picker_open = color_picker_open;
|
|
||||||
panel.color_palette_open = color_palette_open;
|
panel.color_palette_open = color_palette_open;
|
||||||
panel.edit_buf = edit_buf;
|
panel.edit_buf = edit_buf;
|
||||||
panel
|
panel
|
||||||
|
|
|
||||||
|
|
@ -2779,6 +2779,11 @@ impl OpenCADStudio {
|
||||||
// (e.g. the annotation style combo), which has no backdrop of
|
// (e.g. the annotation style combo), which has no backdrop of
|
||||||
// its own to catch outside clicks.
|
// its own to catch outside clicks.
|
||||||
self.ribbon.close_dropdown();
|
self.ribbon.close_dropdown();
|
||||||
|
// Likewise dismiss the Properties color dropdowns — a viewport
|
||||||
|
// press starts a box selection, so without this they'd only
|
||||||
|
// close on the second click (issue #104).
|
||||||
|
self.tabs[i].properties.color_picker_open = false;
|
||||||
|
self.tabs[i].properties.color_palette_open = false;
|
||||||
// Click anywhere outside the popup dismisses it. The
|
// Click anywhere outside the popup dismisses it. The
|
||||||
// menu's own buttons live above this mouse_area, so a
|
// menu's own buttons live above this mouse_area, so a
|
||||||
// press that reaches here means the cursor is not on
|
// press that reaches here means the cursor is not on
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue