dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.27k stars 1.76k forks source link

RotateTo & ScaleTo on Android seems to create a funny rotation/scale. #11852

Open FreakyAli opened 1 year ago

FreakyAli commented 1 year ago

Description

The default animation RotateTo method seems to be ignoring the AnchorX and AnchorY property when it's set to 0.5 by default and because of this, it performs a funny rotation on Android. (iOS works as expected).

I have only tested with Android and iOS not sure if this is the case in other platforms as well.

Check the Attached Gif to see how it is instead of how it should be.

Steps to Reproduce

Expected Behavior Actual Behavior

Link to public reproduction project repository

https://github.com/FreakyAli/Maui.FreakyControls/blob/72e03aa3c59174efe6e1f0d061c6d2a5de6f7de8/MAUI.FreakyControls/MAUI.FreakyControls/Shared/FreakyCheckbox/FreakyCheckbox.cs#L91

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 12

Did you find any workaround?

Yes, if you were to add the below code before calling RotateTo, it does work.

if (DevicePlatform.Android == DeviceInfo.Platform)
    skiaView.AnchorY = skiaView.AnchorX = 0.501;
await skiaView.RotateTo(90, 150);

Now here you are setting the Anchor to a value which is a slight bit higher than the default, but this will be invisible to the naked eye.

Let me know if anything else is needed, Thanks!

Relevant log output

No response

FreakyAli commented 1 year ago

It seems that even ScaleTo is affected by the AnchorX/Y

ghost commented 1 year ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

rmarinho commented 1 year ago

@jsuarezruiz have you saw this somewhere?

jsuarezruiz commented 1 year ago

Need to do more test with a SKCanvasView, but cannot reproduce the issue with other Views. issue11852

FreakyAli commented 1 year ago

Need to do more test with a SKCanvasView, but cannot reproduce the issue with other Views. issue11852 issue11852

If you could check it in the provided GitHub link and comment the workaround you will reproduce it, i have tried it multiple times and it is always reproducible

FreakyAli commented 1 year ago

@jsuarezruiz I have checked with the latest version of everything now and its still reproducible I am guessing this is an issue with SKCanvas, you might wanna look into that.

Zhanglirong-Winnie commented 1 year ago

Verified this issue with Visual Studio Enterprise 17.8.0 Preview 1.0(.NET8). Not repro on iOS platform with sample project. It can be debugged successfully on Android, but there is an error in selecting CheckboxsView. Maui.FreakyControls-master.zip iOS: 1 Android: 2

FreakyAli commented 1 year ago

@Zhanglirong-Winnie I do not have access to .Net 8 pre as of right now unfortunately so I cannot confirm if this is fixed or not, but I can confirm that with .net 7 this is still an issue i just checked it earlier and not to mention the same issue occurred a couple days ago in another project of mine

FreakyAli commented 1 year ago

Just confirmed this is still an issue with .NET 8 GA @Zhanglirong-Winnie @jsuarezruiz

Manish-Pradhan-FP commented 11 months ago

Yes this is still an issue when doing VisualElement.RotateTo(-180), it will NOT use the center of the VisualElement for its rotation. Eg: xamButtonElement.RotateTo(-180, 200)

Are there any workarounds for this? Its a significant bug for us.

FreakyAli commented 11 months ago

@Manish-Pradhan-FP I have added a workaround in the bug itself