Fix for division by zero error in Gradient2.cs

pull/413/head
Moritz Umfahrer 2019-10-29 11:48:36 +01:00
parent ae01ccead4
commit 4ac901e416
1 changed files with 1 additions and 1 deletions

View File

@ -125,7 +125,7 @@ namespace UnityEngine.UI.Extensions
GetPosition = v => v.position.y; GetPosition = v => v.position.y;
} }
float width = 1f / w / Zoom; float width = w == 0f ? 0f : 1f / w / Zoom;
float zoomOffset = (1 - (1 / Zoom)) * 0.5f; float zoomOffset = (1 - (1 / Zoom)) * 0.5f;
float offset = (Offset * (1 - zoomOffset)) - zoomOffset; float offset = (Offset * (1 - zoomOffset)) - zoomOffset;