mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-03 00:00:57 +08:00
适应窗口大小完成
This commit is contained in:
@@ -408,7 +408,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
}
|
||||
|
||||
private double _maximumZoomValue = 3;
|
||||
private double _maximumZoomValue = 100;
|
||||
[Browsable(false)]
|
||||
public double MaximumZoomValue
|
||||
{
|
||||
@@ -422,7 +422,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
}
|
||||
|
||||
private double _minimumZoomValue = 0.5;
|
||||
private double _minimumZoomValue = 0.01;
|
||||
[Browsable(false)]
|
||||
public double MinimumZoomValue
|
||||
{
|
||||
@@ -463,6 +463,19 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
}
|
||||
|
||||
private FitViewModel _fitViewModel;
|
||||
public FitViewModel FitViewModel
|
||||
{
|
||||
get
|
||||
{
|
||||
return _fitViewModel;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _fitViewModel, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string _name;
|
||||
[Browsable(false)]
|
||||
public string Name
|
||||
@@ -561,6 +574,26 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
}
|
||||
|
||||
protected ObservableCollection<CinchMenuItem> menuOptions;
|
||||
public IEnumerable<CinchMenuItem> MenuOptions
|
||||
{
|
||||
get
|
||||
{
|
||||
return menuOptions;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShowMenuOptions
|
||||
{
|
||||
get
|
||||
{
|
||||
if (MenuOptions == null || MenuOptions.Count() == 0)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public DiagramOption DiagramOption
|
||||
{
|
||||
get; set;
|
||||
@@ -739,7 +772,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
|
||||
private SimpleCommand _selectAllCommand;
|
||||
public virtual SimpleCommand SelectAllCommand
|
||||
public SimpleCommand SelectAllCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -748,7 +781,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
|
||||
private SimpleCommand _selectInverseCommand;
|
||||
public virtual SimpleCommand SelectInverseCommand
|
||||
public SimpleCommand SelectInverseCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -882,6 +915,33 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _fitAutoCommand;
|
||||
public SimpleCommand FitAutoCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._fitAutoCommand ?? (this._fitAutoCommand = new SimpleCommand(ExecuteEnable, ExecuteFitAutoCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _fitWidthCommand;
|
||||
public SimpleCommand FitWidthCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._fitWidthCommand ?? (this._fitWidthCommand = new SimpleCommand(ExecuteEnable, ExecuteFitWidthCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _fitHeightCommand;
|
||||
public SimpleCommand FitHeightCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._fitHeightCommand ?? (this._fitHeightCommand = new SimpleCommand(ExecuteEnable, ExecuteFitHeightCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _groupCommand;
|
||||
public SimpleCommand GroupCommand
|
||||
{
|
||||
@@ -991,6 +1051,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
AllowDrop = diagramItem.AllowDrop;
|
||||
|
||||
Init();
|
||||
BuildMenuOptions();
|
||||
}
|
||||
|
||||
public virtual void Init()
|
||||
@@ -1003,6 +1064,18 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
return IsReadOnly == false;
|
||||
}
|
||||
|
||||
#region 菜单
|
||||
private void BuildMenuOptions()
|
||||
{
|
||||
menuOptions = new ObservableCollection<CinchMenuItem>();
|
||||
CinchMenuItem menuItem = new CinchMenuItem();
|
||||
menuItem.Text = "居中";
|
||||
menuItem.Command = CenterMoveCommand;
|
||||
menuItem.CommandParameter = this;
|
||||
menuOptions.Add(menuItem);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region UnDo ReDo
|
||||
|
||||
private void Do(object sender, string propertyName, object newvalue)
|
||||
@@ -2250,7 +2323,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecuteCenterMoveCommand(object parameter)
|
||||
protected virtual void ExecuteCenterMoveCommand(object parameter)
|
||||
{
|
||||
IEnumerable<DesignerItemViewModelBase> selectedItems;
|
||||
if (parameter is IEnumerable<DesignerItemViewModelBase> para)
|
||||
@@ -2267,6 +2340,8 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
item.Left = (PageSize.Width - item.ItemWidth) / 2;
|
||||
item.Top = (PageSize.Height - item.ItemHeight) / 2;
|
||||
}
|
||||
|
||||
FitViewModel = new FitViewModel() { BoundingRect = DiagramViewModelHelper.GetBoundingRectangle(selectedItems) };
|
||||
}
|
||||
|
||||
public void UpdateZIndex()
|
||||
@@ -2329,6 +2404,23 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
|
||||
#endregion
|
||||
|
||||
#region 适应大小
|
||||
private void ExecuteFitAutoCommand(object parameter)
|
||||
{
|
||||
FitViewModel = new FitViewModel() { BoundingRect = DiagramViewModelHelper.GetBoundingRectangle(Items.OfType<DesignerItemViewModelBase>()), FitMode = FitMode.FitAuto };
|
||||
}
|
||||
|
||||
private void ExecuteFitWidthCommand(object parameter)
|
||||
{
|
||||
FitViewModel = new FitViewModel() { BoundingRect = DiagramViewModelHelper.GetBoundingRectangle(Items.OfType<DesignerItemViewModelBase>()), FitMode = FitMode.FitWidth };
|
||||
}
|
||||
|
||||
private void ExecuteFitHeightCommand(object parameter)
|
||||
{
|
||||
FitViewModel = new FitViewModel() { BoundingRect = DiagramViewModelHelper.GetBoundingRectangle(Items.OfType<DesignerItemViewModelBase>()), FitMode = FitMode.FitHeight };
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 分组
|
||||
private void ExecuteGroupCommand(object parameter)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user