mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 21:47:39 +02:00
editor fully scaleable
This commit is contained in:
27
Assets/Scripts/LevelEditor/Timeline/LayerLabel.cs
Normal file
27
Assets/Scripts/LevelEditor/Timeline/LayerLabel.cs
Normal file
@ -0,0 +1,27 @@
|
||||
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 = 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/4 * (1/modScale));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user