浏览代码

Add callback in WindowDraggable to notify when the mouse button is released

/main
Jens Holm 7 年前
当前提交
d51ff20e
共有 2 个文件被更改,包括 14 次插入6 次删除
  1. 8
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/MasterPreviewView.cs
  2. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Manipulators/WindowDraggable.cs

8
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/MasterPreviewView.cs


using System.Collections;
using System;
using System.Collections;
using Object = UnityEngine.Object;
namespace UnityEditor.ShaderGraph.Drawing.Inspector
{

bottomContainer.Add(m_PreviewMeshPicker);
}
Add(bottomContainer);
Add(new ResizeBorderFrame(this) { name = "resizeBorderFrame"});
this.AddManipulator(new WindowDraggable());
}
MasterNode masterNode

12
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Manipulators/WindowDraggable.cs


using System.Collections;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Experimental.UIElements;

Vector2 m_LocalMosueOffset;
Rect m_PreviousParentRect;
public Action OnDragFinished;
public WindowDraggable(bool resizeWithParentwindow = false)
{

void OnMouseUp(MouseUpEvent evt)
{
bool emitDragFinishedEvent = m_Active;
m_Active = false;
if (target.HasMouseCapture())

evt.StopPropagation();
RefreshDocking();
if (emitDragFinishedEvent && OnDragFinished != null)
{
OnDragFinished();
}
}
void RefreshDocking()

正在加载...
取消
保存