Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

StartDraggingFloatingWindow for large documents - drag sometimes not happening or mouse is out of new window #306

Closed
Muhahe opened this issue Oct 8, 2021 · 0 comments

Comments

@Muhahe
Copy link
Contributor

Muhahe commented Oct 8, 2021

Hi there,

im using avalondock to display multiple documents, that has buch of content to display. And when user start to drag this document to floating window (undock it from layout root), in many times drag didnt happens.

After few tries, i found out, that LayoutDocumentTabItem.cs -> OnMouseLeftButtonDown calls Model.IsActivate = true, that can block mainthread for some time, and then mouse can be out of LayoutDocumentTabItem header so LayoutDocumentTabItem.cs -> OnMouseMove, isnt called, because there is no MouseMove event.

I was able to reproduce this in MVVMTestApp from version 4.60.00 by just opening two large text documents (i have two 100MB text files) so there is a visible delay between switching from one document to another (after mousedown, tab switch take some time, before headers change their style). And when user moves mouse out of the header before switching is finished, no drag happens.

My attempt to fix this is to add
CaptureMouse() into OnMouseLeftButtonDown in LayoutDocumentTabItem.cs 109
image

And then i noticed, that when user is dragging window and is moving mouse when DockingManager.cs -> StartDraggingFloatingWindowForContent 1709 is in progress, mouse can be positioned outside of new LayoutFloatingWindowControl. In my opinion this is caused because new window is not synced to mousemove events yet, so i added another CaptureMouse() call to AttachDrag in LayoutFloatingWindowControl.cs 328

image

Which seems now ok to me, and mouse is always positioned to top left corner of new window. There is a little "bug" that mouse isnt positioned to same position on documentTabHeader when was clicked, but its minor issue for me.

So, what do you think about this solution? Is it something close to clear approach? Or there are some issues, that i missed?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant