From 5cebd6cdfe2761f2f9b68ee29a1c094c119ef972 Mon Sep 17 00:00:00 2001 From: Simon Jackson Date: Sun, 2 Jul 2017 14:44:23 +0100 Subject: [PATCH] Adopts fix from #148 Scroll To improved Large list support Resolves #148 --- Scripts/Utilities/UIScrollToSelection.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Scripts/Utilities/UIScrollToSelection.cs b/Scripts/Utilities/UIScrollToSelection.cs index 0b8a73c..a60b29d 100644 --- a/Scripts/Utilities/UIScrollToSelection.cs +++ b/Scripts/Utilities/UIScrollToSelection.cs @@ -203,9 +203,9 @@ namespace UnityEngine.UI.Extensions private float GetScrollOffset(float position, float listAnchorPosition, float targetLength, float maskLength) { - if (position < listAnchorPosition) + if (position < listAnchorPosition + (targetLength / 2)) { - return listAnchorPosition - position; + return (listAnchorPosition + maskLength) - (position - targetLength); } else if (position + targetLength > listAnchorPosition + maskLength) {