feat(blocks): switch dynamic-block visibility states from a lookup grip
A block reference with a visibility parameter now shows a triangular lookup grip at the parameter point. Clicking it opens a dropdown of the named states (current one marked); picking a state toggles which of the anonymous block's members are visible and rebuilds, so the reference shows the chosen profile instead of being frozen on the saved state. The state list is data-driven (owned strings from the file) and applying it mutates other entities (the anonymous block's members), so it stays separate from the static GripMenuAction grip-menu: a dedicated VisibilityPopup and an app-level apply path. The anonymous block is a parallel-ordered clone of its definition, so a member visible in the definition's state maps to the same index in the inserted block; the chosen visibility flags round-trip through the DWG writer. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
1f54b1241f
commit
9b1bd011ca
6 changed files with 321 additions and 1 deletions
|
|
@ -1391,6 +1391,9 @@ impl OpenCADStudio {
|
|||
self.grip_hover = None;
|
||||
return Task::none();
|
||||
}
|
||||
if self.visibility_popup.take().is_some() {
|
||||
return Task::none();
|
||||
}
|
||||
if self.grip_pending.take().is_some() {
|
||||
self.command_line.input.clear();
|
||||
return Task::none();
|
||||
|
|
@ -2691,6 +2694,11 @@ impl OpenCADStudio {
|
|||
self.grip_hover = None;
|
||||
return Task::none();
|
||||
}
|
||||
// Outside-click dismiss for the visibility-state dropdown
|
||||
// (its buttons sit above this mouse_area).
|
||||
if self.visibility_popup.take().is_some() {
|
||||
return Task::none();
|
||||
}
|
||||
// Same dismiss-on-outside-click for the right-click
|
||||
// context menu: its panel is opaque, so a press that
|
||||
// reaches here is outside the menu.
|
||||
|
|
@ -2805,6 +2813,14 @@ impl OpenCADStudio {
|
|||
find_hit_grip(p, &self.tabs[i].selected_grips, vp_mat, bounds)
|
||||
};
|
||||
if let Some((grip_id, is_translate, world)) = grip_hit {
|
||||
// The visibility (lookup) grip opens a state
|
||||
// dropdown instead of starting a stretch drag.
|
||||
if grip_id == super::visibility::VIS_GRIP_ID {
|
||||
self.open_visibility_popup(p);
|
||||
self.grip_hover = None;
|
||||
self.grip_popup = None;
|
||||
return Task::none();
|
||||
}
|
||||
self.tabs[i].active_grip = Some(GripEdit {
|
||||
handle,
|
||||
grip_id,
|
||||
|
|
@ -3803,6 +3819,13 @@ impl OpenCADStudio {
|
|||
Task::none()
|
||||
}
|
||||
|
||||
Message::VisibilityPick(idx) => {
|
||||
if let Some(popup) = self.visibility_popup.take() {
|
||||
self.apply_visibility_state(popup.insert_handle, idx);
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
|
||||
Message::GripMenuPick(idx) => {
|
||||
let i = self.active_tab;
|
||||
let Some(popup) = self.grip_popup.take() else {
|
||||
|
|
@ -7359,8 +7382,11 @@ impl OpenCADStudio {
|
|||
} else if let Some(h) = self.grip_hover.as_mut() {
|
||||
h.screen = p;
|
||||
}
|
||||
// Open popup once dwell crosses the threshold.
|
||||
// Open popup once dwell crosses the threshold. The visibility
|
||||
// grip has its own click-to-open dropdown, so it gets no
|
||||
// hover grip-menu.
|
||||
if self.grip_popup.is_none()
|
||||
&& grip_id != super::visibility::VIS_GRIP_ID
|
||||
&& self
|
||||
.grip_hover
|
||||
.as_ref()
|
||||
|
|
|
|||
Loading…
Reference in a new issue