Skip to content

Commit

Permalink
dragdrop 2
Browse files Browse the repository at this point in the history
  • Loading branch information
NotYoojun committed Nov 2, 2023
1 parent 2d1e47d commit 99f9dd7
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 6 deletions.
15 changes: 14 additions & 1 deletion source/iNKORE.UI.WPF/DragDrop/DropTargetInsertionAdorner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,18 @@ protected override void OnRender(DrawingContext drawingContext)
return;
}

var itemRect = new Rect(itemContainer.TranslatePoint(new Point(), this.AdornedElement), itemContainer.RenderSize);
Size itemSize = itemContainer.RenderSize;

var itemRect = new Rect(itemContainer.TranslatePoint(new Point(), this.AdornedElement), itemSize);

if (itemContainer is FrameworkElement ele)
{
itemRect.X -= ele.Margin.Left;
itemRect.Y -= ele.Margin.Top;
itemRect.Width += ele.Margin.Left + ele.Margin.Right;
itemRect.Height += ele.Margin.Top + ele.Margin.Bottom;
}

Point point1,
point2;
double rotation = 0;
Expand Down Expand Up @@ -179,9 +190,11 @@ static DropTargetInsertionAdorner()
var figure = new PathFigure { StartPoint = new Point(triangleSize, 0) };
figure.Segments.Add(firstLine);
figure.Segments.Add(secondLine);

figure.Freeze();

m_Triangle = new PathGeometry();

m_Triangle.Figures.Add(figure);
m_Triangle.Freeze();
}
Expand Down
4 changes: 2 additions & 2 deletions source/iNKORE.UI.WPF/DragDrop/IDragInfoBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Windows;
using System.Windows.Input;
////using JetBrains.Annotations;
//using JetBrains.Annotations;

namespace iNKORE.UI.WPF.DragDrop
{
Expand All @@ -18,7 +18,7 @@ public interface IDragInfoBuilder
/// <param name="originalSource">The original source of the input event.</param>
/// <param name="mouseButton">The mouse button which was used for the drag operation.</param>
/// <param name="getPosition">A function of the input event which is used to get drag position points.</param>
//[CanBeNull]

DragInfo CreateDragInfo(object sender, object originalSource, MouseButton mouseButton, Func<IInputElement, Point> getPosition);
}
}
4 changes: 2 additions & 2 deletions source/iNKORE.UI.WPF/DragDrop/IDropInfoBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public interface IDropInfoBuilder
/// <param name="e">The drag event arguments.</param>
/// <param name="dragInfo">Information about the drag source, if the drag came from within the framework.</param>
/// <param name="eventType">The type of the underlying event (tunneled or bubbled).</param>
//[CanBeNull]
IDropInfo CreateDropInfo(object sender, DragEventArgs e, DragInfo dragInfo, EventType eventType);

IDropInfo CreateDropInfo(object sender, DragEventArgs e, DragInfo dragInfo, EventType eventType);
}
}
2 changes: 1 addition & 1 deletion source/iNKORE.UI.WPF/DragDrop/Icons/IconFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static class IconFactory
/// <returns>The image to be displayed</returns>
private static BitmapImage GetImage(string iconName, int size)
{
var uri = new Uri($@"pack://application:,,,/iNKORE.UI.WPF.DragDrop;component/Icons/{iconName}", UriKind.RelativeOrAbsolute);
var uri = new Uri($@"/iNKORE.UI.WPF;component/DragDrop/Icons/{iconName}", UriKind.RelativeOrAbsolute);
var icon = new BitmapImage(uri);
icon.DecodePixelHeight = size;
icon.DecodePixelWidth = size;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Windows.Media;
using System.Collections.Generic;
using System.Windows.Media.Media3D;
//using JetBrains.Annotations;

namespace iNKORE.UI.WPF.DragDrop.Utilities
{
Expand Down
11 changes: 11 additions & 0 deletions source/iNKORE.UI.WPF/iNKORE.UI.WPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@
<Page Remove="TrayIcon\Diagrams\**" />
</ItemGroup>

<ItemGroup>
<None Remove="DragDrop\Icons\EffectCopy.png" />
<None Remove="DragDrop\Icons\EffectLink.png" />
<None Remove="DragDrop\Icons\EffectMove.png" />
<None Remove="DragDrop\Icons\EffectNone.png" />
</ItemGroup>

<ItemGroup>
<Content Include="Resources\Icons\iNKORE.ico" />
</ItemGroup>
Expand All @@ -35,6 +42,10 @@
</ItemGroup>

<ItemGroup>
<Resource Include="DragDrop\Icons\EffectCopy.png" />
<Resource Include="DragDrop\Icons\EffectLink.png" />
<Resource Include="DragDrop\Icons\EffectMove.png" />
<Resource Include="DragDrop\Icons\EffectNone.png" />
<Resource Include="Resources\Images\CircularHueGradient.png" />
</ItemGroup>

Expand Down

0 comments on commit 99f9dd7

Please sign in to comment.