From 489749e305493919341a9aa2657f452bd6e92f0e Mon Sep 17 00:00:00 2001 From: Manolis Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Tue, 1 Jun 2021 18:43:23 +0300 Subject: [PATCH] Fix division by zero crash --- src/UI/Canvas/CameraMovement.gd | 1 + 1 file changed, 1 insertion(+) diff --git a/src/UI/Canvas/CameraMovement.gd b/src/UI/Canvas/CameraMovement.gd index 052d7a6a6..b818adc22 100644 --- a/src/UI/Canvas/CameraMovement.gd +++ b/src/UI/Canvas/CameraMovement.gd @@ -224,6 +224,7 @@ func fit_to_frame(size : Vector2) -> void: v_ratio = Global.main_viewport.rect_size.y / size.y ratio = min(h_ratio, v_ratio) + ratio = clamp(ratio, 0.1, ratio) zoom = Vector2(1 / ratio, 1 / ratio) offset = size / 2 zoom_changed()