ZMWSLI0-SL2021-GR11/Projekt/MWSProjekt/Library/PackageCache/com.unity.textmeshpro@3.0.4/Scripts/Runtime/TMP_SelectionCaret.cs

38 lines
1.2 KiB
C#
Raw Normal View History

2021-07-05 21:20:56 +02:00
using UnityEngine;
using UnityEngine.UI;
namespace TMPro
{
/// <summary>
/// A simple component that can be added to a newly created object where inheriting from MaskableGraphic is needed.
/// </summary>
[RequireComponent(typeof(CanvasRenderer))]
public class TMP_SelectionCaret : MaskableGraphic
{
/// <summary>
/// Override to Cull function of MaskableGraphic to prevent Culling.
/// </summary>
/// <param name="clipRect"></param>
/// <param name="validRect"></param>
public override void Cull(Rect clipRect, bool validRect)
{
//Debug.Log("***** Cull (" + clipRect + ") Valid Rect: " + validRect + " Cull: " + canvasRenderer.cull + " *****");
if (validRect)
{
canvasRenderer.cull = false;
CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(this);
return;
}
base.Cull(clipRect, validRect);
}
protected override void UpdateGeometry()
{
// Function overridden as Caret and text Selection Highlight is controlled by the Input Field.
}
}
}