Skip to content

Swipe gestures attached to rotated controls are rotated on Android #15280

@bat-kin

Description

@bat-kin

Description

If you have a SwipeGestureRecognizer attached to an object with a rotation set to anything other than 0, the gesture registers relative to the object's rotation on Android. For example, you might have to swipe down to trigger a swipe left. The swipe gesture behaves as expected on Windows.

Steps to Reproduce

Using the below sample, watch as the gesture direction rotates every time the image itself rotates.

XAML

<Image
     x:Name="BotImage"
     Source="dotnet_bot.png"
     SemanticProperties.Description="Cute dot net bot waving hi to you!"
     HeightRequest="400"
     HorizontalOptions="Center" >
     <Image.GestureRecognizers>
          <SwipeGestureRecognizer Direction="Up" Swiped="SwipeGestureRecognizer_Swiped" Threshold="20"/>
          <SwipeGestureRecognizer Direction="Down" Swiped="SwipeGestureRecognizer_Swiped" Threshold="20"/>
          <SwipeGestureRecognizer Direction="Left" Swiped="SwipeGestureRecognizer_Swiped" Threshold="20"/>
          <SwipeGestureRecognizer Direction="Right" Swiped="SwipeGestureRecognizer_Swiped" Threshold="20"/>
     </Image.GestureRecognizers>
</Image>

<Label x:Name="MessageBack" Text="Try a swipe" FontSize="32" HorizontalOptions="Center" />

C#

private void SwipeGestureRecognizer_Swiped(object sender, SwipedEventArgs e)
{
     MessageBack.Text = $"Swiped {e.Direction.ToString().ToUpper()}. Try again.";
     BotImage.Rotation += 90;
}

Link to public reproduction project repository

https://github.com/bat-kin/MauiBug

Version with bug

7.0.86

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 13

Did you find any workaround?

No

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-gesturesGesture typespartner/syncfusionIssues / PR's with Syncfusion collaborationplatform/androids/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions