forked from 1b-agent/opencadstudio-upstream
feat(annotation): show all scales on highlight
This commit is contained in:
1 parent
e03e091b3c
commit
baf9b240a4
3 files changed
+238
-3
No files matched your search
@@ -272,6 +272,7 @@ pub struct Pipeline {
|
||||
pub cached_wipeout_source: Option<std::sync::Arc<Vec<HatchModel>>>,
|
||||
pub cached_image_source: Option<std::sync::Arc<Vec<ImageModel>>>,
|
||||
pub cached_text_source: Option<std::sync::Arc<Vec<text_gpu::TextVertex>>>,
|
||||
pub cached_annotation_highlight_source: Option<std::sync::Arc<Vec<WireModel>>>,
|
||||
pub cached_mesh_source: Option<std::sync::Arc<Vec<MeshLodSet>>>,
|
||||
pub cached_face3d_source: Option<std::sync::Arc<Vec<WireModel>>>,
|
||||
pub cached_face3d_depth_source:
|
||||
@@ -1694,6 +1695,7 @@ impl Pipeline {
|
||||
cached_wipeout_source: None,
|
||||
cached_image_source: None,
|
||||
cached_text_source: None,
|
||||
cached_annotation_highlight_source: None,
|
||||
cached_mesh_source: None,
|
||||
cached_face3d_source: None,
|
||||
cached_face3d_depth_source: None,
|
||||
@@ -1785,11 +1787,12 @@ impl Pipeline {
|
||||
wires: &[WireModel],
|
||||
selected: &rustc_hash::FxHashSet<acadrust::Handle>,
|
||||
hover: Option<acadrust::Handle>,
|
||||
annotation_context_wires: &[WireModel],
|
||||
depth_map: &rustc_hash::FxHashMap<u64, [f32; 2]>,
|
||||
) {
|
||||
let perf_started = crate::perf::enabled().then(iced::time::Instant::now);
|
||||
let hover = hover.filter(|h| !selected.contains(h));
|
||||
if selected.is_empty() && hover.is_none() {
|
||||
if selected.is_empty() && hover.is_none() && annotation_context_wires.is_empty() {
|
||||
self.gpu_selected_wires = vec![];
|
||||
return;
|
||||
}
|
||||
@@ -1819,6 +1822,13 @@ impl Pipeline {
|
||||
}
|
||||
}
|
||||
}
|
||||
for wire in annotation_context_wires {
|
||||
if wire.selected {
|
||||
selected_wires.push(wire);
|
||||
} else {
|
||||
hover_wires.push(wire);
|
||||
}
|
||||
}
|
||||
let mut gpu = WireGpu::from_highlight_refs(
|
||||
device,
|
||||
&selected_wires,
|
||||
@@ -1857,10 +1867,11 @@ impl Pipeline {
|
||||
wires: &[WireModel],
|
||||
selected: &rustc_hash::FxHashSet<acadrust::Handle>,
|
||||
hover: Option<acadrust::Handle>,
|
||||
annotation_context_wires: &[WireModel],
|
||||
) {
|
||||
let perf_started = crate::perf::enabled().then(iced::time::Instant::now);
|
||||
let hover = hover.filter(|h| !selected.contains(h));
|
||||
if selected.is_empty() && hover.is_none() {
|
||||
if selected.is_empty() && hover.is_none() && annotation_context_wires.is_empty() {
|
||||
self.text_highlight_vbuf = None;
|
||||
self.text_highlight_vcount = 0;
|
||||
return;
|
||||
@@ -1887,6 +1898,19 @@ impl Pipeline {
|
||||
if let Some(h) = hover {
|
||||
push(h.value(), WireModel::HOVER, wires, &mut out);
|
||||
}
|
||||
for wire in annotation_context_wires {
|
||||
let tint = if wire.selected {
|
||||
WireModel::SELECTED
|
||||
} else {
|
||||
WireModel::HOVER
|
||||
};
|
||||
for vertex in &wire.text_verts {
|
||||
out.push(text_gpu::TextVertex {
|
||||
color: [tint[0], tint[1], tint[2], vertex.color[3]],
|
||||
..*vertex
|
||||
});
|
||||
}
|
||||
}
|
||||
self.text_highlight_vcount = out.len() as u32;
|
||||
self.text_highlight_vbuf = text_gpu::upload_vertices(device, &out);
|
||||
if let Some(started) = perf_started {
|
||||
|
||||
Reference in new issue
Block a user