Example #1
0
    public override void SetConstraints()
    {
        base.SetConstraints();

        if (parentPC == null)
        {
            parentPC = parent.GetComponent <PortfolioController>();
        }
        Vector2 targetSize = parentPC.panelSize;

        scaleVector = new Vector2(targetSize.x / rt.sizeDelta.x, targetSize.y / rt.sizeDelta.y);
        background.rectTransform.localPosition = new Vector2(0f, 0f);

        // Set size of both window and background image
        background.rectTransform.sizeDelta = targetSize;
        rt.sizeDelta = targetSize;

        foreach (GameObject element in content)
        {
            LayoutController elementLC = element.GetComponent <LayoutController>();
            if (elementLC != null)
            {
                elementLC.RepositionElements();
            }
        }
    }