Skip to content

Commit

Permalink
fix Issue #69 Drag Adorner Gets Clipped
Browse files Browse the repository at this point in the history
  • Loading branch information
punker76 committed Aug 9, 2013
1 parent 9461dab commit 06b3e0e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions GongSolutions.Wpf.DragDrop/DragDrop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -703,8 +703,14 @@ private static void DropTarget_PreviewDragOver(object sender, DragEventArgs e)

if (m_DragInfo != null) {
// move the adorner
_adornerPos.Offset(_adornerSize.Width * -GetDragMouseAnchorPoint(m_DragInfo.VisualSource).X,
_adornerSize.Height * -GetDragMouseAnchorPoint(m_DragInfo.VisualSource).Y);
var offsetX = _adornerSize.Width * -GetDragMouseAnchorPoint(m_DragInfo.VisualSource).X;
var offsetY = _adornerSize.Height * -GetDragMouseAnchorPoint(m_DragInfo.VisualSource).Y;
_adornerPos.Offset(offsetX, offsetY);
var maxAdornerPosX = DragAdorner.AdornedElement.RenderSize.Width;
var adornerPosRightX = (_adornerPos.X + _adornerSize.Width);
if (adornerPosRightX > maxAdornerPosX) {
_adornerPos.Offset(-adornerPosRightX + maxAdornerPosX, 0);
}
}

DragAdorner.MousePosition = _adornerPos;
Expand Down

0 comments on commit 06b3e0e

Please sign in to comment.