node position

This commit is contained in:
naninunenoy 2020-11-16 01:56:27 +09:00
parent 029ee6515d
commit 5ec5d749c3
7 changed files with 70 additions and 0 deletions

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 317ec7aeddbdec848819fcfcfcb8becb
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,5 @@
namespace AsmdefHelper.DependencyGraph.Editor.NodeView {
public interface INodeView : IRect {
string Label { set; get; }
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 95c599809404452380ee0c65390284e4
timeCreated: 1605457329

View 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);
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3ba20ae9f4964efaa46e9fd6f83dd819
timeCreated: 1605458617

View File

@ -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;
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: fc7014a6a7494dbcbc43466c7dbcdffa
timeCreated: 1605457452