From 32c2c932f838880f51891fdd038435d7171bf684 Mon Sep 17 00:00:00 2001 From: Tomostfe <92489891+Tomostfe@users.noreply.github.com> Date: Tue, 1 Nov 2022 15:59:17 +0100 Subject: [PATCH] Removed crash when mouse is on origin of arrow. --- examples/draw/draw_arrow.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/draw/draw_arrow.rs b/examples/draw/draw_arrow.rs index 71ccc1c2b..a10dad9ee 100644 --- a/examples/draw/draw_arrow.rs +++ b/examples/draw/draw_arrow.rs @@ -16,7 +16,7 @@ fn view(app: &App, frame: Frame) { let start = r.xy(); let start_to_mouse = app.mouse.position() - start; let target_mag = start_to_mouse.length().min(side * 0.5); - let end = start + start_to_mouse.normalize() * target_mag; + let end = start + start_to_mouse.normalize_or_zero() * target_mag; draw.arrow().weight(5.0).points(start, end); } }