fix: Spline snap points and TextStyle backward/upside-down rendering

Spline entities now expose fit_points (or control_points when no fit
points are defined) as key_vertices, enabling Endpoint and Midpoint
snap to reach spline construction points.

TextStyle is_backward flag is applied by negating the width_factor,
producing horizontally mirrored text. is_upside_down rotates the text
180°. Both tessellate_text_ex and text_local_bounds now handle negative
width_factor without clamping it to zero.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-04-26 22:10:32 +03:00
commit 5216c247c2
4 changed files with 37 additions and 10 deletions

View file

@ -37,11 +37,24 @@ fn to_truck(spl: &Spline) -> TruckEntity {
let v_start = builder::vertex(p_start);
let v_end = builder::vertex(p_end);
let edge = Edge::new(&v_start, &v_end, Curve::BSplineCurve(bspline));
// Expose fit_points (preferred) or control_points as key_vertices so that
// Endpoint/Midpoint snap can reach spline construction points.
let snap_source = if !spl.fit_points.is_empty() {
&spl.fit_points
} else {
&spl.control_points
};
let key_vertices: Vec<[f32; 3]> = snap_source
.iter()
.map(|p| [p.x as f32, p.y as f32, p.z as f32])
.collect();
TruckEntity {
object: TruckObject::Curve(edge),
snap_pts: vec![],
tangent_geoms: vec![],
key_vertices: vec![],
key_vertices,
}
}