mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 21:57:37 +02:00
event selection doesn't go offscreen anymore
github copilot is insane it wrote half of the code in this commit lmao
This commit is contained in:
@ -17,10 +17,19 @@ namespace HeavenStudio.Editor.Track
|
||||
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));
|
||||
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/4 * (1/modScale));
|
||||
}
|
||||
catch (System.NullReferenceException)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user