|
Post by stefan on Jan 18, 2021 17:56:07 GMT
Hey,
I've wanted to scroll a list with one cell in it to a position well within its length. The value was clamped by the follwing line (EnhancedScoller.cs:336):
value = Mathf.Clamp(value, 0, GetScrollPositionForCellViewIndex(_cellViewSizeArray.Count - 1, CellViewPositionEnum.Begin));
Seems to me this should be
value = Mathf.Clamp(value, 0, GetScrollPositionForCellViewIndex(_cellViewSizeArray.Count - 1, CellViewPositionEnum.After));
Cheers, Stefan
|
|
|
Post by stefan on Jan 19, 2021 14:56:49 GMT
And the same again in Line 1984:
_scrollPosition = Mathf.Clamp(_scrollPosition, 0, GetScrollPositionForCellViewIndex(_cellViewSizeArray.Count - 1, CellViewPositionEnum.After));
|
|
|
Post by echo17 on Jan 20, 2021 14:22:08 GMT
Thanks for the bug report, you are correct. You will also need to change line 971 for the jump to work without looping. I'll get these updates into the next release.
|
|
|
Post by stefan on Jan 21, 2021 17:43:17 GMT
Pleasure. Good that you found another spot
|
|
|
Post by firerabbit on Feb 4, 2021 20:28:36 GMT
Hmm, after updating to latest version I'm getting an exception from this same line (Mathf.Clamp) on one of my scrollers. Had to change: public T this[int i] { get { return data[i]; } set { data[i] = value; } } To: public T this[int i] { get { if( data is null ) { return default( T ); } else { return data[i]; } }
set { data[i] = value; } } Never had this problem before the update. Everything is working again after I made this change to your code. My EnhancedScroller that was throwing the exception had only one row in the Prefab that is cloned vertically. My EnhancedScroller that was working even before the above code update was also a vertical scroller, but had 5 columns. Not sure if that helps? Great product otherwise, echo17 !
|
|
|
Post by echo17 on Feb 5, 2021 9:13:30 GMT
Interesting. Not sure why this is happening, but the code change is definitely worth implementing. I've added it to the newest release. Thanks!
|
|
|
Post by firerabbit on Feb 5, 2021 14:41:59 GMT
Interesting. Not sure why this is happening, but the code change is definitely worth implementing. I've added it to the newest release. Thanks! Thanks for the super fast update, now I'm back on baseline. Cheers.
|
|