SIGN IN SIGN UP

Bonsai: fix UnboundLocalError crash in polyline angle calculation

angle_round_threshold was only assigned inside the `distance > 0`
branch of calculate_distance_and_angle, but read unconditionally
whenever should_round is True. When the mouse sample coincides with
the last placed point (distance == 0), such as the first mouse move
after placing a wall's start point on a YZ plane view, this crashed
the modal wall tool.

angle_round_threshold is a fixed cutoff unrelated to whether distance
is currently zero, so it is now assigned once before the branch.

Fixes #8597.

Generated with the assistance of an AI coding tool.
P
Petru Conduraru committed
89523999b3b44e3d33c8a9ea29680e2e8d615275
Parent: 51ab38d
Committed by Dion Moult <dion@thinkmoult.com> on 7/25/2026, 3:57:51 AM