5argon / NotchSolution

A set of components and tools to solve notched/cutout phones layout problems for Unity.
http://exceed7.com/notch-solution
MIT License
671 stars 90 forks source link

NotchSolutionUIBehaviourBase.UpdateRect is private protected #53

Closed yasirkula closed 2 years ago

yasirkula commented 3 years ago

Thank you for the great plugin! I'm planning to write an article about it.

I was trying to write a custom notch script that extends NotchSolutionUIBehaviourBase but I realized that it won't compile until I put it inside the NotchSolution/Runtime folder (which is harder when Package Manager is used). It's caused by the private protected abstract void UpdateRect(); method. Would you consider changing its visibility to protected?

Here's my custom notch script:

using E7.NotchSolution;
using UnityEngine;

public class NotchTest : NotchSolutionUIBehaviourBase
{
    private protected override void UpdateRect()
    {
        Rect safeArea = SafeAreaRelative;
        rectTransform.anchorMin = new Vector2( rectTransform.anchorMin.x, safeArea.yMax );

        m_Tracker.Clear();
        m_Tracker.Add( this, rectTransform, DrivenTransformProperties.AnchorMaxY | DrivenTransformProperties.PivotY );

        rectTransform.anchorMax = new Vector2( rectTransform.anchorMax.x, 1f );
        rectTransform.pivot = new Vector2( rectTransform.pivot.x, 1f );
    }
}

It expands the top background with the notch:

notch

5argon commented 2 years ago

Thank you for your PR! I had no time for years to maintain this, now I am getting back to it.