ui: one symbol-unit helper for the window, ui.render and headless renders (#285)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UhhZMBTviDQxZvwnyP89fo
This commit is contained in:
jyvikoandClaude Opus 5.5 authored and Irakli Kourtis committed 2026-10-15 10:17:28 -04:00
1 parent b377c882d6
commit 1f36693c8f
6 files changed
+66 -17

No files matched your search

+14
View File
@@ -76,6 +76,20 @@ impl Scene {
self.labels.extend(other.labels);
self.on_top.extend(other.on_top);
}
/// Line widths and point sizes (given in points) in pixels at `pixels_per_point`, as the GPU
/// viewport draws them: a CPU render at device resolution then matches the window.
pub fn scale_marks(&mut self, pixels_per_point: f64) {
if !(pixels_per_point.is_finite() && pixels_per_point > 0.0) {
return;
}
for l in self.lines.iter_mut().chain(self.on_top.iter_mut()) {
l.width *= pixels_per_point;
}
for p in &mut self.points {
p.size *= pixels_per_point;
}
}
}
/// The lit colour of a surface with normal `n` seen along `view_dir` (toward the eye). The GPU