From 8b1ab264e693d976d81d26acf9b31c5dc9d56dd0 Mon Sep 17 00:00:00 2001
From: zengwenjie <1663900244@qq.com>
Date: Thu, 25 Sep 2025 19:22:01 +0800
Subject: [PATCH] =?UTF-8?q?=E7=BB=98=E5=88=B6DropIcon=E7=9F=A2=E9=87=8F?=
 =?UTF-8?q?=E5=9B=BE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
 .../Deedy.Activity/Helpers/VisualHelper.cs    | 35 +++++++++++++++++--
 .../Deedy.Activity/Resources/ThemeKeys.cs     | 14 ++++++++
 .../Resources/ThemeResources.cs               |  7 ++++
 .../Deedy.Activity/Themes/ThemeResources.xaml | 32 +++++++++++++++--
 4 files changed, 83 insertions(+), 5 deletions(-)
diff --git a/DeedyDesigner/Deedy.Activity/Helpers/VisualHelper.cs b/DeedyDesigner/Deedy.Activity/Helpers/VisualHelper.cs
index 1b7fa78..115a2cd 100644
--- a/DeedyDesigner/Deedy.Activity/Helpers/VisualHelper.cs
+++ b/DeedyDesigner/Deedy.Activity/Helpers/VisualHelper.cs
@@ -5,6 +5,9 @@ using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Media;
 using System.Windows;
+using System.ComponentModel;
+using System.Windows.Controls;
+using Drawing = System.Drawing;
 
 namespace Deedy.Activity.Helpers
 {
@@ -30,12 +33,12 @@ namespace Deedy.Activity.Helpers
             {
                 case DropPlacement.Rejected:
                     {
-                        
+
                     }
                     break;
                 case DropPlacement.Uncertain:
                     {
-                        
+
                     }
                     break;
                 case DropPlacement.BeforeMe:
@@ -93,7 +96,7 @@ namespace Deedy.Activity.Helpers
             DropPlacement result = DropPlacement.UnDragged;
             if (ui != null)
             {
-                Size size = ui.RenderSize;
+                System.Windows.Size size = ui.RenderSize;
                 double horRuler = size.Width / 3;
                 if (horRuler > 20) horRuler = 20;
                 double verRuler = size.Height / 3;
@@ -149,5 +152,31 @@ namespace Deedy.Activity.Helpers
             }
             return result;
         }
+        /// 
+        /// 将一个字符串解析为一个矢量图形
+        /// 
+        /// 矢量图形的字符串表示形式
+        /// 如果解析成功则返回「Geometry」对象
+        public static Geometry? Help_ParseAsGeometry(this string geometryString) => TypeDescriptor.GetConverter(typeof(Geometry)).ConvertFromString(geometryString) as Geometry;
+        /// 
+        /// 对一个矢量图形进行连续的「缩放」、「平移」到一个「Rectangle」后再以图形中心点为中心沿顺时针旋转指定角度
+        /// 
+        /// 要进行映射的矢量图形
+        /// 目标位置
+        /// 旋转角度
+        /// 克隆平移后的新矢量图形
+        public static Geometry Help_MappingToBounds(this Geometry geometry, Rect rectangle, double angle)
+        {
+            Geometry newGeometry = geometry.Clone();
+            newGeometry.Transform = new TransformGroup
+            {
+                Children = {
+                    new ScaleTransform(rectangle.Width/ newGeometry.Bounds.Width, rectangle.Height/newGeometry.Bounds.Height),          // 宽度放大2倍,高度放大1.5倍
+                    new TranslateTransform(rectangle.Left-newGeometry.Bounds.Left, rectangle.Top-newGeometry.Bounds.Top),               // X/Y方向位移
+                    new RotateTransform(angle,rectangle.Width/2,rectangle.Height/2)                                                     // 顺时针旋转90度
+                }
+            };
+            return newGeometry;
+        }
     }
 }
diff --git a/DeedyDesigner/Deedy.Activity/Resources/ThemeKeys.cs b/DeedyDesigner/Deedy.Activity/Resources/ThemeKeys.cs
index 22762ac..1c95b3d 100644
--- a/DeedyDesigner/Deedy.Activity/Resources/ThemeKeys.cs
+++ b/DeedyDesigner/Deedy.Activity/Resources/ThemeKeys.cs
@@ -23,6 +23,13 @@ namespace Deedy.Activity
             public const string ToolIcon_Close = "ToolIcon_Close";
             public const string ToolIcon_Edit = "ToolIcon_Edit";
             public const string ToolIcon_Save = "ToolIcon_Save";
+
+            public const string DropIcon_BringForward = "DropIcon_BringForward";        // 上移一层
+            public const string DropIcon_SendBackward = "DropIcon_SendBackward";        // 下移一层
+            public const string DropIcon_InsideOneself = "DropIcon_InsideOneself";      // 自身内部
+            public const string DropIcon_BeforeOrBehind = "DropIcon_BeforeOrBehind";    // 自身前后
+            public const string DropIcon_ReplaceOneself = "DropIcon_ReplaceOneself";    // 替换自身
+            public const string DropIcon_LinkWithOneself = "DropIcon_LinkWithOneself";  // 链接自身
         }
 
         public static ComponentResourceKey? LookupResourceKey(string themeKey)
@@ -43,5 +50,12 @@ namespace Deedy.Activity
         public static ComponentResourceKey ToolIcon_Close = new ComponentResourceKey(typeof(ThemeKeys), Keys.ToolIcon_Close);
         public static ComponentResourceKey ToolIcon_Edit = new ComponentResourceKey(typeof(ThemeKeys), Keys.ToolIcon_Edit);
         public static ComponentResourceKey ToolIcon_Save = new ComponentResourceKey(typeof(ThemeKeys), Keys.ToolIcon_Save);
+
+        public static ComponentResourceKey DropIcon_BringForward = new ComponentResourceKey(typeof(ThemeKeys), Keys.DropIcon_BringForward);
+        public static ComponentResourceKey DropIcon_SendBackward = new ComponentResourceKey(typeof(ThemeKeys), Keys.DropIcon_SendBackward);
+        public static ComponentResourceKey DropIcon_InsideOneself = new ComponentResourceKey(typeof(ThemeKeys), Keys.DropIcon_InsideOneself);
+        public static ComponentResourceKey DropIcon_BeforeOrBehind = new ComponentResourceKey(typeof(ThemeKeys), Keys.DropIcon_BeforeOrBehind);
+        public static ComponentResourceKey DropIcon_ReplaceOneself = new ComponentResourceKey(typeof(ThemeKeys), Keys.DropIcon_ReplaceOneself);
+        public static ComponentResourceKey DropIcon_LinkWithOneself = new ComponentResourceKey(typeof(ThemeKeys), Keys.DropIcon_LinkWithOneself);
     }
 }
diff --git a/DeedyDesigner/Deedy.Activity/Resources/ThemeResources.cs b/DeedyDesigner/Deedy.Activity/Resources/ThemeResources.cs
index d596fe6..e4021e9 100644
--- a/DeedyDesigner/Deedy.Activity/Resources/ThemeResources.cs
+++ b/DeedyDesigner/Deedy.Activity/Resources/ThemeResources.cs
@@ -21,5 +21,12 @@ namespace Deedy.Activity
         public ImageSource? ToolIcon_Close => this[ThemeKeys.ToolIcon_Close] as ImageSource;
         public ImageSource? ToolIcon_Edit => this[ThemeKeys.ToolIcon_Edit] as ImageSource;
         public ImageSource? ToolIcon_Save => this[ThemeKeys.ToolIcon_Save] as ImageSource;
+
+        public PathGeometry? DropIcon_BringForward => this[ThemeKeys.DropIcon_BringForward] as PathGeometry;
+        public PathGeometry? DropIcon_SendBackward => this[ThemeKeys.DropIcon_SendBackward] as PathGeometry;
+        public PathGeometry? DropIcon_InsideOneself => this[ThemeKeys.DropIcon_InsideOneself] as PathGeometry;
+        public PathGeometry? DropIcon_BeforeOrBehind => this[ThemeKeys.DropIcon_BeforeOrBehind] as PathGeometry;
+        public PathGeometry? DropIcon_ReplaceOneself => this[ThemeKeys.DropIcon_ReplaceOneself] as PathGeometry;
+        public PathGeometry? DropIcon_LinkWithOneself => this[ThemeKeys.DropIcon_LinkWithOneself] as PathGeometry;
     }
 }
diff --git a/DeedyDesigner/Deedy.Activity/Themes/ThemeResources.xaml b/DeedyDesigner/Deedy.Activity/Themes/ThemeResources.xaml
index da6ef71..d2e45bd 100644
--- a/DeedyDesigner/Deedy.Activity/Themes/ThemeResources.xaml
+++ b/DeedyDesigner/Deedy.Activity/Themes/ThemeResources.xaml
@@ -2,10 +2,13 @@
                     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                     xmlns:local="clr-namespace:Deedy.Activity">
+    
     
         
     
-    
+    
+
+    
     
         
     
@@ -18,7 +21,9 @@
     
         
     
-    
+    
+
+    
     
         
     
@@ -31,5 +36,28 @@
     
         
     
+    
+
+    
+    
+        M0,0H24V4H0Z
+    
+    
+        M0,0H24V4H0Z
+    
+    
+        M0,0H8L16,16L0,8ZM16,16L24,0V24H0Z
+    
+    
+        M0,0H24V4H0ZM12,4L0,16L12,10L24,16ZM12,10L0,24L12,16L24,24Z
+    
+    
+        M0,24V0H24L6,6ZM6,6L12,24V12H24Z
+    
+    
+        M0,0H24V4H0Z
+    
+    
+
     
 
\ No newline at end of file