[macOS] Fix `GesturePlatformManager.CalculatePosition` when asked for a relative position
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
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.
Cursor is in both cases in the right-bottom corner of the red robot image.
Before
After
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.
Can you add a test?
Example of one here https://github.com/dotnet/maui/pull/19283
I can try but it would be great to know if the fix looks ok to you or not.
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 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?
@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
/azp run
Azure Pipelines successfully started running 3 pipeline(s).
/azp run
Azure Pipelines successfully started running 3 pipeline(s).
/azp run
Azure Pipelines successfully started running 3 pipeline(s).
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
/azp run
Azure Pipelines successfully started running 3 pipeline(s).
/azp run
Azure Pipelines successfully started running 3 pipeline(s).