mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-01-07 18:13:35 +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>();
|
var scrollRect = mainObj.AddComponent<ScrollRect>();
|
||||||
scrollRect.movementType = ScrollRect.MovementType.Clamped;
|
scrollRect.movementType = ScrollRect.MovementType.Clamped;
|
||||||
scrollRect.inertia = false;
|
scrollRect.inertia = true;
|
||||||
|
scrollRect.elasticity = 0.125f;
|
||||||
scrollRect.scrollSensitivity = 15;
|
scrollRect.scrollSensitivity = 15;
|
||||||
scrollRect.horizontal = false;
|
scrollRect.horizontal = false;
|
||||||
scrollRect.vertical = true;
|
scrollRect.vertical = true;
|
||||||
|
@ -5,6 +5,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using UnityExplorer.Core.Input;
|
||||||
using UnityExplorer.UI.Models;
|
using UnityExplorer.UI.Models;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Widgets
|
namespace UnityExplorer.UI.Widgets
|
||||||
@ -350,6 +351,9 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
if (WritingLocked)
|
if (WritingLocked)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (InputManager.MouseScrollDelta != Vector2.zero)
|
||||||
|
ScrollRect.StopMovement();
|
||||||
|
|
||||||
if (!SetRecycleViewBounds(true))
|
if (!SetRecycleViewBounds(true))
|
||||||
RefreshCells();
|
RefreshCells();
|
||||||
|
|
||||||
@ -506,6 +510,8 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
return;
|
return;
|
||||||
this.WritingLocked = true;
|
this.WritingLocked = true;
|
||||||
|
|
||||||
|
ScrollRect.StopMovement();
|
||||||
|
|
||||||
// normalize the scroll position for the scroll bounds.
|
// normalize the scroll position for the scroll bounds.
|
||||||
// this translates the value into saying "point at the center of the height of the viewport"
|
// this translates the value into saying "point at the center of the height of the viewport"
|
||||||
var scrollHeight = NormalizedScrollBounds.y - NormalizedScrollBounds.x;
|
var scrollHeight = NormalizedScrollBounds.y - NormalizedScrollBounds.x;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user