Skip to content

Commit 192208b

Browse files
committed
Vertical scrollbar is now hidden when not needed (fixed #110)
1 parent 80c0c42 commit 192208b

File tree

5 files changed

+31
-26
lines changed

5 files changed

+31
-26
lines changed

Plugins/IngameDebugConsole/IngameDebugConsole.prefab

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -530,9 +530,9 @@ RectTransform:
530530
m_RootOrder: 0
531531
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
532532
m_AnchorMin: {x: 0, y: 0}
533-
m_AnchorMax: {x: 1, y: 1}
533+
m_AnchorMax: {x: 0, y: 0}
534534
m_AnchoredPosition: {x: 0, y: 0}
535-
m_SizeDelta: {x: -28, y: 0}
535+
m_SizeDelta: {x: 0, y: 0}
536536
m_Pivot: {x: 0, y: 1}
537537
--- !u!114 &11471588
538538
MonoBehaviour:
@@ -2457,9 +2457,9 @@ MonoBehaviour:
24572457
m_HorizontalScrollbar: {fileID: 0}
24582458
m_VerticalScrollbar: {fileID: 11414302}
24592459
m_HorizontalScrollbarVisibility: 2
2460-
m_VerticalScrollbarVisibility: 0
2460+
m_VerticalScrollbarVisibility: 2
24612461
m_HorizontalScrollbarSpacing: -3
2462-
m_VerticalScrollbarSpacing: -3
2462+
m_VerticalScrollbarSpacing: 0
24632463
m_OnValueChanged:
24642464
m_PersistentCalls:
24652465
m_Calls: []

Plugins/IngameDebugConsole/README.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
= In-game Debug Console (v1.8.2) =
1+
= In-game Debug Console (v1.8.3) =
22

33
Documentation: https://github.com/yasirkula/UnityIngameDebugConsole
44
FAQ: https://github.com/yasirkula/UnityIngameDebugConsole#faq

Plugins/IngameDebugConsole/Scripts/DebugLogManager.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -885,8 +885,6 @@ private void LateUpdate()
885885
}
886886
}
887887
}
888-
889-
recycledListView.OnViewportWidthChanged();
890888
}
891889

892890
// If SnapToBottom is enabled, force the scrollbar to the bottom
@@ -950,11 +948,8 @@ private void LateUpdate()
950948

951949
if( screenDimensionsChanged )
952950
{
953-
// Update the recycled list view
954-
if( isLogWindowVisible )
955-
recycledListView.OnViewportHeightChanged();
956-
else
957-
popupManager.UpdatePosition( true );
951+
if (!isLogWindowVisible)
952+
popupManager.UpdatePosition(true);
958953

959954
#if UNITY_EDITOR || UNITY_ANDROID || UNITY_IOS
960955
CheckScreenCutout();
@@ -1643,9 +1638,6 @@ internal void Resize( PointerEventData eventData )
16431638
anchorMin.y = Mathf.Clamp01( localPoint.y / canvasSize.y );
16441639

16451640
logWindowTR.anchorMin = anchorMin;
1646-
1647-
// Update the recycled list view
1648-
recycledListView.OnViewportHeightChanged();
16491641
}
16501642

16511643
// Determine the filtered list of debug entries to show on screen

Plugins/IngameDebugConsole/Scripts/DebugLogRecycledListView.cs

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ public class DebugLogRecycledListView : MonoBehaviour
4545

4646
private bool isCollapseOn = false;
4747

48+
private bool viewportSizeChanged;
49+
4850
// Current indices of debug entries shown on screen
4951
private int currentTopIndex = -1, currentBottomIndex = -1;
5052

@@ -293,25 +295,36 @@ private int FindIndexOfLogEntryInReverseDirection( DebugLogEntry logEntry, int s
293295
return -1;
294296
}
295297

296-
// Log window's width has changed, update the expanded (currently selected) log's height
297-
public void OnViewportWidthChanged()
298+
private void OnRectTransformDimensionsChange()
299+
{
300+
viewportSizeChanged = true;
301+
}
302+
303+
private void LateUpdate()
304+
{
305+
if (viewportSizeChanged)
306+
{
307+
viewportSizeChanged = false;
308+
OnViewportSizeChanged();
309+
}
310+
}
311+
312+
private void OnViewportSizeChanged()
298313
{
299-
if( indexOfSelectedLogEntry >= entriesToShow.Count )
300-
return;
314+
if (indexOfSelectedLogEntry >= entriesToShow.Count)
315+
{
316+
UpdateItemsInTheList(false);
317+
return;
318+
}
301319

320+
// Update the expanded (currently selected) log's height
302321
CalculateSelectedLogEntryHeight();
303322
CalculateContentHeight();
304323
UpdateItemsInTheList( true );
305324

306325
manager.ValidateScrollPosition();
307326
}
308327

309-
// Log window's height has changed, update the list
310-
public void OnViewportHeightChanged()
311-
{
312-
UpdateItemsInTheList( false );
313-
}
314-
315328
private void CalculateContentHeight()
316329
{
317330
float newHeight = Mathf.Max( 1f, entriesToShow.Count * logItemHeight );

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "com.yasirkula.ingamedebugconsole",
33
"displayName": "In-game Debug Console",
4-
"version": "1.8.2",
4+
"version": "1.8.3",
55
"documentationUrl": "https://github.com/yasirkula/UnityIngameDebugConsole",
66
"changelogUrl": "https://github.com/yasirkula/UnityIngameDebugConsole/releases",
77
"licensesUrl": "https://github.com/yasirkula/UnityIngameDebugConsole/blob/master/LICENSE.txt",

0 commit comments

Comments
 (0)