Puppet: selected pins are filled and ringed, unselected hollow (#96)

A selected pin was drawn only 1 px bigger and slightly brighter. Now, like
selected and unselected mask vertices in the viewer, a selected pin is
filled with its kind colour and ringed in white, and an unselected pin is
hollow (dark centre, coloured outline). Drawing only; hit-testing is
unchanged.

Regression test: selected_puppet_pins_are_filled_and_unselected_hollow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 103b5c41e9e8ea84008593e05af50b01a2800b3e)
This commit is contained in:
Brandon Thomas
2026-10-06 11:09:41 -04:00
parent 7002c92632
commit a46ebf4dc7
2 changed files with 55 additions and 2 deletions
+11 -2
View File
@@ -170,9 +170,18 @@ pub fn draw(
}
}
// Pins grow under the pointer.
// Selected pins are filled with their colour and ringed in white; unselected pins are
// hollow (dark centre, coloured outline), like selected and unselected mask vertices.
// Drawing only: hit-testing uses `pos` alone.
let r = if sel { 5.5 } else { 4.5 } + if hover.is_some_and(|h| h.distance(pos) < 8.0) { 1.5 } else { 0.0 };
painter.circle_filled(pos, r, if sel { col } else { col.gamma_multiply(0.85) });
painter.circle_stroke(pos, r, Stroke::new(1.0, Color32::BLACK));
if sel {
painter.circle_filled(pos, r, col);
painter.circle_stroke(pos, r, Stroke::new(1.0, Color32::BLACK));
painter.circle_stroke(pos, r + 2.5, Stroke::new(1.5, Color32::WHITE));
} else {
painter.circle_filled(pos, r, Color32::from_black_alpha(160));
painter.circle_stroke(pos, r, Stroke::new(1.5, col));
}
hits.push(PinHit { layer: layer.id, pin: pn.uid, kind: pn.kind, pos, rotation: pn.rotation, scale: pn.scale, handle });
}
}