Use shared unit formatters across property and dynamic views

This commit is contained in:
Marcel committed 2026-09-17 08:30:20 +02:00
1 parent ca0ee37d26
commit fca96b57de
10 files changed
+78 -65

No files matched your search

+16 -16
View File
@@ -9,8 +9,8 @@ use crate::t;
use crate::command::EntityTransform;
use crate::entities::common::{
center_grip, edit_prop as edit, oriented_triangle_grip, parse_f64, ro_prop as ro,
square_grip,
center_grip, edit_prop as edit, format_area, format_length, oriented_triangle_grip, parse_f64,
ro_prop as ro, square_grip,
};
use crate::entities::traits::RenderConvertible;
use crate::scene::convert::acad_to_render::{RenderEntity, RenderObject};
@@ -163,30 +163,30 @@ fn properties(ell: &Ellipse) -> Vec<PropSection> {
vec![PropSection {
title: t!("Geometry").into_owned(),
props: vec![
ro(t!("Start X").as_ref(), "start_x", format!("{:.4}", start.x)),
ro(t!("Start Y").as_ref(), "start_y", format!("{:.4}", start.y)),
ro(t!("Start Z").as_ref(), "start_z", format!("{:.4}", start.z)),
ro(t!("Start X").as_ref(), "start_x", format_length(start.x)),
ro(t!("Start Y").as_ref(), "start_y", format_length(start.y)),
ro(t!("Start Z").as_ref(), "start_z", format_length(start.z)),
edit(t!("Center X").as_ref(), "center_x", ell.center.x),
edit(t!("Center Y").as_ref(), "center_y", ell.center.y),
edit(t!("Center Z").as_ref(), "center_z", ell.center.z),
ro(t!("End X").as_ref(), "end_x", format!("{:.4}", end.x)),
ro(t!("End Y").as_ref(), "end_y", format!("{:.4}", end.y)),
ro(t!("End Z").as_ref(), "end_z", format!("{:.4}", end.z)),
ro(t!("End X").as_ref(), "end_x", format_length(end.x)),
ro(t!("End Y").as_ref(), "end_y", format_length(end.y)),
ro(t!("End Z").as_ref(), "end_z", format_length(end.z)),
edit(t!("Major radius").as_ref(), "major_r", r_major),
edit(t!("Minor radius").as_ref(), "minor_r", r_minor),
edit(t!("Radius ratio").as_ref(), "ratio", ell.minor_axis_ratio),
edit(t!("Start angle").as_ref(), "start_angle", start_angle),
edit(t!("End angle").as_ref(), "end_angle", end_angle),
ro(t!("Major axis vector X").as_ref(), "major_x", format!("{:.4}", major_vec.x)),
ro(t!("Major axis vector Y").as_ref(), "major_y", format!("{:.4}", major_vec.y)),
ro(t!("Major axis vector Z").as_ref(), "major_z", format!("{:.4}", major_vec.z)),
ro(t!("Minor axis vector X").as_ref(), "minor_x", format!("{:.4}", minor_vec.x)),
ro(t!("Minor axis vector Y").as_ref(), "minor_y", format!("{:.4}", minor_vec.y)),
ro(t!("Minor axis vector Z").as_ref(), "minor_z", format!("{:.4}", minor_vec.z)),
ro(t!("Area").as_ref(), "area", format!("{:.4}", props.area)),
ro(t!("Major axis vector X").as_ref(), "major_x", format_length(major_vec.x)),
ro(t!("Major axis vector Y").as_ref(), "major_y", format_length(major_vec.y)),
ro(t!("Major axis vector Z").as_ref(), "major_z", format_length(major_vec.z)),
ro(t!("Minor axis vector X").as_ref(), "minor_x", format_length(minor_vec.x)),
ro(t!("Minor axis vector Y").as_ref(), "minor_y", format_length(minor_vec.y)),
ro(t!("Minor axis vector Z").as_ref(), "minor_z", format_length(minor_vec.z)),
ro(t!("Area").as_ref(), "area", format_area(props.area)),
ro(t!("Start parameter").as_ref(), "start_param", format!("{:.4}", ell.start_parameter)),
ro(t!("End parameter").as_ref(), "end_param", format!("{:.4}", ell.end_parameter)),
ro(t!("Length").as_ref(), "length", format!("{:.4}", props.perimeter)),
ro(t!("Length").as_ref(), "length", format_length(props.perimeter)),
ro(t!("Normal X").as_ref(), "normal_x", format!("{:.4}", ell.normal.x)),
ro(t!("Normal Y").as_ref(), "normal_y", format!("{:.4}", ell.normal.y)),
ro(t!("Normal Z").as_ref(), "normal_z", format!("{:.4}", ell.normal.z)),