mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-01-06 01:23:31 +08:00
Add elasticity to ScrollPool, stop movement on mouse scroll or slider change
This commit is contained in:
parent
31fa786574
commit
fc26452f64
@ -752,7 +752,8 @@ namespace UnityExplorer.UI
|
||||
|
||||
var scrollRect = mainObj.AddComponent<ScrollRect>();
|
||||
scrollRect.movementType = ScrollRect.MovementType.Clamped;
|
||||
scrollRect.inertia = false;
|
||||
scrollRect.inertia = true;
|
||||
scrollRect.elasticity = 0.125f;
|
||||
scrollRect.scrollSensitivity = 15;
|
||||
scrollRect.horizontal = false;
|
||||
scrollRect.vertical = true;
|
||||
|
@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityExplorer.Core.Input;
|
||||
using UnityExplorer.UI.Models;
|
||||
|
||||
namespace UnityExplorer.UI.Widgets
|
||||
@ -350,6 +351,9 @@ namespace UnityExplorer.UI.Widgets
|
||||
if (WritingLocked)
|
||||
return;
|
||||
|
||||
if (InputManager.MouseScrollDelta != Vector2.zero)
|
||||
ScrollRect.StopMovement();
|
||||
|
||||
if (!SetRecycleViewBounds(true))
|
||||
RefreshCells();
|
||||
|
||||
@ -506,6 +510,8 @@ namespace UnityExplorer.UI.Widgets
|
||||
return;
|
||||
this.WritingLocked = true;
|
||||
|
||||
ScrollRect.StopMovement();
|
||||
|
||||
// normalize the scroll position for the scroll bounds.
|
||||
// this translates the value into saying "point at the center of the height of the viewport"
|
||||
var scrollHeight = NormalizedScrollBounds.y - NormalizedScrollBounds.x;
|
||||
|
Loading…
x
Reference in New Issue
Block a user