您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
32 行
776 B
32 行
776 B
using UnityEngine;
|
|
using UnityEngine.Experimental.UIElements;
|
|
using System;
|
|
|
|
namespace UnityEditor.ShaderGraph.Drawing
|
|
{
|
|
public 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();
|
|
}
|
|
}
|
|
}
|