feat(display): add model lineweight scale

This commit is contained in:
Hakan Seven committed 2026-09-02 23:03:04 +03:00
1 parent edbc4d8ff8
commit 76bdab1e5b
11 files changed
+66 -19

No files matched your search

+3
View File
@@ -1469,6 +1469,8 @@ pub struct Scene {
/// Whether entity transparency is honoured on screen. When false the
/// wire shader forces every line opaque (a uniform toggle, no retessellate).
pub transparency_display: bool,
/// User-adjustable model-space lineweight preview multiplier.
pub model_lineweight_scale: f32,
/// Selection filter: entity-type names excluded from interactive picking.
/// Empty = every type is selectable.
pub selection_filter: HashSet<String>,
@@ -1878,6 +1880,7 @@ impl Scene {
refedit_keep: None,
hover_highlight: None,
transparency_display: true,
model_lineweight_scale: 1.0,
selection_filter: HashSet::default(),
preview_wires: vec![],
preview_hatches: Arc::new(Vec::new()),
+2 -2
View File
@@ -25,8 +25,8 @@ pub struct Uniforms {
/// zooming inside MSPACE changes one scalar instead of re-tessellating and
/// re-uploading every dashed wire.
pub linetype_scale: f32,
/// Multiplier for screen-space lineweights. Model space keeps `1.0`;
/// paper layouts derive it from the current paper zoom.
/// Multiplier for screen-space lineweights. Model space uses the user's
/// preview scale; paper layouts derive it from the current paper zoom.
pub lineweight_scale: f32,
// ── Relative-to-eye (double-single) additions ───────────────────────────
+3 -1
View File
@@ -3847,7 +3847,9 @@ impl Scene {
full_bounds,
self.document.header.lineweight_display || display_plot_lineweights,
);
if self.current_layout != "Model" {
if self.current_layout == "Model" {
uniforms.lineweight_scale = self.model_lineweight_scale;
} else {
let paper_per_pixel = 2.0 * self.camera.borrow().ortho_size() / canvas.1.max(1.0);
let paper_units_per_mm = self.paper_space_unit_factor() as f32;
uniforms.lineweight_scale = paper_units_per_mm / paper_per_pixel / MM_TO_PX;