You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
753 B
32 lines
753 B
using UnityEngine;
|
|
using System;
|
|
using UnityEngine.UIElements;
|
|
|
|
namespace UnityEditor.ShaderGraph.Drawing
|
|
{
|
|
class Scrollable : MouseManipulator
|
|
{
|
|
Action<float> m_Handler;
|
|
|
|
public Scrollable(Action<float> handler)
|
|
{
|
|
m_Handler = handler;
|
|
}
|
|
|
|
protected override void RegisterCallbacksOnTarget()
|
|
{
|
|
target.RegisterCallback<WheelEvent>(HandleMouseWheelEvent);
|
|
}
|
|
|
|
protected override void UnregisterCallbacksFromTarget()
|
|
{
|
|
target.UnregisterCallback<WheelEvent>(HandleMouseWheelEvent);
|
|
}
|
|
|
|
void HandleMouseWheelEvent(WheelEvent evt)
|
|
{
|
|
m_Handler(evt.delta.y);
|
|
evt.StopPropagation();
|
|
}
|
|
}
|
|
}
|