Results view: hover over contours is an outline, not a pink fill (#207)

While result contours are shown, the hovered item's face fill is left out
and only its outline, edges and nodes are drawn, so the hover never hides
the colours under the pointer. Picker::hover is the hover's own overlay.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UhhZMBTviDQxZvwnyP89fo
This commit is contained in:
jyvikoandClaude Opus 5.5 authored and Irakli Kourtis committed 2026-10-14 17:53:46 -04:00
1 parent a8f6be3bee
commit ddde08fb4c
2 files changed
+22 -2

No files matched your search

+3 -2
View File
@@ -873,8 +873,9 @@ impl ModelApp {
}
let mut s = (*self.pick.selected_overlay.1).clone();
if let Some(hover) = self.pick.hover.clone() {
let h = self
.with_picker(|p| p.overlay(&selection::Selection::default(), Some(&hover), theme::rgb(t.pick_selected), theme::rgb(t.pick_hover)));
// Over result contours the hover is an outline, so it never hides the result (#207).
let fill = self.plot.1.is_none();
let h = self.with_picker(|p| p.hover(&hover, theme::rgb(t.pick_hover), fill));
s.tris.extend(h.tris);
s.lines.extend(h.lines);
s.points.extend(h.points);
+19
View File
@@ -544,6 +544,18 @@ impl Picker<'_> {
s
}
/// The hovered item drawn over the scene in `color`. With `fill` off (while result contours
/// are shown) its faces are left out and only their outline, edges and nodes are drawn, so
/// the hover never hides the colours under the pointer.
pub fn hover(&self, item: &Item, color: Rgb, fill: bool) -> Scene {
let mut s = Scene::default();
self.mark(&Marks::of(self, std::iter::once(item)), color, &mut s);
if !fill {
s.tris.clear();
}
s
}
fn mark(&self, m: &Marks, color: Rgb, s: &mut Scene) {
if m.is_empty() {
return;
@@ -961,6 +973,13 @@ mod tests {
// Hovering an element adds its skin triangles in the hover colour, drawn after.
let o = p.overlay(&sel, Some(&Item::Element(1)), sel_c, hov_c);
assert_eq!(o.tris.iter().filter(|t| t.color == hov_c).count(), 6);
// Over result contours the hover is its outline only: no face fills.
let filled = p.hover(&Item::Element(1), hov_c, true);
assert_eq!(filled.tris.len(), 6);
let outlined = p.hover(&Item::Element(1), hov_c, false);
assert!(outlined.tris.is_empty());
assert_eq!(outlined.lines, filled.lines);
assert!(!outlined.lines.is_empty());
// Nodes, the edge and the vertex.
sel.apply(
[