mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-28 12:33:02 +00:00
aa9379e21e
it is battery acid color (i will change it) i probably did this wrong
36 lines
No EOL
1.1 KiB
C#
36 lines
No EOL
1.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using UnityEngine.EventSystems;
|
|
|
|
using TMPro;
|
|
using Starpelly;
|
|
|
|
namespace HeavenStudio.Editor.Track
|
|
{
|
|
public class LayerLabel : MonoBehaviour
|
|
{
|
|
[SerializeField] private RectTransform rect;
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
//convert timeline layer scale to screen space
|
|
Camera cam;
|
|
//"your program can't crash if you put everything in a try block"
|
|
try
|
|
{
|
|
cam = Editor.instance.EditorCamera;
|
|
float layerScaleDist = cam.WorldToScreenPoint(Timeline.instance.LayerCorners[1]).y - Camera.main.WorldToScreenPoint(Timeline.instance.LayerCorners[0]).y;
|
|
float modScale = Timeline.GetScaleModifier();
|
|
rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, layerScaleDist/5 * (1/modScale));
|
|
}
|
|
catch (System.NullReferenceException)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
|
|
}
|
|
} |