How do I rotate a image with a gesture recognizer? Why do they have swipe, pinch and such, but not r

How can I rotate an image with a gesture recognizer? With one finger. Do I have to use a pan recognizer?

Best Answer

Answers

  • LandLuLandLu Member, Xamarin Team Xamurai

    MR.Gestures has implemented the rotation gesture you could consume it: https://www.mrgestures.com/
    Here is the sample: https://github.com/MichaelRumpler/GestureSample/tree/master/GestureSample/GestureSample/Views

  • begreatabegreata Member

    that NuGet costs 40 euro tho?

  • begreatabegreata Member

    LandLu Is it possible to make a circular swipe gesture recognizer?

  • Jane_NatalieJane_Natalie Member ✭✭✭

    @LandLu what does consume it mean? It looks like you need a license to use that nuget?

  • Jane_NatalieJane_Natalie Member ✭✭✭

    @igorkr_10 Do you how to get the x and y translation of a content page? App.Screenheight and such solutions returns a number that is not compatible with the translation values. I am trying to find the x and y translation values in the middle of the screen (center horizontal and vertical). :)

  • igorkr_10igorkr_10 Member ✭✭✭✭
    edited October 2019

    @Jane_Natalie I think you get ScreenHeight in pixels. Default XF units are 160 unit/inch
    Try to use Page height (which measures in standard XF units) like there or just by overriding method OnSizeAllocated in your view instead of ScreenHeight.
    Also I wrote properties in my App.cs:

    public static double ScreenWidth
            {
                get
                {
                    return Current.MainPage.Width;
                }
            }
    
            public static double ScreenHeight
            {
                get
                {
                    return Current.MainPage.Height;
                }
            }
    

    And normally translation is 0 for every element in page. It is only used for setting offset to element. F. e. when you change TranslationX the X coordinate of view doesn't change.

    Note: if you want to rotate view use Rotation property

Sign In or Register to comment.