Unity graph tool solution based on different implementation now focused on Unity.Experimental.Graphview
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.3 KiB

using TNode.TNodeCore.Editor.Models;
using TNodeCore.Editor.Models;
using UnityEditor.Experimental.GraphView;
using UnityEngine;
using UnityEngine.UIElements;
namespace TNodeGraphViewImpl.Editor.Placemats{
public class PlacematView:Placemat{
public PlacematModel PlacematModel{
get => _placematModel;
set{
_placematModel = value;
UpdatePlacematData();
}
}
private PlacematModel _placematModel;
public int zOrder {get;set;}
public PlacematView(){
var title = this.Q<TextField>();
title.RegisterValueChangedCallback(evt => {
PlacematModel.title = title.value;
});
}
public virtual void UpdatePlacematData(){
SetPosition(_placematModel.positionInView);
this.Color = new Color(43/255.0f, 72/255.0f, 101/255.0f);
}
public sealed override void SetPosition(Rect newPos){
base.SetPosition(newPos);
if (_placematModel == null){
return;
}
_placematModel.positionInView = newPos;
}
public virtual void Collapse(){
this.Collapsed = true;
}
}
}