using UnityEngine;

// public class BGAnchorObj
// {
//     public Transform _AnchorObj;
//     public Vector2 _Position;
// }

public class UIBGImageSize : MonoBehaviour
{
    public float _HeightFix;
    public float _WidthFix;
    // public List<BGAnchorObj> _AnchorInfos;
    private RectTransform _RectTransform;
    
    private void Awake()
    {
        _RectTransform = GetComponent<RectTransform>();
    }

    private void Start()
    {
        SetScreenSize();
    }

    private void SetScreenSize()
    {
        if (_HeightFix > 0)
            _RectTransform.sizeDelta = new Vector2(_RectTransform.sizeDelta.x, _RectTransform.rect.width * _HeightFix);
        else if (_WidthFix > 0)
            _RectTransform.sizeDelta = new Vector2(_RectTransform.rect.height / _WidthFix, _RectTransform.sizeDelta.y);
    }
}