@@ -51,6 +51,7 @@ class LocksControl
51
51
[ NonSerialized ] private GitLockEntry rightClickNextRenderEntry ;
52
52
[ NonSerialized ] private int controlId ;
53
53
[ NonSerialized ] private UnityEngine . Object lastActivatedObject ;
54
+ [ NonSerialized ] private Dictionary < string , bool > visibleItems = new Dictionary < string , bool > ( ) ;
54
55
55
56
[ SerializeField ] private Vector2 scroll ;
56
57
[ SerializeField ] private List < GitLockEntry > gitLockEntries = new List < GitLockEntry > ( ) ;
@@ -106,15 +107,19 @@ public bool Render(Rect containingRect, Action<GitLock> singleClick = null,
106
107
var endDisplay = scroll . y + containingRect . height ;
107
108
108
109
var rect = new Rect ( containingRect . x , containingRect . y , containingRect . width , 0 ) ;
109
-
110
110
for ( var index = 0 ; index < gitLockEntries . Count ; index ++ )
111
111
{
112
112
var entry = gitLockEntries [ index ] ;
113
113
114
114
var entryRect = new Rect ( rect . x , rect . y , rect . width , Styles . LocksEntryHeight ) ;
115
115
116
- var shouldRenderEntry = ! ( entryRect . y > endDisplay || entryRect . yMax < startDisplay ) ;
117
- if ( shouldRenderEntry )
116
+ if ( Event . current . type == EventType . Layout )
117
+ {
118
+ var shouldRenderEntry = ! ( entryRect . y > endDisplay || entryRect . yMax < startDisplay ) ;
119
+ visibleItems [ entry . GitLock . ID ] = shouldRenderEntry ;
120
+ }
121
+
122
+ if ( visibleItems [ entry . GitLock . ID ] )
118
123
{
119
124
entryRect = RenderEntry ( entryRect , entry ) ;
120
125
}
@@ -225,6 +230,7 @@ public void Load(List<GitLock> locks, List<GitStatusEntry> gitStatusEntries)
225
230
var scrollIndex = ( int ) ( scrollValue / Styles . LocksEntryHeight ) ;
226
231
227
232
assets . Clear ( ) ;
233
+ visibleItems . Clear ( ) ;
228
234
229
235
gitLockEntries = locks . Select ( gitLock =>
230
236
{
@@ -244,6 +250,7 @@ public void Load(List<GitLock> locks, List<GitStatusEntry> gitStatusEntries)
244
250
assets . Add ( assetGuid , gitLockEntry ) ;
245
251
}
246
252
253
+ visibleItems . Add ( gitLockEntry . GitLock . ID , false ) ;
247
254
return gitLockEntry ;
248
255
} ) . ToList ( ) ;
249
256
0 commit comments