mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-03 00:00:57 +08:00
修改暂存一下
This commit is contained in:
@@ -7,7 +7,7 @@ using System.Windows;
|
||||
using System.Linq;
|
||||
using System.Reactive.Linq;
|
||||
using AIStudio.Wpf.DiagramDesigner.Models;
|
||||
using AIStudio.Wpf.DiagramDesigner.Geometry;
|
||||
using AIStudio.Wpf.DiagramDesigner.Geometrys;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
@@ -15,14 +15,17 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
public DesignerItemViewModelBase() : base()
|
||||
{
|
||||
ShapeDefiner = Shapes.Rectangle;
|
||||
}
|
||||
|
||||
public DesignerItemViewModelBase(IDiagramViewModel parent, DesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
ShapeDefiner = Shapes.Rectangle;
|
||||
}
|
||||
|
||||
public DesignerItemViewModelBase(IDiagramViewModel parent, string json) : base(parent, json)
|
||||
{
|
||||
ShapeDefiner = Shapes.Rectangle;
|
||||
}
|
||||
|
||||
protected override void Init()
|
||||
@@ -415,21 +418,23 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
public RectangleBase GetBounds(bool includePorts = false)
|
||||
{
|
||||
if (!includePorts)
|
||||
return new RectangleBase(Left, Top, ItemWidth, ItemHeight);
|
||||
return new RectangleBase(Position, Size);
|
||||
|
||||
var leftPort = LeftConnector;
|
||||
var topPort = TopConnector;
|
||||
var rightPort = RightConnector;
|
||||
var bottomPort = BottomConnector;
|
||||
|
||||
var left = leftPort == null ? Left: Math.Min(Left, leftPort.Position.X);
|
||||
var top = topPort == null ? Top : Math.Min(Left, topPort.Position.Y);
|
||||
var right = rightPort == null ? Left + ItemWidth :
|
||||
Math.Max(rightPort.Position.X + rightPort.ConnectorWidth, Left + ItemWidth);
|
||||
var bottom = bottomPort == null ? Top + ItemHeight :
|
||||
Math.Max(bottomPort.Position.Y + bottomPort.ConnectorHeight, Top + ItemHeight);
|
||||
var left = leftPort == null ? Position.X: Math.Min(Position.X, leftPort.Location.Position.X);
|
||||
var top = topPort == null ? Position.Y : Math.Min(Position.Y, topPort.Location.Position.Y);
|
||||
var right = rightPort == null ? Position.X + ItemWidth :
|
||||
Math.Max(rightPort.Location.Position.X + rightPort.ConnectorWidth, Position.X + ItemWidth);
|
||||
var bottom = bottomPort == null ? Position.Y + ItemHeight :
|
||||
Math.Max(bottomPort.Location.Position.Y + bottomPort.ConnectorHeight, Position.Y + ItemHeight);
|
||||
|
||||
return new RectangleBase(left, top, right, bottom);
|
||||
return new RectangleBase(left, top, right, bottom, true);
|
||||
}
|
||||
|
||||
public IShape GetShape() => ShapeDefiner(this);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user