forked from 1b-agent/opencadstudio-upstream
feat(ui): show color swatch and layer in selection cycling popup
Improve the selection-cycling list box so overlapping objects can be identified at a glance: - Add a color swatch per row showing the object's effective drawn color - Show the layer name right-aligned next to the element type - Size the popup to fit its content with consistent padding Widen render_style_for_viewport visibility from scene-internal to crate-wide so the view layer resolves the same color the renderer uses.
This commit is contained in:
1 parent
452749f58c
commit
6bf84d8f5e
3 files changed
+93
-16
No files matched your search
+15
-5
@@ -1435,13 +1435,23 @@ impl OpenCADStudio {
|
||||
// Selection-cycling list box: pick among overlapping objects.
|
||||
if let Some((pt, cands)) = &self.cycle_candidates {
|
||||
if !tab.is_start {
|
||||
let items: Vec<(acadrust::Handle, String)> = cands
|
||||
let items: Vec<crate::ui::popup::cycle_popup::CycleCandidate> = cands
|
||||
.iter()
|
||||
.filter_map(|&h| {
|
||||
tab.scene
|
||||
.document
|
||||
.get_entity(h)
|
||||
.map(|e| (h, crate::entities::traits::entity_type_name(e).to_string()))
|
||||
tab.scene.document.get_entity(h).map(|e| {
|
||||
let style = crate::scene::view::render::render_style_for_viewport(
|
||||
&tab.scene.document,
|
||||
e,
|
||||
None,
|
||||
);
|
||||
crate::ui::popup::cycle_popup::CycleCandidate {
|
||||
handle: h,
|
||||
type_name: crate::entities::traits::entity_type_name(e)
|
||||
.to_string(),
|
||||
layer: e.common().layer.clone(),
|
||||
color: style.0,
|
||||
}
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
if !items.is_empty() {
|
||||
|
||||
Reference in new issue
Block a user