Skip to content

Commit

Permalink
Resolution to Issue #6
Browse files Browse the repository at this point in the history
  • Loading branch information
Dirkster99 committed Jul 21, 2018
1 parent 8071e3f commit b10cce1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ tmp/
/.vs/
/packages/
/source/.vs/
/source/packages/
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,14 @@ private void OnActivated( object sender, EventArgs e )
var clientArea = Win32Helper.GetClientRect( windowHandle );
var windowArea = Win32Helper.GetWindowRect( windowHandle );

Left = mousePosition.X - windowArea.Width / 2.0;
Top = mousePosition.Y - ( windowArea.Height - clientArea.Height ) / 2.0;
// BugFix Issue #6
// This code is executed when content (dicument or toolwindow) is dragged around
// Formula assumes dragged content has at least a width of 6 and a height of 6
// and always positions dragged conent 3 point in X and Y under mouse cursor
// (This could be improved by remembering the delta between mouse cursor and
// content origin from when user started the drag operation)
Left = (mousePosition.X - (windowArea.Width - clientArea.Width) / 2.0) - 3;
Top = (mousePosition.Y - ( windowArea.Height - clientArea.Height ) / 2.0) - 3;
_attachDrag = false;

IntPtr lParam = new IntPtr( ( ( int )mousePosition.X & ( int )0xFFFF ) | ( ( ( int )mousePosition.Y ) << 16 ) );
Expand Down

0 comments on commit b10cce1

Please sign in to comment.