maui icon indicating copy to clipboard operation
maui copied to clipboard

[macOS] Fix `GesturePlatformManager.CalculatePosition` when asked for a relative position

Open MartyIX opened this issue 2 years ago • 19 comments

Description of Change

This PR follows what I wrote here https://github.com/dotnet/maui/issues/19327#issuecomment-1851455656. I'm not sure if the fix is correct or not. I just figured that creating a PR is an easy way to get some feedback.

Issues Fixed

Fixes #19329 Fixes #19327

MartyIX avatar Dec 12 '23 18:12 MartyIX

Hey there @MartyIX! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

ghost avatar Dec 12 '23 18:12 ghost

Cursor is in both cases in the right-bottom corner of the red robot image.

Before Before

After After

MartyIX avatar Dec 12 '23 18:12 MartyIX

Btw: The change this PR reverts was introduced here https://github.com/dotnet/maui/commit/e84098b6b61173f125a26ea6ba83a2917b019114#diff-ad1a05553c13fe18565124521da4efa63ec857d8d9b6b3e248c1c4ea4497fed5R172 (#12108).

edit: Hm, so #12108 fixed #8330 so that is probably the thing that should be tested.

MartyIX avatar Dec 13 '23 07:12 MartyIX

Can you add a test?

Example of one here https://github.com/dotnet/maui/pull/19283

PureWeen avatar Dec 13 '23 10:12 PureWeen

I can try but it would be great to know if the fix looks ok to you or not.

MartyIX avatar Dec 13 '23 10:12 MartyIX

I can try but it would be great to know if the fix looks ok to you or not.

I need to understand a bit more about why the new code doesn't work, and if the fix here will break other cases. The view that it's currently using is a container view that sometimes gets created around the platform view. In some cases that container view will have visible parts. For example, if you add a background to a Label that background will be a view around the label that displays the background . So, I think this PR will cause some scenarios like that to become incorrect.

My guess at what is happening here is that the ContainerView is expanding to fill the entire horizontal space and then the image is just occupying the center. I'm curious if that's intentional or if there's a bug with ContainerView and it needs to be sized more correctly.

PureWeen avatar Dec 14 '23 03:12 PureWeen

@PureWeen I don't know the code in depth to add any meaningful comment right now. However, I believe it's worth taking a step back and trying to first establish what platform is actually affected by a bug. For that purpose I have modified https://github.com/dotnet/maui/issues/19329#issue-2035030939 and added animations of the behavior on Windows and macOs for the same MAUI application.

The fact that the same source code leads to different outcomes on both platforms leads me to believe it's a bug.

However, given your previous response, I'm not actually sure if Windows or macOS behaves differently than as expected.

Could you take a look at those two animations please?

MartyIX avatar Dec 14 '23 07:12 MartyIX

@PureWeen I don't know the code in depth to add any meaningful comment right now. However, I believe it's worth taking a step back and trying to first establish what platform is actually affected by a bug. For that purpose I have modified #19329 (comment) and added animations of the behavior on Windows and macOs for the same MAUI application.

The fact that the same source code leads to different outcomes on both platforms leads me to believe it's a bug.

However, given your previous response, I'm not actually sure if Windows or macOS behaves differently than as expected.

Could you take a look at those two animations please?

Nevermind :-) I see what's going on here now. We just made a bad refactor and your revert makes sense

PureWeen avatar Dec 15 '23 18:12 PureWeen

/azp run

PureWeen avatar Dec 18 '23 20:12 PureWeen

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Dec 18 '23 20:12 azure-pipelines[bot]

/azp run

PureWeen avatar Jan 04 '24 17:01 PureWeen

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Jan 04 '24 17:01 azure-pipelines[bot]

/azp run

PureWeen avatar Jan 04 '24 21:01 PureWeen

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Jan 04 '24 21:01 azure-pipelines[bot]

OpenQA.Selenium.WebDriverException : An unknown server-side error occurred while processing the command. Original error: Error Domain=io.appium.WebDriverAgentMac Code=1 "Only pointer type 'mouse' is supported. 'touch' is given instead for action with id '0164df41-a79d-42c1-9f78-c4742f81238c'" UserInfo={NSLocalizedDescription=Only pointer type 'mouse' is supported. 'touch' is given instead for action with id '0164df41-a79d-42c1-9f78-c4742f81238c'}

I'll work on this one tomorrow

we're close

PureWeen avatar Jan 05 '24 01:01 PureWeen

/azp run

PureWeen avatar Jan 05 '24 18:01 PureWeen

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Jan 05 '24 18:01 azure-pipelines[bot]

/azp run

PureWeen avatar Jan 08 '24 16:01 PureWeen

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Jan 08 '24 16:01 azure-pipelines[bot]