Skip to content

Properties window is now shown near mouse cursor position #9391

New issue

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

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

Already on GitHub? Sign in to your account

Merged

Conversation

IgorKordiukiewicz
Copy link
Contributor

Resolved / Related Issues

Details of Changes

Validation

  • Built and ran the app

yaira2
yaira2 previously approved these changes Jun 12, 2022
@gave92
Copy link
Member

gave92 commented Jun 12, 2022

Curious: does this work when more than one monitor is connected?

@IgorKordiukiewicz
Copy link
Contributor Author

Yeah, subtracting display region's work area offset from pointer position handles that.

@gave92
Copy link
Member

gave92 commented Jun 12, 2022

Nice, the only issue I'm seeing is that this shows the properties window partially outside the screen bounds when the pointer is close to an edge.
Moving the call to RequestMoveRelativeToDisplayRegion after TryShowAsync appears to work correctly.

bool windowShown = await appWindow.TryShowAsync();
if (windowShown)
{
    // Set window size again here as sometimes it's not resized in the page Loaded event
    appWindow.RequestSize(new Size(460, 550));
    appWindow.RequestMoveRelativeToDisplayRegion(displayRegion,
        new Point(pointerPosition.X - displayRegion.WorkAreaOffset.X, pointerPosition.Y - displayRegion.WorkAreaOffset.Y));
}

@IgorKordiukiewicz
Copy link
Contributor Author

Updated

@gave92 gave92 self-requested a review June 12, 2022 11:57
@gave92 gave92 added ready to merge Pull requests that are approved and ready to merge and removed needs - code review labels Jun 12, 2022
@yaira2 yaira2 merged commit 2bd4532 into files-community:main Jun 12, 2022
@yaira2
Copy link
Member

yaira2 commented Jun 12, 2022

Curious: does this work when more than one monitor is connected?

@gave92 good catch! I only tested this on a single monitor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Pull requests that are approved and ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show properties window near mouse cursor position
3 participants