mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-02 23:26:35 +08:00
mind
This commit is contained in:
@@ -8,16 +8,21 @@ using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Xml.Linq;
|
||||
using AIStudio.Wpf.DiagramDesigner;
|
||||
using AIStudio.Wpf.DiagramDesigner.Algorithms;
|
||||
using AIStudio.Wpf.DiagramDesigner.Geometrys;
|
||||
using AIStudio.Wpf.DiagramDesigner.Helpers;
|
||||
using AIStudio.Wpf.DiagramDesigner.Models;
|
||||
using AIStudio.Wpf.DiagramModels;
|
||||
using AIStudio.Wpf.DiagramModels.ViewModels;
|
||||
using AIStudio.Wpf.Flowchart.Models;
|
||||
using AIStudio.Wpf.Mind.Helpers;
|
||||
using AIStudio.Wpf.Mind.Models;
|
||||
|
||||
namespace AIStudio.Wpf.Mind.ViewModels
|
||||
{
|
||||
public class MindNode : DesignerItemViewModelBase
|
||||
public class MindNode : DiagramItemViewModel
|
||||
{
|
||||
public MindNode(NodeLevel nodeLevel, MindType mindType = MindType.Mind) : this(null, nodeLevel, mindType)
|
||||
{
|
||||
@@ -42,6 +47,11 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
InitLayout();
|
||||
}
|
||||
|
||||
public override SelectableItemBase GetSerializableObject()
|
||||
{
|
||||
return new MindNodeDesignerItem(this);
|
||||
}
|
||||
|
||||
protected override void Init(IDiagramViewModel root)
|
||||
{
|
||||
base.Init(root);
|
||||
@@ -65,6 +75,35 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
MindLayout = layout != null ? (System.Activator.CreateInstance(layout) as IMindLayout) : new MindLayout();
|
||||
}
|
||||
|
||||
protected override void LoadDesignerItemViewModel(SelectableItemBase designerbase)
|
||||
{
|
||||
base.LoadDesignerItemViewModel(designerbase);
|
||||
|
||||
if (designerbase is MindNodeDesignerItem designer)
|
||||
{
|
||||
NodeLevel = designer.NodeLevel;
|
||||
MindType = designer.MindType;
|
||||
Spacing = designer.Spacing;
|
||||
Offset = designer.Offset;
|
||||
IsExpanded = designer.IsExpanded;
|
||||
}
|
||||
}
|
||||
|
||||
public override DiagramNode ToDiagram()
|
||||
{
|
||||
var mindNodeModel = new MindNodeModel();
|
||||
|
||||
mindNodeModel.NodeLevel = NodeLevel;
|
||||
mindNodeModel.MindType = MindType;
|
||||
mindNodeModel.Spacing = Spacing;
|
||||
mindNodeModel.Offset = Offset;
|
||||
mindNodeModel.IsExpanded = IsExpanded;
|
||||
|
||||
return mindNodeModel;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private bool Level_Enable(object obj)
|
||||
{
|
||||
@@ -103,33 +142,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
{
|
||||
SetProperty(ref _mindType, value);
|
||||
}
|
||||
}
|
||||
|
||||
private CornerRadius _cornerRadius = new CornerRadius(3);
|
||||
public CornerRadius CornerRadius
|
||||
{
|
||||
get
|
||||
{
|
||||
return _cornerRadius;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _cornerRadius, value);
|
||||
}
|
||||
}
|
||||
|
||||
private Thickness _borderThickness = new Thickness(1);
|
||||
public Thickness BorderThickness
|
||||
{
|
||||
get
|
||||
{
|
||||
return _borderThickness;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _borderThickness, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isExpanded = true;
|
||||
public bool IsExpanded
|
||||
|
||||
Reference in New Issue
Block a user