这是indexloc提供的服务,不要输入任何密码
Skip to content

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

@Muhahe

Description

@Muhahe

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions