forked from 1b-agent/opencadstudio-upstream
feat(statusbar): quick properties floating panel (QP pill)
When the QP pill is on, a compact floating panel appears at the canvas top-left on selection, reusing the docked panel's editable section rows. Toggleable from the status-bar customization menu. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
66f7d24bc9
commit
834780ec5d
6 files changed
+72
No files matched your search
@@ -241,6 +241,47 @@ impl PropertiesPanel {
|
||||
.into()
|
||||
}
|
||||
|
||||
/// Compact floating panel for Quick Properties: the title plus the same
|
||||
/// editable section rows as the docked panel, sized to its content.
|
||||
/// Returns `None` when nothing is selected.
|
||||
pub fn quick_view(&self) -> Option<Element<'_, Message>> {
|
||||
if self.sections.is_empty() {
|
||||
return None;
|
||||
}
|
||||
let title = container(text(&self.title).size(FONT_SZ).color(SECTION_LABEL))
|
||||
.style(|_: &Theme| container::Style {
|
||||
background: Some(Background::Color(SECTION_BG)),
|
||||
border: Border {
|
||||
color: BORDER,
|
||||
width: 1.0,
|
||||
radius: 0.0.into(),
|
||||
},
|
||||
..Default::default()
|
||||
})
|
||||
.width(Length::Fill)
|
||||
.padding([4, 10]);
|
||||
|
||||
let mut col = column![title].spacing(0);
|
||||
for section in &self.sections {
|
||||
col = col.push(self.render_section(section));
|
||||
}
|
||||
|
||||
Some(
|
||||
container(col)
|
||||
.style(|_: &Theme| container::Style {
|
||||
background: Some(Background::Color(PANEL_BG)),
|
||||
border: Border {
|
||||
color: BORDER,
|
||||
width: 1.0,
|
||||
radius: 3.0.into(),
|
||||
},
|
||||
..Default::default()
|
||||
})
|
||||
.width(230)
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
// ── Section renderer ──────────────────────────────────────────────────
|
||||
|
||||
fn render_section<'a>(&'a self, section: &'a PropSection) -> Element<'a, Message> {
|
||||
|
||||
@@ -63,6 +63,8 @@ impl StatusBar {
|
||||
isolation_active: bool,
|
||||
// Whether entity transparency is shown (Transparency pill state).
|
||||
transparency_display: bool,
|
||||
// Whether the Quick Properties floating panel is enabled.
|
||||
quick_properties: bool,
|
||||
// Which pills the user has chosen to show on the bar.
|
||||
config: &'a StatusBarConfig,
|
||||
) -> Element<'a, Message> {
|
||||
@@ -193,6 +195,12 @@ impl StatusBar {
|
||||
"Isolate Objects\nClick for Isolate / Hide / End",
|
||||
));
|
||||
}
|
||||
if vis(StatusPill::QuickProps) {
|
||||
right_status = right_status.push(tip(
|
||||
toggle_pill("QP", quick_properties, Message::ToggleQuickProperties),
|
||||
"Quick Properties\nFloating panel on selection",
|
||||
));
|
||||
}
|
||||
if vis(StatusPill::Vp) && !vp_label.is_empty() {
|
||||
right_status = right_status.push(tip(
|
||||
status_pill(vp_label).into(),
|
||||
|
||||
@@ -25,6 +25,7 @@ pub enum StatusPill {
|
||||
Units,
|
||||
Transparency,
|
||||
Isolate,
|
||||
QuickProps,
|
||||
Vp,
|
||||
CleanScreen,
|
||||
}
|
||||
@@ -47,6 +48,7 @@ impl StatusPill {
|
||||
StatusPill::Units,
|
||||
StatusPill::Transparency,
|
||||
StatusPill::Isolate,
|
||||
StatusPill::QuickProps,
|
||||
StatusPill::Vp,
|
||||
StatusPill::CleanScreen,
|
||||
];
|
||||
@@ -68,6 +70,7 @@ impl StatusPill {
|
||||
StatusPill::Units => "units",
|
||||
StatusPill::Transparency => "transparency",
|
||||
StatusPill::Isolate => "isolate",
|
||||
StatusPill::QuickProps => "quickprops",
|
||||
StatusPill::Vp => "vp",
|
||||
StatusPill::CleanScreen => "cleanscreen",
|
||||
}
|
||||
@@ -90,6 +93,7 @@ impl StatusPill {
|
||||
StatusPill::Units => "Drawing Units",
|
||||
StatusPill::Transparency => "Show Transparency",
|
||||
StatusPill::Isolate => "Isolate Objects",
|
||||
StatusPill::QuickProps => "Quick Properties",
|
||||
StatusPill::Vp => "Viewport Count",
|
||||
StatusPill::CleanScreen => "Clean Screen",
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user