mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-27 12:03:00 +00:00
Fixed timeline event's not being rendered if their start and end points are outside of the view.
Thank you to chrislo27 for suggesting a fix to this.
This commit is contained in:
parent
79bf70f76f
commit
c2c59e7910
2 changed files with 11 additions and 2 deletions
|
@ -64,7 +64,7 @@ namespace RhythmHeavenMania.Editor.Track
|
||||||
[SerializeField] private RectTransform TimelineSlider;
|
[SerializeField] private RectTransform TimelineSlider;
|
||||||
[SerializeField] private RectTransform TimelineGridSelect;
|
[SerializeField] private RectTransform TimelineGridSelect;
|
||||||
[SerializeField] private TMP_Text TimelinePlaybackBeat;
|
[SerializeField] private TMP_Text TimelinePlaybackBeat;
|
||||||
[SerializeField] private RectTransform TimelineContent;
|
public RectTransform TimelineContent;
|
||||||
[SerializeField] private RectTransform TimelineSongPosLineRef;
|
[SerializeField] private RectTransform TimelineSongPosLineRef;
|
||||||
[SerializeField] private RectTransform TimelineEventObjRef;
|
[SerializeField] private RectTransform TimelineEventObjRef;
|
||||||
[SerializeField] private RectTransform LayersRect;
|
[SerializeField] private RectTransform LayersRect;
|
||||||
|
|
|
@ -81,8 +81,17 @@ namespace RhythmHeavenMania.Editor.Track
|
||||||
|
|
||||||
#region Optimizations
|
#region Optimizations
|
||||||
|
|
||||||
// problem with long objects but im lazy right now
|
// thank you to @chrislo27 for suggesting the fix for this.
|
||||||
|
// only renders blocks if they're in view of the timeline viewport
|
||||||
bool visible = rectTransform.IsVisibleFrom(Editor.instance.EditorCamera);
|
bool visible = rectTransform.IsVisibleFrom(Editor.instance.EditorCamera);
|
||||||
|
var leftSide = rectTransform.localPosition.x;
|
||||||
|
var rightSide = leftSide + rectTransform.sizeDelta.x;
|
||||||
|
|
||||||
|
var timelineLeftSide = (Timeline.instance.TimelineContent.localPosition.x / 100f) * -1;
|
||||||
|
var timelineRightSide = timelineLeftSide + 10.563f; // what a magic number, i'm sure I could calculate this but I'm lazy
|
||||||
|
|
||||||
|
visible = (rightSide >= timelineLeftSide && leftSide <= timelineRightSide);
|
||||||
|
|
||||||
|
|
||||||
if (visible != lastVisible)
|
if (visible != lastVisible)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue