7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 00:21:25 +00:00

Bezier: Correct bounding box calculation

Beziers can extend outside the control point hull,
and can also be far inside the hull. Especially the latter
interferes with selection.

So use the approximated segments to determine.
This commit is contained in:
John Beard 2024-09-27 06:23:04 +01:00
parent 717847cc31
commit 7dfac8d1ab

View File

@ -840,10 +840,10 @@ const BOX2I EDA_SHAPE::getBoundingBox() const
break;
case SHAPE_T::BEZIER:
bbox.SetOrigin( GetStart() );
bbox.Merge( GetBezierC1() );
bbox.Merge( GetBezierC2() );
bbox.Merge( GetEnd() );
// Bezier BBoxes are not trivial to compute, so we approximate it by
// using the bounding box of the curve (not control!) points.
for( const VECTOR2I& pt : m_bezierPoints )
bbox.Merge( pt );
break;
default: