forked from 1b-agent/opencadstudio-upstream
feat(statusbar): isolate action menu on the pill and right-click
Clicking the ISO pill now opens a small menu with Isolate Objects, Hide Objects and End Isolation instead of ending isolation directly; rows that don't apply (no selection / nothing hidden) are dimmed. The same actions are added to the viewport right-click menu. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
e0e7897952
commit
28ec360255
6 files changed
+165
-6
No files matched your search
@@ -175,6 +175,8 @@ pub(super) struct OpenCADStudio {
|
||||
statusbar_menu_open: bool,
|
||||
/// True while the drawing-units picker is open.
|
||||
units_popup_open: bool,
|
||||
/// True while the Isolate pill's action menu is open.
|
||||
isolate_popup_open: bool,
|
||||
/// Clean-screen mode: hide ribbon and side panels for a full canvas.
|
||||
clean_screen: bool,
|
||||
/// Which status-bar pills the user has chosen to show (persisted).
|
||||
@@ -754,6 +756,10 @@ pub enum Message {
|
||||
CloseUnitsPopup,
|
||||
/// Set the drawing units (INSUNITS) for the active drawing.
|
||||
SetDrawingUnits(i16),
|
||||
/// Toggle the Isolate pill's action menu open/closed.
|
||||
ToggleIsolatePopup,
|
||||
/// Close the Isolate action menu.
|
||||
CloseIsolatePopup,
|
||||
/// Toggle dynamic input overlay (F12).
|
||||
ToggleDynInput,
|
||||
/// Toggle object snap tracking (F11).
|
||||
@@ -1212,6 +1218,7 @@ impl OpenCADStudio {
|
||||
scale_popup_open: false,
|
||||
statusbar_menu_open: false,
|
||||
units_popup_open: false,
|
||||
isolate_popup_open: false,
|
||||
statusbar_config: crate::ui::statusbar_config::StatusBarConfig::load(),
|
||||
clean_screen: false,
|
||||
pre_cmd_tangent: None,
|
||||
|
||||
@@ -1353,6 +1353,8 @@ impl OpenCADStudio {
|
||||
// Close viewport context menu if open.
|
||||
let i = self.active_tab;
|
||||
self.tabs[i].scene.selection.borrow_mut().context_menu = None;
|
||||
// Any command also dismisses the Isolate action menu.
|
||||
self.isolate_popup_open = false;
|
||||
self.dispatch_command(&cmd)
|
||||
}
|
||||
|
||||
@@ -3595,6 +3597,14 @@ impl OpenCADStudio {
|
||||
self.tabs[i].dirty = true;
|
||||
Task::none()
|
||||
}
|
||||
Message::ToggleIsolatePopup => {
|
||||
self.isolate_popup_open ^= true;
|
||||
Task::none()
|
||||
}
|
||||
Message::CloseIsolatePopup => {
|
||||
self.isolate_popup_open = false;
|
||||
Task::none()
|
||||
}
|
||||
Message::ToggleSnap(t) => {
|
||||
self.snapper.toggle(t);
|
||||
Task::none()
|
||||
|
||||
@@ -1016,6 +1016,7 @@ impl OpenCADStudio {
|
||||
if let Some(p) = ctx_pos {
|
||||
let has_cmd = tab.active_cmd.is_some();
|
||||
let has_selection = !tab.scene.selected.is_empty();
|
||||
let isolation_active = tab.scene.is_isolation_active();
|
||||
let last_cmds: Vec<String> = self
|
||||
.command_line
|
||||
.cmd_recall
|
||||
@@ -1028,6 +1029,7 @@ impl OpenCADStudio {
|
||||
p,
|
||||
has_cmd,
|
||||
has_selection,
|
||||
isolation_active,
|
||||
last_cmds,
|
||||
draworder_open,
|
||||
));
|
||||
@@ -1210,6 +1212,15 @@ impl OpenCADStudio {
|
||||
iced::widget::Space::new().width(0).height(0).into()
|
||||
};
|
||||
|
||||
let isolate_layer: Element<'_, Message> = if self.isolate_popup_open {
|
||||
crate::ui::isolate_popup::isolate_popup_overlay(
|
||||
!tab.scene.selected.is_empty(),
|
||||
tab.scene.is_isolation_active(),
|
||||
)
|
||||
} else {
|
||||
iced::widget::Space::new().width(0).height(0).into()
|
||||
};
|
||||
|
||||
let dropdown_layer: Element<'_, Message> = self
|
||||
.ribbon
|
||||
.dropdown_overlay(
|
||||
@@ -1247,6 +1258,7 @@ impl OpenCADStudio {
|
||||
scale_layer,
|
||||
statusbar_menu_layer,
|
||||
units_layer,
|
||||
isolate_layer,
|
||||
dropdown_layer,
|
||||
layout_ctx_layer,
|
||||
qselect_layer,
|
||||
@@ -2201,6 +2213,7 @@ fn viewport_context_menu_overlay(
|
||||
pos: iced::Point,
|
||||
has_cmd: bool,
|
||||
has_selection: bool,
|
||||
isolation_active: bool,
|
||||
last_cmds: Vec<String>,
|
||||
draworder_open: bool,
|
||||
) -> Element<'static, Message> {
|
||||
@@ -2341,8 +2354,23 @@ fn viewport_context_menu_overlay(
|
||||
));
|
||||
}
|
||||
items.push(sep());
|
||||
items.push(item(
|
||||
"Isolate Objects".to_string(),
|
||||
Message::Command("ISOLATEOBJECTS".to_string()),
|
||||
));
|
||||
items.push(item(
|
||||
"Hide Objects".to_string(),
|
||||
Message::Command("HIDEOBJECTS".to_string()),
|
||||
));
|
||||
items.push(sep());
|
||||
items.push(item("Select Similar".to_string(), Message::SelectSimilar));
|
||||
}
|
||||
if isolation_active {
|
||||
items.push(item(
|
||||
"End Object Isolation".to_string(),
|
||||
Message::Command("UNISOLATEOBJECTS".to_string()),
|
||||
));
|
||||
}
|
||||
items.push(item(
|
||||
"Select All".to_string(),
|
||||
Message::Command("SELECTALL".to_string()),
|
||||
|
||||
Reference in new issue
Block a user