< Summary

Class:GDX.RectExtensions
Assembly:GDX
File(s):./Packages/com.dotbunny.gdx/GDX/RectExtensions.cs
Covered lines:0
Uncovered lines:8
Coverable lines:8
Total lines:27
Line coverage:0% (0 of 8)
Covered branches:0
Total branches:0
Covered methods:0
Total methods:1
Method coverage:0% (0 of 1)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
GetCenteredRect(...)0%2100%

File(s)

./Packages/com.dotbunny.gdx/GDX/RectExtensions.cs

#LineLine coverage
 1// Copyright (c) 2020-2024 dotBunny Inc.
 2// dotBunny licenses this file to you under the BSL-1.0 license.
 3// See the LICENSE file in the project root for more information.
 4
 5using UnityEngine;
 6
 7namespace GDX
 8{
 9    public static class RectExtensions
 10    {
 11        public static Rect GetCenteredRect(this Rect parentWindowPosition, Vector2 size, float safeZone = 0.9f)
 012        {
 013            Rect centeredWindowPosition = new Rect
 14            {
 15                x = 0.0f,
 16                y = 0.0f,
 17                width = Mathf.Min(size.x, parentWindowPosition.width * safeZone),
 18                height = Mathf.Min(size.y, parentWindowPosition.height * safeZone)
 19            };
 020            float num1 = (float)((parentWindowPosition.width - (double)centeredWindowPosition.width) * 0.5);
 021            float num2 = (float)((parentWindowPosition.height - (double)centeredWindowPosition.height) * 0.5);
 022            centeredWindowPosition.x = parentWindowPosition.x + num1;
 023            centeredWindowPosition.y = parentWindowPosition.y + num2;
 024            return centeredWindowPosition;
 025        }
 26    }
 27}