diff --git a/AIStudio.Wpf.DiagramApp/ViewModels/ScriptViewModel.cs b/AIStudio.Wpf.DiagramApp/ViewModels/ScriptViewModel.cs index 9719349..47f9189 100644 --- a/AIStudio.Wpf.DiagramApp/ViewModels/ScriptViewModel.cs +++ b/AIStudio.Wpf.DiagramApp/ViewModels/ScriptViewModel.cs @@ -100,7 +100,7 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels DiagramViewModel.Add(collectorNode4); ColorBoxCollectorScriptViewModel collectorNode5 = new ColorBoxCollectorScriptViewModel(DiagramViewModel) { Name = "Collector5", Left = 790, Top = 475 }; - collectorNode5.Tag = new ColorBoxModel("青色|梯形", "M 0 0 H 60 L 50 40 H 10 Z", Colors.Cyan); + collectorNode5.Tag = new ColorBoxModel("青色|梯形", "M10 3.22l-.61-.6a5.5 5.5 0 0 0-7.78 7.77L10 18.78l8.39-8.4a5.5 5.5 0 0 0-7.78-7.77l-.61.61z", Colors.Cyan); DiagramViewModel.Add(collectorNode5); ColorBoxCollectorScriptViewModel collectorNode6 = new ColorBoxCollectorScriptViewModel(DiagramViewModel) { Name = "Collector6", Left = 790, Top = 560 }; diff --git a/AIStudio.Wpf.DiagramApp/ViewModels/ToolBoxViewModel.cs b/AIStudio.Wpf.DiagramApp/ViewModels/ToolBoxViewModel.cs index 252deb2..e061c62 100644 --- a/AIStudio.Wpf.DiagramApp/ViewModels/ToolBoxViewModel.cs +++ b/AIStudio.Wpf.DiagramApp/ViewModels/ToolBoxViewModel.cs @@ -142,7 +142,7 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels pathToolBoxItems.Add(new PathToolBoxData("M 0,20 A 40,40 0 0 1 15,0 H 55 A 60,60 0 0 1 55,40 H 15 A 40,40, 0 0 1 0,20 Z", typeof(PathItemViewModel))); pathToolBoxItems.Add(new PathToolBoxData("M 0 10 L 10,0 H 50 L 60,10 V 40 H 0 Z", typeof(PathItemViewModel))); pathToolBoxItems.Add(new PathToolBoxData("M 0,20 L 10,0 H 50 L 60,20 L 50,40 H10 Z", typeof(PathItemViewModel))); - pathToolBoxItems.Add(new PathToolBoxData("M 0 0 H 60 L 50 40 H 10 Z", typeof(PathItemViewModel))); + pathToolBoxItems.Add(new PathToolBoxData("M10 3.22l-.61-.6a5.5 5.5 0 0 0-7.78 7.77L10 18.78l8.39-8.4a5.5 5.5 0 0 0-7.78-7.77l-.61.61z", typeof(PathItemViewModel))); pathToolBoxItems.Add(new PathToolBoxData("M 0 0 H 60 V 20 L 30, 40 L 0, 20 Z", typeof(PathItemViewModel))); pathToolBoxItems.Add(new PathToolBoxData("M 9,2 11,7 17,7 12,10 14,15 9,12 4,15 6,10 1,7 7,7 Z", typeof(PathItemViewModel))); ToolBoxCategory.Add(new ToolBoxCategory() { Header = "Path", ToolBoxItems = new ObservableCollection(pathToolBoxItems) }); diff --git a/AIStudio.Wpf.DiagramApp/Views/MainWindow.xaml b/AIStudio.Wpf.DiagramApp/Views/MainWindow.xaml index 19b0d03..ecc2606 100644 --- a/AIStudio.Wpf.DiagramApp/Views/MainWindow.xaml +++ b/AIStudio.Wpf.DiagramApp/Views/MainWindow.xaml @@ -1702,8 +1702,8 @@ - - + + @@ -1733,7 +1733,6 @@ - diff --git a/AIStudio.Wpf.DiagramDesigner.Additionals/AIStudio.Wpf.DiagramDesigner.Additionals_4uooikgk_wpftmp.csproj b/AIStudio.Wpf.DiagramDesigner.Additionals/AIStudio.Wpf.DiagramDesigner.Additionals_4uooikgk_wpftmp.csproj new file mode 100644 index 0000000..10cdf65 --- /dev/null +++ b/AIStudio.Wpf.DiagramDesigner.Additionals/AIStudio.Wpf.DiagramDesigner.Additionals_4uooikgk_wpftmp.csproj @@ -0,0 +1,302 @@ + + + AIStudio.Wpf.DiagramDesigner.Additionals + obj\Debug\ + obj\ + F:\aistudio.-wpf.-diagram\AIStudio.Wpf.DiagramDesigner.Additionals\obj\ + <_TargetAssemblyProjectName>AIStudio.Wpf.DiagramDesigner.Additionals + + + + true + true + AIStudio.Wpf.Controls + akwkevin + https://gitee.com/akwkevin + A.png + + + 1.0.1 + 一个Wpf的Diagram控件帮助库 + + + + + + + + + + + + + + True + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AIStudio.Wpf.DiagramDesigner/Adorners/DrawingRubberbandAdorner.cs b/AIStudio.Wpf.DiagramDesigner/Adorners/DrawingRubberbandAdorner.cs index 03634ef..b809431 100644 --- a/AIStudio.Wpf.DiagramDesigner/Adorners/DrawingRubberbandAdorner.cs +++ b/AIStudio.Wpf.DiagramDesigner/Adorners/DrawingRubberbandAdorner.cs @@ -7,6 +7,7 @@ using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; +using System.Windows.Resources; using System.Windows.Shapes; using AIStudio.Wpf.DiagramDesigner.ViewModels; using AIStudio.Wpf.DiagramDesigner.ViewModels.BaseViewModel; @@ -57,21 +58,21 @@ namespace AIStudio.Wpf.DiagramDesigner this._designerCanvas = designerCanvas; this._designerCanvas.Focus(); - if (DrawMode == DrawMode.Eraser) + if (DrawMode >= DrawMode.Eraser && DrawMode <= DrawMode.EraserPreview) { - _drawingDesignerItem = new EraserDrawingDesignerItemViewModel(_viewModel, dragStartPoint); + if (DrawMode == DrawMode.Eraser) + { + _drawingDesignerItem = new EraserDrawingDesignerItemViewModel(_viewModel, dragStartPoint); + } + if (DrawMode == DrawMode.EraserPreview) + { + _drawingDesignerItem = new EraserPreviewDrawingDesignerItemViewModel(_viewModel, dragStartPoint); + } _rubberbandBrush = null; _rubberbandPen = new Pen(new SolidColorBrush(Colors.Red) { Opacity = 0.5 }, _drawingDesignerItem.ColorViewModel.LineWidth); } - else if (DrawMode == DrawMode.EraserPreview) - { - _drawingDesignerItem = new EraserPreviewDrawingDesignerItemViewModel(_viewModel, dragStartPoint); - - _rubberbandBrush = null; - _rubberbandPen = new Pen(new SolidColorBrush(Colors.Red) { Opacity = 0.5 }, _drawingDesignerItem.ColorViewModel.LineWidth); - } - else if (DrawMode >= DrawMode.ColorPicker && DrawMode <= DrawMode.ErasableDirectLine) + else if (DrawMode >= DrawMode.ColorPicker && DrawMode <= DrawMode.ErasableHeart) { if (DrawMode == DrawMode.ErasableLine) { @@ -102,8 +103,14 @@ namespace AIStudio.Wpf.DiagramDesigner _drawingDesignerItem = new TextDrawingDesignerItemViewModel(_viewModel, dragStartPoint, true); } else if (DrawMode == DrawMode.ColorPicker) - { + { _drawingDesignerItem = new ColorPickerDrawingDesignerItemViewModel(_viewModel, dragStartPoint, true); + StreamResourceInfo sri = Application.GetResourceStream(new Uri("pack://application:,,,/AIStudio.Wpf.DiagramDesigner;component/Images/color-picker.cur", UriKind.RelativeOrAbsolute)); + this.Cursor = new Cursor(sri.Stream); + } + else + { + _drawingDesignerItem = new SharpDrawingDesignerItemViewModel(_viewModel, DrawMode, dragStartPoint, true); } _rubberbandBrush = null;//ColorObject.ToBrush(_drawingDesignerItem.ColorViewModel.FillColor); diff --git a/AIStudio.Wpf.DiagramDesigner/Controls/DesignerCanvas.cs b/AIStudio.Wpf.DiagramDesigner/Controls/DesignerCanvas.cs index 97d4ddd..6160427 100644 --- a/AIStudio.Wpf.DiagramDesigner/Controls/DesignerCanvas.cs +++ b/AIStudio.Wpf.DiagramDesigner/Controls/DesignerCanvas.cs @@ -271,15 +271,18 @@ namespace AIStudio.Wpf.DiagramDesigner { EnterMove(); } - else if (_service.DrawModeViewModel.CursorMode == CursorMode.ColorPicker) - { - EnterColorPicker(); - } else if (_service.DrawModeViewModel.CursorMode == CursorMode.Exit) { ExitCursor(); } } + else if (e.PropertyName == nameof(_service.DrawModeViewModel.DrawingDrawMode)) + { + if (_service.DrawModeViewModel.DrawingDrawMode == DrawMode.ColorPicker) + { + EnterColorPicker(); + } + } } } @@ -314,8 +317,6 @@ namespace AIStudio.Wpf.DiagramDesigner if (adorner != null) { adornerLayer.Add(adorner); - StreamResourceInfo sri = Application.GetResourceStream(new Uri("pack://application:,,,/AIStudio.Wpf.DiagramDesigner;component/Images/color-picker.cur", UriKind.RelativeOrAbsolute)); - adorner.Cursor = new Cursor(sri.Stream); } } } diff --git a/AIStudio.Wpf.DiagramDesigner/Enums/CursorMode.cs b/AIStudio.Wpf.DiagramDesigner/Enums/CursorMode.cs index 478ab4c..b77e68f 100644 --- a/AIStudio.Wpf.DiagramDesigner/Enums/CursorMode.cs +++ b/AIStudio.Wpf.DiagramDesigner/Enums/CursorMode.cs @@ -9,7 +9,6 @@ namespace AIStudio.Wpf.DiagramDesigner Normal = 0, Format = 1, Move = 2, - ColorPicker = 3, - Exit = 4, + Exit = 3, } } diff --git a/AIStudio.Wpf.DiagramDesigner/Enums/DrawMode.cs b/AIStudio.Wpf.DiagramDesigner/Enums/DrawMode.cs index 42a03bb..9d69d1c 100644 --- a/AIStudio.Wpf.DiagramDesigner/Enums/DrawMode.cs +++ b/AIStudio.Wpf.DiagramDesigner/Enums/DrawMode.cs @@ -46,9 +46,8 @@ namespace AIStudio.Wpf.DiagramDesigner ErasableCloud = 234,//云 ErasableArrowRight = 235, ErasableArrowLeft = 236, - ErasableCamera = 237, - ErasableCheck = 238, - ErasableClose = 239, - ErasableHeart = 240, + ErasableCheck = 237, + ErasableClose = 238, + ErasableHeart = 239, } } diff --git a/AIStudio.Wpf.DiagramDesigner/Models/Serializables/DrawingDesignerItemBase.cs b/AIStudio.Wpf.DiagramDesigner/Models/Serializables/DrawingDesignerItemBase.cs index 3dfeb7a..56fad40 100644 --- a/AIStudio.Wpf.DiagramDesigner/Models/Serializables/DrawingDesignerItemBase.cs +++ b/AIStudio.Wpf.DiagramDesigner/Models/Serializables/DrawingDesignerItemBase.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; +using System.Windows.Media; using System.Xml.Serialization; using Newtonsoft.Json; @@ -19,6 +20,10 @@ namespace AIStudio.Wpf.DiagramDesigner { this.Erasable = item.Erasable; this.Geometry = item.Geometry.ToString(); + //if (item.Geometry.Transform != null) + //{ + // this.Matrix = item.Geometry.Transform.Value; + //} this.Points = item.Points; this.DrawMode = item.DrawMode; } @@ -35,6 +40,25 @@ namespace AIStudio.Wpf.DiagramDesigner get; set; } + //[XmlIgnore] + //public Matrix Matrix + //{ + // get; set; + //} + //[JsonIgnore] + //[XmlElement("Matrix")] + //public string XmlMatrix + //{ + // get + // { + // return SerializeHelper.SerializeMatrix(Matrix); + // } + // set + // { + // Matrix = SerializeHelper.DeserializeMatrix(value); + // } + //} + [XmlIgnore] public List Points { diff --git a/AIStudio.Wpf.DiagramDesigner/Models/Serializables/SelectableItemBase.cs b/AIStudio.Wpf.DiagramDesigner/Models/Serializables/SelectableItemBase.cs index 1889549..d0fb9cb 100644 --- a/AIStudio.Wpf.DiagramDesigner/Models/Serializables/SelectableItemBase.cs +++ b/AIStudio.Wpf.DiagramDesigner/Models/Serializables/SelectableItemBase.cs @@ -634,6 +634,17 @@ namespace AIStudio.Wpf.DiagramDesigner return value; } + public static string SerializeMatrix(Matrix matrix) + { + return string.Format("{0},{1},{2},{3},{4},{5}", matrix.M11, matrix.M12, matrix.M21, matrix.M22, matrix.OffsetX, matrix.OffsetY); ; + } + + public static Matrix DeserializeMatrix(string matrix) + { + string[] pieces = matrix.Split(new char[] { ',' }); + return new Matrix(double.Parse(pieces[0]), double.Parse(pieces[1]), double.Parse(pieces[2]), double.Parse(pieces[3]), double.Parse(pieces[4]), double.Parse(pieces[5])); + } + public static string SerializeObject(object obj, string serializableType = null) { if (serializableType?.ToLower() == ".xml") diff --git a/AIStudio.Wpf.DiagramDesigner/UserControls/LineControl.xaml.cs b/AIStudio.Wpf.DiagramDesigner/UserControls/LineControl.xaml.cs index 426e776..95bf3c2 100644 --- a/AIStudio.Wpf.DiagramDesigner/UserControls/LineControl.xaml.cs +++ b/AIStudio.Wpf.DiagramDesigner/UserControls/LineControl.xaml.cs @@ -57,7 +57,7 @@ namespace AIStudio.Wpf.DiagramDesigner await DoAnimation(); break; case nameof(AnimationViewModel.Start): - await Application.Current.Dispatcher.Invoke(async () => { + await Application.Current?.Dispatcher.Invoke(async () => { await DoAnimation(); }); break; diff --git a/AIStudio.Wpf.DiagramDesigner/ViewModels/AdditionViewModel/DrawModeViewModel.cs b/AIStudio.Wpf.DiagramDesigner/ViewModels/AdditionViewModel/DrawModeViewModel.cs index 282a2e7..a36fd6f 100644 --- a/AIStudio.Wpf.DiagramDesigner/ViewModels/AdditionViewModel/DrawModeViewModel.cs +++ b/AIStudio.Wpf.DiagramDesigner/ViewModels/AdditionViewModel/DrawModeViewModel.cs @@ -47,7 +47,6 @@ namespace AIStudio.Wpf.DiagramDesigner { ClearOldValue(nameof(DrawingDrawMode)); DrawingDrawMode = drawingDrawMode; - CursorMode = CursorMode.Normal; } else { @@ -193,14 +192,13 @@ namespace AIStudio.Wpf.DiagramDesigner } set { - var oldvalue = _drawingDrawMode; - SetProperty(ref _drawingDrawMode, value); - DrawingDrawModeSelected = true; if (value == DrawMode.ColorPicker) { - SetOldValue(oldvalue, nameof(DrawingDrawMode)); - CursorMode = CursorMode.ColorPicker; + SetOldValue(_drawingDrawMode, nameof(DrawingDrawMode)); } + SetProperty(ref _drawingDrawMode, value); + DrawingDrawModeSelected = true; + } } diff --git a/AIStudio.Wpf.DiagramDesigner/ViewModels/AdditionViewModel/SharpPath.cs b/AIStudio.Wpf.DiagramDesigner/ViewModels/AdditionViewModel/SharpPath.cs index 0b280c7..05b189d 100644 --- a/AIStudio.Wpf.DiagramDesigner/ViewModels/AdditionViewModel/SharpPath.cs +++ b/AIStudio.Wpf.DiagramDesigner/ViewModels/AdditionViewModel/SharpPath.cs @@ -11,11 +11,11 @@ namespace AIStudio.Wpf.DiagramDesigner public static SharpPath Square { get; } = new SharpPath("M 0 -5 10 -5 10 5 0 5 z", 10, 10, PathStyle.Square, SizeStyle.Middle); public static SharpPath Triangle { get; } = new SharpPath("M1,21H23L12,2", 10, 10, PathStyle.Square, SizeStyle.Middle); public static SharpPath Rhombus { get; } = new SharpPath("M 0,20 L 30 0 L 60,20 L 30,40 Z", 10, 10, PathStyle.Square, SizeStyle.Middle); - public static SharpPath Trapezoid { get; } = new SharpPath("M 0 0 H 60 L 50 40 H 10 Z", 10, 10, PathStyle.Square, SizeStyle.Middle); + public static SharpPath Heart { get; } = new SharpPath("M10 3.22l-.61-.6a5.5 5.5 0 0 0-7.78 7.77L10 18.78l8.39-8.4a5.5 5.5 0 0 0-7.78-7.77l-.61.61z", 10, 10, PathStyle.Square, SizeStyle.Middle); public static SharpPath Pentagram { get; } = new SharpPath("M 9,2 11,7 17,7 12,10 14,15 9,12 4,15 6,10 1,7 7,7 Z", 10, 10, PathStyle.Square, SizeStyle.Middle); public static SharpPath Hexagon { get; } = new SharpPath("M 0,20 L 10,0 H 50 L 60,20 L 50,40 H10 Z", 10, 10, PathStyle.Square, SizeStyle.Middle); - public static readonly Dictionary ArrowDictionary = new Dictionary() + public static readonly Dictionary SharpPathDictionary = new Dictionary() { { PathStyle.None, None.Path }, { PathStyle.Arrow, Arrow.Path }, @@ -91,9 +91,9 @@ namespace AIStudio.Wpf.DiagramDesigner { if (SetProperty(ref _pathStyle, value)) { - if (ArrowDictionary.ContainsKey(_pathStyle)) + if (SharpPathDictionary.ContainsKey(_pathStyle)) { - Path = ArrowDictionary[_pathStyle]; + Path = SharpPathDictionary[_pathStyle]; } } } diff --git a/AIStudio.Wpf.DiagramDesigner/ViewModels/DrawingViewModel/Erasable/DrawingDesignerItemViewModelBase.cs b/AIStudio.Wpf.DiagramDesigner/ViewModels/DrawingViewModel/Erasable/DrawingDesignerItemViewModelBase.cs index 85b6168..d7977bc 100644 --- a/AIStudio.Wpf.DiagramDesigner/ViewModels/DrawingViewModel/Erasable/DrawingDesignerItemViewModelBase.cs +++ b/AIStudio.Wpf.DiagramDesigner/ViewModels/DrawingViewModel/Erasable/DrawingDesignerItemViewModelBase.cs @@ -72,6 +72,7 @@ namespace AIStudio.Wpf.DiagramDesigner { this.Erasable = designer.Erasable; this.Geometry = Geometry.Parse(designer.Geometry).GetFlattenedPathGeometry(); + //this.Geometry.Transform = Transform.Parse(designer.Matrix.ToString()); this.Points = designer.Points; this.DrawMode = designer.DrawMode; this.DisableSelected = Erasable; @@ -96,8 +97,15 @@ namespace AIStudio.Wpf.DiagramDesigner if (Geometry != null) { - Geometry.Transform = new TranslateTransform(0 - Left, 0 - Top); - + if (Geometry.Transform is TransformGroup transformGroup) + { + TranslateTransform translateTransform = transformGroup.Children.OfType().FirstOrDefault(); + transformGroup.Children.Remove(translateTransform); ; + transformGroup.Children.Add(new TranslateTransform(0 - Geometry.Bounds.Left, 0 - Geometry.Bounds.Top)); + } + else + Geometry.Transform = new TranslateTransform(0 - Left, 0 - Top); + if (Erasable) { var aPen = new Pen(ColorViewModel.LineColor.ToBrush(), ColorViewModel.LineWidth); diff --git a/AIStudio.Wpf.DiagramDesigner/ViewModels/DrawingViewModel/Erasable/SharpDrawingDesignerItemViewModel.cs b/AIStudio.Wpf.DiagramDesigner/ViewModels/DrawingViewModel/Erasable/SharpDrawingDesignerItemViewModel.cs new file mode 100644 index 0000000..f0608a3 --- /dev/null +++ b/AIStudio.Wpf.DiagramDesigner/ViewModels/DrawingViewModel/Erasable/SharpDrawingDesignerItemViewModel.cs @@ -0,0 +1,112 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.Design; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Input; +using System.Windows.Media; +using AIStudio.Wpf.DiagramDesigner.Models; + +namespace AIStudio.Wpf.DiagramDesigner +{ + public class SharpDrawingDesignerItemViewModel : DrawingDesignerItemViewModelBase + { + public SharpDrawingDesignerItemViewModel() + { + } + + public SharpDrawingDesignerItemViewModel(IDiagramViewModel root, DrawMode drawMode, Point startPoint, bool erasable) : base(root, drawMode, startPoint, erasable) + { + } + + public SharpDrawingDesignerItemViewModel(IDiagramViewModel root, SelectableItemBase designer) : base(root, designer) + { + + } + + public SharpDrawingDesignerItemViewModel(IDiagramViewModel root, SerializableItem serializableItem, string serializableType) : base(root, serializableItem, serializableType) + { + + } + + public override bool OnMouseMove(IInputElement sender, MouseEventArgs e) + { + if (e.LeftButton == MouseButtonState.Pressed) + { + var point = e.GetPosition(sender); + if (Points == null || Points.Count == 0)//没有起始点 + { + return true; + } + + if ((Points[0] - point).Length < ColorViewModel.LineWidth) + { + return true; + } + + if (Keyboard.IsKeyDown(Key.LeftShift))//正方形 + { + var len = Math.Abs(point.X - Points[0].X);//按X轴放大 + point = new Point(Points[0].X + (point.X > Points[0].X ? len : -len), Points[0].Y + (point.Y > Points[0].Y ? len : -len)); + } + + if (Points.Count == 2) + { + Points[1] = point; + } + else + { + Points.Add(point); + } + + string path = ""; + switch (DrawMode) + { + case DrawMode.ErasableTriangle: path = "M50,0 L100,100 0,100 z"; break; + case DrawMode.ErasableRhombus: path = "M50,0 L100,100 50,200 0,100 z"; break; + case DrawMode.ErasableHexagon: path = "M50,0 150,0 200,100 150,200 50,200 0,100 Z"; break; + case DrawMode.ErasablePentagram: path = "M 12.8604,10.4421L 11,6.0593L 9.13781,10.4463L 4.39462,10.8613L 7.99148,13.988L 6.92042,18.6273L 11.0056,16.1727L 15.0868,18.625L 14.0147,13.9812L 17.6082,10.8575L 12.8604,10.4421 Z"; break; + case DrawMode.ErasableStarFour: path = "M12,6.7L13.45,10.55L17.3,12L13.45,13.45L12,17.3L10.55,13.45L6.7,12L10.55,10.55L12,6.7"; break; + case DrawMode.ErasableStarThree: path = "M12,9.5L13.2,13.5L16,16.5L12,15.6L7.9,16.5L10.7,13.5L12,9.5"; break; + case DrawMode.ErasableChat: path = "M171.008 964.398545c-43.938909 0-70.306909-11.729455-76.288-33.931636-2.746182-10.216727-2.746182-30.045091 28.16-48.011636 24.855273-14.475636 47.569455-36.189091 67.677091-64.651636-117.946182-86.481455-185.134545-212.689455-185.134545-349.556364 0-249.693091 227.188364-452.864 506.414545-452.864 279.435636 0 506.740364 203.147636 506.740364 452.864 0 249.739636-227.328 452.933818-506.717091 452.933818-49.664 0-99.281455-6.702545-147.618909-19.921455C296.471273 947.688727 220.695273 964.398545 171.008 964.398545z"; break; + case DrawMode.ErasableComment: path = "M928.078587 0h-838.26453C40.296574 0 0 40.296574 0 89.814057v598.760379c0 49.517483 40.296574 89.814057 89.814057 89.814057H119.752076v245.611507L400.450941 778.388493H928.078587c49.517483 0 89.814057-40.296574 89.814057-89.814057v-598.760379c0-49.517483-40.296574-89.814057-89.814057-89.814057z"; break; + case DrawMode.ErasableCloud: path = "M224.219429 836.644571h531.858285c140.562286 0 245.138286-106.715429 245.138286-239.140571 0-136.283429-111.433143-236.141714-256.731429-236.141714-53.558857-105.874286-152.978286-174.006857-276.845714-174.006857-161.133714 0-293.997714 125.988571-308.132571 285.44-77.586286 22.272-136.722286 89.984-136.722286 180.425142 0 101.12 73.709714 183.405714 201.435429 183.405715z"; break; + case DrawMode.ErasableArrowRight: path = "M11,16H3V8H11V2L21,12L11,22V16"; break; + case DrawMode.ErasableArrowLeft: path = "M13,22L3,12L13,2V8H21V16H13V22"; break; + case DrawMode.ErasableCheck: path = "M0,50 L30,100 100,0"; break; + case DrawMode.ErasableClose: path = "M0,0 L100,100 M0,100 L100,0"; break; + case DrawMode.ErasableHeart: path = "M510.68 883.15c-15.2 0-30.37-8.49-48.1-25.47-25.35-24.3-50.81-48.48-76.27-72.64-61.6-58.49-125.28-118.96-186.38-180.25-68.39-68.6-99.26-141.23-94.39-222.07 4.09-67.79 31.08-122.65 78.06-158.66 50.62-38.79 123.3-53.23 194.46-38.6 51.71 10.63 90 41.18 127.03 70.72l1.54 1.23c0.47 0.38 0.94 0.76 1.41 1.13 8.05-5.05 15.94-10.15 23.68-15.13 30.01-19.35 58.34-37.63 90.38-50.54 84.26-33.9 189.34-8.11 244.51 60.07 58.08 71.79 68.23 157.45 28.57 241.22-20 42.22-50.67 84.68-91.16 126.22-57.91 59.41-118.94 117.32-177.96 173.33-22.3 21.16-44.59 42.32-66.77 63.59-17.98 17.22-33.31 25.85-48.61 25.85z"; break; + } + + PathGeometry pathGeometry = PathGeometry.CreateFromGeometry(Geometry.Parse(path)); + var transformGroup = new TransformGroup(); + double radiox = Math.Abs(point.X - Points[0].X) / pathGeometry.Bounds.Width; + double radioy = Math.Abs(point.Y - Points[0].Y) / pathGeometry.Bounds.Height; + transformGroup.Children.Add(new TranslateTransform((Points[0].X) / radiox - pathGeometry.Bounds.Left, (Points[0].Y) / radioy - pathGeometry.Bounds.Top)); + transformGroup.Children.Add(new ScaleTransform(radiox, radioy)); + pathGeometry.Transform = transformGroup; + Geometry = pathGeometry; + + IsFinish = true; + + return true; + } + else + { + return false; + } + } + + public override bool OnMouseDown(IInputElement sender, MouseButtonEventArgs e) + { + return true; + } + + public override bool OnMouseUp(IInputElement sender, MouseButtonEventArgs e) + { + return base.OnMouseUp(sender, e); + } + } +} diff --git a/Extensions/AIStudio.Wpf.SFC/AIStudio.Wpf.SFC_a3jgn30c_wpftmp.csproj b/Extensions/AIStudio.Wpf.SFC/AIStudio.Wpf.SFC_a3jgn30c_wpftmp.csproj new file mode 100644 index 0000000..1570ecf --- /dev/null +++ b/Extensions/AIStudio.Wpf.SFC/AIStudio.Wpf.SFC_a3jgn30c_wpftmp.csproj @@ -0,0 +1,235 @@ + + + AIStudio.Wpf.SFC + obj\Debug\ + obj\ + F:\aistudio.-wpf.-diagram\Extensions\AIStudio.Wpf.SFC\obj\ + <_TargetAssemblyProjectName>AIStudio.Wpf.SFC + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Extensions/AIStudio.Wpf.Script/AIStudio.Wpf.Script_amhuxgns_wpftmp.csproj b/Extensions/AIStudio.Wpf.Script/AIStudio.Wpf.Script_amhuxgns_wpftmp.csproj new file mode 100644 index 0000000..abd163d --- /dev/null +++ b/Extensions/AIStudio.Wpf.Script/AIStudio.Wpf.Script_amhuxgns_wpftmp.csproj @@ -0,0 +1,276 @@ + + + AIStudio.Wpf.Script + obj\Debug\ + obj\ + F:\aistudio.-wpf.-diagram\Extensions\AIStudio.Wpf.Script\obj\ + <_TargetAssemblyProjectName>AIStudio.Wpf.Script + + + + true + AIStudio.Wpf.Controls + akwkevin + https://gitee.com/akwkevin + A.png + + + 1.0.6 + 一个Wpf的脚本生成模块 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Extensions/AIStudio.Wpf.Script/Dlls/net461/AIStudio.Wpf.Script.Core.dll b/Extensions/AIStudio.Wpf.Script/Dlls/net461/AIStudio.Wpf.Script.Core.dll index 7b4ff94..c79b0d0 100644 Binary files a/Extensions/AIStudio.Wpf.Script/Dlls/net461/AIStudio.Wpf.Script.Core.dll and b/Extensions/AIStudio.Wpf.Script/Dlls/net461/AIStudio.Wpf.Script.Core.dll differ diff --git a/Extensions/AIStudio.Wpf.Script/Dlls/net5.0-windows/AIStudio.Wpf.Script.Core.dll b/Extensions/AIStudio.Wpf.Script/Dlls/net5.0-windows/AIStudio.Wpf.Script.Core.dll index f84c63d..0e09b58 100644 Binary files a/Extensions/AIStudio.Wpf.Script/Dlls/net5.0-windows/AIStudio.Wpf.Script.Core.dll and b/Extensions/AIStudio.Wpf.Script/Dlls/net5.0-windows/AIStudio.Wpf.Script.Core.dll differ diff --git a/Extensions/AIStudio.Wpf.Script/Dlls/net6.0-windows/AIStudio.Wpf.Script.Core.dll b/Extensions/AIStudio.Wpf.Script/Dlls/net6.0-windows/AIStudio.Wpf.Script.Core.dll index 7d88a61..aef9f0f 100644 Binary files a/Extensions/AIStudio.Wpf.Script/Dlls/net6.0-windows/AIStudio.Wpf.Script.Core.dll and b/Extensions/AIStudio.Wpf.Script/Dlls/net6.0-windows/AIStudio.Wpf.Script.Core.dll differ diff --git a/Extensions/AIStudio.Wpf.Script/Dlls/netcoreapp3.1/AIStudio.Wpf.Script.Core.dll b/Extensions/AIStudio.Wpf.Script/Dlls/netcoreapp3.1/AIStudio.Wpf.Script.Core.dll index a7747a7..2192239 100644 Binary files a/Extensions/AIStudio.Wpf.Script/Dlls/netcoreapp3.1/AIStudio.Wpf.Script.Core.dll and b/Extensions/AIStudio.Wpf.Script/Dlls/netcoreapp3.1/AIStudio.Wpf.Script.Core.dll differ diff --git a/Extensions/AIStudio.Wpf.Script/ViewModels/ColorBoxSwitchScriptViewModel.cs b/Extensions/AIStudio.Wpf.Script/ViewModels/ColorBoxSwitchScriptViewModel.cs index 34c6997..a5c1f76 100644 --- a/Extensions/AIStudio.Wpf.Script/ViewModels/ColorBoxSwitchScriptViewModel.cs +++ b/Extensions/AIStudio.Wpf.Script/ViewModels/ColorBoxSwitchScriptViewModel.cs @@ -154,7 +154,7 @@ namespace AIStudio.Wpf.CSharpScript Console.WriteLine($""{Output4.Text}号Box分配完毕,送往4号出口""); } break; - case ""M 0 0 H 60 L 50 40 H 10 Z"": + case ""M10 3.22l-.61-.6a5.5 5.5 0 0 0-7.78 7.77L10 18.78l8.39-8.4a5.5 5.5 0 0 0-7.78-7.77l-.61.61z"": if (Output5 == null) { Output5 = Input;