临时提交

This commit is contained in:
kwai
2023-02-14 18:58:26 +08:00
parent dfe76438c2
commit d6e84d40c0
7 changed files with 69 additions and 39 deletions

View File

@@ -33,7 +33,7 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
DiagramViewModels = new ObservableCollection<IDiagramViewModel>() DiagramViewModels = new ObservableCollection<IDiagramViewModel>()
{ {
new DiagramViewModel(){Name= "页-1", DiagramType = diagramType, ZoomValue = 0.8}, new DiagramViewModel(){Name= "页-1", DiagramType = diagramType},
}; };
DiagramViewModel = DiagramViewModels.FirstOrDefault(); DiagramViewModel = DiagramViewModels.FirstOrDefault();

View File

@@ -1896,13 +1896,13 @@
<dd:DiagramControl x:Name="diagram" DataContext="{Binding .}" Margin="50"/> <dd:DiagramControl x:Name="diagram" DataContext="{Binding .}" Margin="50"/>
</DockPanel> </DockPanel>
</ScrollViewer> </ScrollViewer>
<!--<dd:ZoomBox x:Name="zoomBox" <dd:ZoomBox x:Name="zoomBox"
Width="180" Width="180"
HorizontalAlignment="Right" HorizontalAlignment="Right"
VerticalAlignment="Bottom" VerticalAlignment="Bottom"
ScrollViewer="{Binding ElementName=designerScrollViewer}" ScrollViewer="{Binding ElementName=designerScrollViewer}"
ZoomValue="{Binding ZoomValue,Mode=TwoWay}" ZoomValue="{Binding ZoomValue,Mode=TwoWay}"
Margin="0,0,5,5" />--> Margin="0,0,5,5" />
</Grid> </Grid>
</DataTemplate> </DataTemplate>
</TabControl.ContentTemplate> </TabControl.ContentTemplate>

View File

@@ -24,24 +24,7 @@ namespace AIStudio.Wpf.DiagramDesigner
} }
public static readonly DependencyProperty ScrollViewerProperty = public static readonly DependencyProperty ScrollViewerProperty =
DependencyProperty.Register(nameof(ScrollViewer), typeof(ScrollViewer), typeof(ZoomBox), new FrameworkPropertyMetadata(null, DependencyProperty.Register(nameof(ScrollViewer), typeof(ScrollViewer), typeof(ZoomBox));
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);
}
}
#endregion #endregion
#region DesignerCanvas #region DesignerCanvas
@@ -154,8 +137,8 @@ namespace AIStudio.Wpf.DiagramDesigner
double scale, xOffset, yOffset; double scale, xOffset, yOffset;
this.InvalidateScale(out scale, out xOffset, out yOffset); this.InvalidateScale(out scale, out xOffset, out yOffset);
this.zoomThumb.Width = this.ScrollViewer.ViewportWidth * scale; this.zoomThumb.Width = (this.ScrollViewer.ViewportWidth) * scale;
this.zoomThumb.Height = this.ScrollViewer.ViewportHeight * scale; this.zoomThumb.Height = (this.ScrollViewer.ViewportHeight) * scale;
Canvas.SetLeft(this.zoomThumb, xOffset + this.ScrollViewer.HorizontalOffset * scale); Canvas.SetLeft(this.zoomThumb, xOffset + this.ScrollViewer.HorizontalOffset * scale);
Canvas.SetTop(this.zoomThumb, yOffset + this.ScrollViewer.VerticalOffset * scale); Canvas.SetTop(this.zoomThumb, yOffset + this.ScrollViewer.VerticalOffset * scale);
} }

View File

@@ -181,7 +181,7 @@
Name="PART_ZoomCanvas"> Name="PART_ZoomCanvas">
<Canvas.Background> <Canvas.Background>
<VisualBrush Stretch="Uniform" <VisualBrush Stretch="Uniform"
Visual="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=DesignerCanvas}" /> Visual="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ScrollViewer.Content}" />
</Canvas.Background> </Canvas.Background>
<Thumb Name="PART_ZoomThumb" <Thumb Name="PART_ZoomThumb"
Cursor="SizeAll"> Cursor="SizeAll">
@@ -205,34 +205,24 @@
<Expander.Header> <Expander.Header>
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Slider Name="PART_ZoomSlider" <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" Ticks="0.25,0.50,0.75,1,1.25,1.50,2.00,3.00,4.00,5.00"
Minimum="0.25" Minimum="0.25"
Maximum="5" Maximum="5"
SmallChange="0.25" SmallChange="0.25"
LargeChange="0.25" LargeChange="0.25"
Value="{Binding ZoomValue,RelativeSource={RelativeSource Mode=TemplatedParent},Mode=TwoWay}" Value="{Binding ZoomValue,RelativeSource={RelativeSource Mode=TemplatedParent},Mode=TwoWay}"
MinWidth="104"
MinHeight="21"
IsSnapToTickEnabled="True" IsSnapToTickEnabled="True"
IsMoveToPointEnabled="False" /> IsMoveToPointEnabled="False" />
<TextBlock Text="{Binding ElementName=PART_ZoomSlider, Path=Value}" <TextBlock Text="{Binding ElementName=PART_ZoomSlider, Path=Value, StringFormat={}{0:P}}"
Grid.Column="1" Grid.Column="1"
VerticalAlignment="Center" VerticalAlignment="Center"
HorizontalAlignment="Right" HorizontalAlignment="Right"
Margin="0,0,14,0" /> Margin="0,0,2,0" />
<TextBlock Text="%"
Grid.Column="1"
VerticalAlignment="Center"
HorizontalAlignment="Right"
Margin="1,0,2,0" />
</Grid> </Grid>
</Expander.Header> </Expander.Header>
</Expander> </Expander>

View 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
}
}

View File

@@ -1,8 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Linq;
using System.Text; using System.Text;
using AIStudio.Wpf.DiagramDesigner; using AIStudio.Wpf.DiagramDesigner;
using AIStudio.Wpf.DiagramDesigner.Geometrys;
using AIStudio.Wpf.DiagramDesigner.Models; using AIStudio.Wpf.DiagramDesigner.Models;
namespace AIStudio.Wpf.Mind.ViewModels namespace AIStudio.Wpf.Mind.ViewModels
@@ -55,6 +57,10 @@ namespace AIStudio.Wpf.Mind.ViewModels
{ {
get; set; get; set;
} }
} }
public class MindLevel1Node : MindNode 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 public class MindLevel2Node : MindNode
@@ -101,6 +125,11 @@ namespace AIStudio.Wpf.Mind.ViewModels
{ {
} }
public PointBase Offset
{
get; set;
}
} }
public class MindLevel3Node : MindNode public class MindLevel3Node : MindNode
@@ -124,5 +153,10 @@ namespace AIStudio.Wpf.Mind.ViewModels
{ {
} }
public PointBase Offset
{
get; set;
}
} }
} }

View File

@@ -1,7 +1,7 @@
<Project> <Project>
<!-- Project properties --> <!-- Project properties -->
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net461;net5.0-windows</TargetFrameworks> <TargetFrameworks>netcoreapp3.1;net5.0-windows</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">