update
This commit is contained in:
@@ -22,8 +22,8 @@ namespace Ichni.Menu
|
||||
|
||||
[Title("对齐与动画")]
|
||||
[SerializeField] public RectTransform centerPoint;
|
||||
[SerializeField] private float snapSpeed = 5f;
|
||||
[SerializeField] private float decelerationRate = 0.135f;
|
||||
[SerializeField] private float snapSpeed = 10f;
|
||||
[SerializeField] private float decelerationRate = 0.15f;
|
||||
|
||||
[Title("平滑度优化")]
|
||||
[SerializeField] [Range(1f, 20f)]
|
||||
@@ -263,7 +263,10 @@ namespace Ichni.Menu
|
||||
selectedTab?.SetSelection(false);
|
||||
selectedTab = null; // 清除当前选中的Tab
|
||||
|
||||
if(isDuringSnap && SnapCoroutine != null) StopCoroutine(SnapCoroutine);
|
||||
if (isDuringSnap && SnapCoroutine != null)
|
||||
{
|
||||
StopCoroutine(SnapCoroutine);
|
||||
}
|
||||
|
||||
SnapCoroutine = SnapToItem(tab.GetComponent<RectTransform>(), false);
|
||||
|
||||
@@ -289,8 +292,7 @@ namespace Ichni.Menu
|
||||
Vector3 closestItemLocalPos = viewport.InverseTransformPoint(targetItem.position);
|
||||
Vector3 centerPointLocalPos = viewport.InverseTransformPoint(centerPoint.position);
|
||||
float localOffsetY = centerPointLocalPos.y - closestItemLocalPos.y;
|
||||
|
||||
// 【核心修正 #3】吸附动画现在也是通过更新targetPosition来实现
|
||||
|
||||
Vector2 finalTargetPosition = content.anchoredPosition + new Vector2(0, localOffsetY);
|
||||
finalTargetPosition.y = Mathf.Clamp(finalTargetPosition.y, bottomBound, topBound);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user