浏览代码

Add scrollable manipulator

/main
Jens Holm 7 年前
当前提交
f7c18c9a
共有 2 个文件被更改,包括 45 次插入0 次删除
  1. 34
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Manipulators/Scrollable.cs
  2. 11
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Manipulators/Scrollable.cs.meta

34
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Manipulators/Scrollable.cs


using System.Collections;
using System.Collections.Generic;
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();
}
}
}

11
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Manipulators/Scrollable.cs.meta


fileFormatVersion: 2
guid: 9ea23c5e75fdbea49824261efe5fc133
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存