This commit is contained in:
2025-12-01 19:01:07 +08:00
parent 455c13a678
commit 92ba80b399
3825 changed files with 143766 additions and 118209 deletions

View File

@@ -45,6 +45,8 @@ namespace IngameDebugConsole
private bool isCollapseOn = false;
private bool viewportSizeChanged;
// Current indices of debug entries shown on screen
private int currentTopIndex = -1, currentBottomIndex = -1;
@@ -293,12 +295,29 @@ namespace IngameDebugConsole
return -1;
}
// Log window's width has changed, update the expanded (currently selected) log's height
public void OnViewportWidthChanged()
{
if( indexOfSelectedLogEntry >= entriesToShow.Count )
return;
private void OnRectTransformDimensionsChange()
{
viewportSizeChanged = true;
}
private void LateUpdate()
{
if (viewportSizeChanged)
{
viewportSizeChanged = false;
OnViewportSizeChanged();
}
}
private void OnViewportSizeChanged()
{
if (indexOfSelectedLogEntry >= entriesToShow.Count)
{
UpdateItemsInTheList(false);
return;
}
// Update the expanded (currently selected) log's height
CalculateSelectedLogEntryHeight();
CalculateContentHeight();
UpdateItemsInTheList( true );
@@ -306,12 +325,6 @@ namespace IngameDebugConsole
manager.ValidateScrollPosition();
}
// Log window's height has changed, update the list
public void OnViewportHeightChanged()
{
UpdateItemsInTheList( false );
}
private void CalculateContentHeight()
{
float newHeight = Mathf.Max( 1f, entriesToShow.Count * logItemHeight );