node position
This commit is contained in:
parent
029ee6515d
commit
5ec5d749c3
8
Assets/AsmdefHelper/DependencyGraph/Editor/NodeView.meta
Normal file
8
Assets/AsmdefHelper/DependencyGraph/Editor/NodeView.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 317ec7aeddbdec848819fcfcfcb8becb
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,5 @@
|
||||
namespace AsmdefHelper.DependencyGraph.Editor.NodeView {
|
||||
public interface INodeView : IRect {
|
||||
string Label { set; get; }
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 95c599809404452380ee0c65390284e4
|
||||
timeCreated: 1605457329
|
23
Assets/AsmdefHelper/DependencyGraph/Editor/NodeView/IRect.cs
Normal file
23
Assets/AsmdefHelper/DependencyGraph/Editor/NodeView/IRect.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace AsmdefHelper.DependencyGraph.Editor.NodeView {
|
||||
public interface IRect {
|
||||
float PositionX { set; get; }
|
||||
float PositionY { set; get; }
|
||||
float Height { get; }
|
||||
float Width { get; }
|
||||
}
|
||||
|
||||
public static class ViewExtension {
|
||||
public static Vector2 GetPositionXY(this IRect rect) {
|
||||
return new Vector2(rect.PositionX, rect.PositionY);
|
||||
}
|
||||
public static void SetPositionXY(this IRect rect, Vector2 pos) {
|
||||
rect.PositionX = pos.x;
|
||||
rect.PositionY = pos.y;
|
||||
}
|
||||
public static Rect AsRect(this IRect rect) {
|
||||
return new Rect(rect.PositionX, rect.PositionY, rect.Width, rect.Height);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3ba20ae9f4964efaa46e9fd6f83dd819
|
||||
timeCreated: 1605458617
|
@ -0,0 +1,25 @@
|
||||
using UnityEditor.Graphs;
|
||||
|
||||
namespace AsmdefHelper.DependencyGraph.Editor.NodeView {
|
||||
public class UiElementsNodeView : Node, INodeView {
|
||||
|
||||
string INodeView.Label {
|
||||
get => title;
|
||||
set => title = value;
|
||||
}
|
||||
|
||||
float IRect.PositionX {
|
||||
get => position.x;
|
||||
set => position.x = value;
|
||||
}
|
||||
|
||||
float IRect.PositionY {
|
||||
get => position.y;
|
||||
set => position.y = value;
|
||||
}
|
||||
|
||||
float IRect.Height => position.height;
|
||||
|
||||
float IRect.Width => position.width;
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fc7014a6a7494dbcbc43466c7dbcdffa
|
||||
timeCreated: 1605457452
|
Loading…
x
Reference in New Issue
Block a user