< Summary

Class:PrivateChatEntryBackgroundFitter
Assembly:PrivateChatWindowHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/PrivateChatWindow/PrivateChatEntryBackgroundFitter.cs
Covered lines:0
Uncovered lines:11
Coverable lines:11
Total lines:30
Line coverage:0% (0 of 11)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
PrivateChatEntryBackgroundFitter()0%2100%
Update()0%20400%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/PrivateChatWindow/PrivateChatEntryBackgroundFitter.cs

#LineLine coverage
 1using TMPro;
 2using UnityEngine;
 3
 4[ExecuteInEditMode]
 5public class PrivateChatEntryBackgroundFitter : MonoBehaviour
 6{
 7    public RectTransform rectTransform;
 8    public RectTransform parentContainerRectTransform;
 9    public TextMeshProUGUI messageText;
 010    public bool leftMessage = true;
 11
 12    void Update()
 13    {
 014        Vector2 textSize = new Vector2(messageText.bounds.size.x + messageText.margin.x + messageText.margin.z,
 15            messageText.bounds.size.y + messageText.margin.y * 2);
 16
 017        messageText.transform.localPosition = new Vector3(leftMessage ? (messageText.margin.x + messageText.margin.z) / 
 18
 019        if (parentContainerRectTransform)
 20        {
 021            parentContainerRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, textSize.x);
 022            parentContainerRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, textSize.y);
 023            parentContainerRectTransform.ForceUpdateRectTransforms();
 24        }
 25
 026        rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, textSize.x);
 027        rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, textSize.y);
 028        rectTransform.ForceUpdateRectTransforms();
 029    }
 30}