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.08k stars 1.73k forks source link

Ellipse get distorted when scaled down on Android 7 and lower #25270

Open slimf1 opened 4 days ago

slimf1 commented 4 days ago

Description

Hi,

The shape of an ellipse becomes distorted when scaled down using the ScaleTo method only on Android 7 (API 24) and below. This used to work in Xamarin.Forms.

It works fine starting from Android 7.1 I also observed some unusal behavior when using scales higher than 1

I've attached a video and a public repo with a reproduction. This is reproducible on a real device. https://github.com/user-attachments/assets/f2eac262-1ccd-4144-91e6-e822c2202b17

For example, the following code-behind and XAML results in a broken shape :

private async void Button_OnClicked(object? sender, EventArgs e)
{
    await Ellipse.ScaleTo(0.5, 1000);
}
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="MauiApp2.MainPage">

    <ScrollView>
        <VerticalStackLayout
            Padding="30,0"
            Spacing="25">
            <Button
                Text="Animation"
                Clicked="Button_OnClicked" />
            <Ellipse
                x:Name="Ellipse"
                BackgroundColor="Red"
                HeightRequest="200"
                WidthRequest="200"
                HorizontalOptions="Center" />
        </VerticalStackLayout>
    </ScrollView>

</ContentPage>

Steps to Reproduce

  1. Use Android 7 or lower
  2. Create an ellipse element in XAML or code-behind
  3. Scale it down using the ScaleTo animation method, using await Ellipse.ScaleTo(0.5, 1000);
  4. Trigger the animation using a Button click

Expected outcome : The animation should result in a smaller circle Actual outcome : The shape becomes distorted

Link to public reproduction project repository

https://github.com/slimf1/MauiEllipseBugRepro

Version with bug

8.0.91 SR9.1

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 7 and below

Did you find any workaround?

None yet

Relevant log output

No response

Zhanglirong-Winnie commented 4 days ago

This issue has been verified using Visual Studio 17.12.0 Preview 2.1(8.0.91 & 8.0.90 & 8.0.3). Can repro this issue on android7.0 platform.