mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-02 15:50:51 +08:00
临时提交
This commit is contained in:
@@ -33,7 +33,7 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
|
||||
|
||||
DiagramViewModels = new ObservableCollection<IDiagramViewModel>()
|
||||
{
|
||||
new DiagramViewModel(){Name= "页-1", DiagramType = diagramType, ZoomValue = 0.8},
|
||||
new DiagramViewModel(){Name= "页-1", DiagramType = diagramType},
|
||||
};
|
||||
DiagramViewModel = DiagramViewModels.FirstOrDefault();
|
||||
|
||||
|
||||
@@ -1896,13 +1896,13 @@
|
||||
<dd:DiagramControl x:Name="diagram" DataContext="{Binding .}" Margin="50"/>
|
||||
</DockPanel>
|
||||
</ScrollViewer>
|
||||
<!--<dd:ZoomBox x:Name="zoomBox"
|
||||
<dd:ZoomBox x:Name="zoomBox"
|
||||
Width="180"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
ScrollViewer="{Binding ElementName=designerScrollViewer}"
|
||||
ZoomValue="{Binding ZoomValue,Mode=TwoWay}"
|
||||
Margin="0,0,5,5" />-->
|
||||
Margin="0,0,5,5" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</TabControl.ContentTemplate>
|
||||
|
||||
@@ -24,24 +24,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty ScrollViewerProperty =
|
||||
DependencyProperty.Register(nameof(ScrollViewer), typeof(ScrollViewer), typeof(ZoomBox), new FrameworkPropertyMetadata(null,
|
||||
new PropertyChangedCallback(OnScrollViewerChanged)));
|
||||
|
||||
private static void OnScrollViewerChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
ZoomBox target = (ZoomBox)d;
|
||||
ScrollViewer oldvalue = (ScrollViewer)e.OldValue;
|
||||
ScrollViewer newvalue = (ScrollViewer)e.NewValue;
|
||||
target.OnScrollViewerChanged(oldvalue, newvalue);
|
||||
}
|
||||
|
||||
protected virtual void OnScrollViewerChanged(ScrollViewer oldvalue, ScrollViewer newvalue)
|
||||
{
|
||||
if (newvalue != null)
|
||||
{
|
||||
DesignerCanvas = VisualHelper.FindChild<DesignerCanvas>(newvalue);
|
||||
}
|
||||
}
|
||||
DependencyProperty.Register(nameof(ScrollViewer), typeof(ScrollViewer), typeof(ZoomBox));
|
||||
#endregion
|
||||
|
||||
#region DesignerCanvas
|
||||
@@ -154,8 +137,8 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
|
||||
double scale, xOffset, yOffset;
|
||||
this.InvalidateScale(out scale, out xOffset, out yOffset);
|
||||
this.zoomThumb.Width = this.ScrollViewer.ViewportWidth * scale;
|
||||
this.zoomThumb.Height = this.ScrollViewer.ViewportHeight * scale;
|
||||
this.zoomThumb.Width = (this.ScrollViewer.ViewportWidth) * scale;
|
||||
this.zoomThumb.Height = (this.ScrollViewer.ViewportHeight) * scale;
|
||||
Canvas.SetLeft(this.zoomThumb, xOffset + this.ScrollViewer.HorizontalOffset * scale);
|
||||
Canvas.SetTop(this.zoomThumb, yOffset + this.ScrollViewer.VerticalOffset * scale);
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@
|
||||
Name="PART_ZoomCanvas">
|
||||
<Canvas.Background>
|
||||
<VisualBrush Stretch="Uniform"
|
||||
Visual="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=DesignerCanvas}" />
|
||||
Visual="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ScrollViewer.Content}" />
|
||||
</Canvas.Background>
|
||||
<Thumb Name="PART_ZoomThumb"
|
||||
Cursor="SizeAll">
|
||||
@@ -205,34 +205,24 @@
|
||||
<Expander.Header>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Slider Name="PART_ZoomSlider"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0"
|
||||
Ticks="0.25,0.50,0.75,1,1.25,1.50,2.00,3.00,4.00,5.00"
|
||||
Minimum="0.25"
|
||||
Maximum="5"
|
||||
SmallChange="0.25"
|
||||
LargeChange="0.25"
|
||||
Value="{Binding ZoomValue,RelativeSource={RelativeSource Mode=TemplatedParent},Mode=TwoWay}"
|
||||
MinWidth="104"
|
||||
MinHeight="21"
|
||||
Value="{Binding ZoomValue,RelativeSource={RelativeSource Mode=TemplatedParent},Mode=TwoWay}"
|
||||
IsSnapToTickEnabled="True"
|
||||
IsMoveToPointEnabled="False" />
|
||||
|
||||
<TextBlock Text="{Binding ElementName=PART_ZoomSlider, Path=Value}"
|
||||
<TextBlock Text="{Binding ElementName=PART_ZoomSlider, Path=Value, StringFormat={}{0:P}}"
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0,0,14,0" />
|
||||
<TextBlock Text="%"
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="1,0,2,0" />
|
||||
Margin="0,0,2,0" />
|
||||
</Grid>
|
||||
</Expander.Header>
|
||||
</Expander>
|
||||
|
||||
23
AIStudio.Wpf.Mind/MindType.cs
Normal file
23
AIStudio.Wpf.Mind/MindType.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
|
||||
namespace AIStudio.Wpf.Mind
|
||||
{
|
||||
public enum MindType
|
||||
{
|
||||
[Description("思维导图")]
|
||||
Mind,
|
||||
[Description("目录组织图")]
|
||||
Directory,
|
||||
[Description("鱼骨头图")]
|
||||
FishBone,
|
||||
[Description("逻辑结构图")]
|
||||
Logical,
|
||||
[Description("组织结构图")]
|
||||
Organizational,
|
||||
[Description("天盘图")]
|
||||
Celestial
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using AIStudio.Wpf.DiagramDesigner;
|
||||
using AIStudio.Wpf.DiagramDesigner.Geometrys;
|
||||
using AIStudio.Wpf.DiagramDesigner.Models;
|
||||
|
||||
namespace AIStudio.Wpf.Mind.ViewModels
|
||||
@@ -55,6 +57,10 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class MindLevel1Node : MindNode
|
||||
@@ -78,6 +84,24 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void LayoutUpdated()
|
||||
{
|
||||
foreach(var child in Children)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public RectangleBase Rectangle
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public RectangleBase GetChildRectangle()
|
||||
{
|
||||
//Children.Select(p => p.Size)
|
||||
}
|
||||
}
|
||||
|
||||
public class MindLevel2Node : MindNode
|
||||
@@ -101,6 +125,11 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public PointBase Offset
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
}
|
||||
|
||||
public class MindLevel3Node : MindNode
|
||||
@@ -124,5 +153,10 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public PointBase Offset
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project>
|
||||
<!-- Project properties -->
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp3.1;net461;net5.0-windows</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp3.1;net5.0-windows</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
|
||||
Reference in New Issue
Block a user