Posts

no events are raised if InputTransparent == true (on iOS there are also no events if any container has InputTransparent)

@JohnEeckhout requested this and I rejected it first because it is a breaking change. But as I raised the minor version now, I think it is ok.

Hello @MichaelRumpler
Regarding these different behaviors between the different platforms. Wouldn't it make sense for all platforms to follow the iOS way (unless there's something technical limiting you from making it the same behavior)
It would significantly reduce the code needed to make it work as expected (For example you don't have to worry about dynamically added elements).

Hello @MichaelRumpler
I have implemented the Swipe gesture in a custom listview cell. What I'm noticing on Android devices (we haven't begun to work on our iOS implementation yet) is that the user must be very deliberate in swiping horizontally.

At first I thought this was just behavior in the emulator since swiping with a mouse is easier said than done! However, QA is reporting the same experience on physical devices and it is taking sometimes 5 to 10 tries to get the swipe to fire properly.

As you can see we're not doing anything really special with regards to the Swiped event. We are using a licensed ersion of the library. Is there anything you can suggest to help us improve on the UX we're seeing? Thanks in advance.

@JensDemey said:
Regarding these different behaviors between the different platforms. Wouldn't it make sense for all platforms to follow the iOS way (unless there's something technical limiting you from making it the same behavior)

This difference is nothing I implemented. That comes from the OS and the way Xamarin.Forms handles it. I didn't handle InputTransparent at all before and I still don't look at any child or parent elements when I handle gesture events. I handle all controls the same.

@WilliamSmith
Android and Windows try to optimize the scroll performance and consume pan events in ListViews (and ScrollViews) when they think these events are for them. So if you start your swipe gesture not exactly horizontal, then they think it is a vertical scroll and don't forward any events to me. Unfortunately there's nothing I can do about that. Or at least I don't know how. If you find something, then please let me know.

I'm trying to make sure MR.Gestures will handle Swipe gestures on a ListView for Android and iOS devices before I buy it. It looks like a valid license key is required for the SwipeDirection to come back as anything except "NotClear". Can someone confirm this works properly? I've seen others having this problem and Michael suggesting this be tweaked, but none of the values I have tried are making a difference.

Michael Rumpler, when I try to use your license key I get an error in both Andriod and iOS versions saying the license key isn't valid. When I comment out the line that throws the exception just mentioned, it runs but the values are missing which is why I asked the question. Testing on iOS shows the events weren't even firing without the key making it impossible to evaluate for my needs before buying.

Thank you @ShawnCastrianni.5092. All of the MRGesture features I need are working in the sample app. However, your suggestion will allow me evaluate MRGesture in the context of my app. I see this was included in his docs. My bad.

Hi, @MichaelRumpler. I came across something odd as I was testing MR.Gestures that I thought you might want to be aware of. It appears that in the Android environment, the on-screen sizing of Buttons enhanced with MR.Gestures is different than normal Xamarin Forms buttons. MR.Gestures.Buttons are appear larger, given the same size parameters. The first of the two images below shows a set of five standard Xamarin Forms buttons in a StackLayout. The second image shows the same five buttons with the third button as a MR.Gestures.Button. Again, this appears to happen ONLY in the Android environment.

Hello, again, @MichaelRumpler. One more thing I've found -- this time an anomaly in the iOS environment. I added MR.Gestures enhancement to a ContentPage in order to enable the "Down" event to capture page-level coordinates for tap events. Interestingly, this seems to have disabled Click events for all the normal Xamarin Forms Buttons on the page. Remove MR.Gestures from the ContentPage and the Click events fire as expected. I've attached a simple test app that shows the problem. Again, this appears to happen ONLY in the iOS environment.

One strange thing is that if I read the print out in the "txt" label I get "StackHolder Width:2999, anchX:390" just when I start pinching at the very end of the image/grid and not around 2900 as I would expect.

Only problem now is that it "flickers" pretty much and I guess that is because I update the anchor point all the time, is there an event that get raised when I stop pinching? in that case I can put a boolean in as a flag so it only updates that point each time I start.

You should not manipulate the container on which you handle the Pinching event, but only a child. See this FAQ.

After Pinching it raises Pinched.

In my GestureSample.ViewModels.TransformViewModel I have these lines:

protected void SetAnchor(Point center)
{
// in AnchorX/Y 0.0 means the top left corner and 1.0 means the bottom right
// unfortunately I don't know how to calculate this correct if Translation, Scale and Rotation is used

So, sorry, I don't know it either.
It should be possible with some simple matrix algebra, but I'm too long out of school and I forgot how that works.

Hi again, it wasn't the continues updates of the anchorpoint that I first thought, I was an easy fix wit the Up event but it still flickers alot. Is there a problem with putting the scaling directly on the StackLayout as I did now?

Hi again @MichaelRumpler, I was afraid that was the problem, have to find some other way then. But do you know why I get so strange values on e.Center.X as I was getting in my first example, the handler has the width of 2999 of the stacklayout but the e.center.x only gives me around 400 at the furthest right side?

I need to move all the red bordered grid inside the main grid and also they can overlap or can be placed anywhere on the half of the height of the content page. is it possible to move all the red bordered grid separately in MR gesture?

main concern is about moving the grids inside main grid. if it is possible then i am ready to get the key please help!

I just purchased this today and so far so good but I have a problem with buttons.
I have a content view
var dragViewGestures = new MR.Gestures.ContentView
{
Content = layout,
WidthRequest = Application.Current.MainPage.Width,
HeightRequest = Application.Current.MainPage.Height
};

You didn't say on which platform you tried this. At least iOS tries to be smarter than the developer and only raises some events if it thinks, that no other element handles them. This might be the problem here.

Replace the Button with a Label or Image with a Tapped handler then it should work.

@davelynch
I didn't try all events without license. As all properties of the EventArgs have their default values and additional events are only raised, if the fingers are moved by a significant value, Panning (Pinching and Rotating) will only be raised once. The same goes for Tapped (which will only be raised if NumberOfTaps == 1) and DoubleTapped. I can imagine that Panned is not raised due to a similar reason. But if you need Panned, then you also need to know, how far and in which direction the finger was moved, so you need a license anyway.http://www.mrgestures.com/#TrialVersion

@TonyD
I don't think that I can submit a 1.4.2.2 version to NuGet after I submitted a higher version. But I could build something and upload to GitHub. But I don't have time for this today. Hopefully tomorrow.

I have bought a licenses the events now work on iOS! Although I've found that when applying the Panned event to a slider it only fires the firs time you slide, any time after that it doesn't. any ideas?

Apple always strives to help the developer so they do what they think is best. The UISlider from iOS "optimizes" the gestures so that it consumes them and doesn't forward them to any gesture recognizers. This is also documented on http://www.mrgestures.com/#Compatibility.

The checkmark is yellow for the Slider on iOS. This means it does not fully work. Hover over it to see details.

To work around this issue you can make your own image which can be drag&dropped and use that instead of the Slider.

Xamarin introduced a breaking change in XF 2.4.0.266-pre1 as I wrote in the release thread. Therefore MR.Gestures does not work with that version. I suggest you stay on XF 2.3.5.256-pre6 until they release 2.4.0-pre2. They are aware of the problem and already have a fix for it.

When they release 2.4.0-pre2, then you can use MR.Gestures 1.4.2.2 with it. MR.Gestures 1.4.3-pre1 will not work anymore because they changed the fast renderers to be internal. But I already used those in 1.4.3-pre1.

I'm having issues with using panning to modify TranslationY. I have a content view inside a relative layout. When I drag the view up and down it jump up and down extremely quickly. The blue area has the Panning event and when dragging it the contentview TranslationY tends to jump back and forth between where finger is and where it was a few ms before. I also cant get it to keep up with finger movement. So when you start the blue header stays under your finger but if you move quickly or for an extended period your finger ends up a few inches above the blue header. Hard to tell bc of the gif frame rate but I forked the sample repo and have code at Github. Problem occurs with a release build on nexus 6p, so not just debug in emulator.

@MichaelRumpler maybe that wasn't a great example. In our real app underneath the draggable window, we have a map view that fills the screen. I was trying to prevent the user panning the map area from triggering movement of the window, so my goal was to require the panning to begin on the header of the window.

My only other idea would be to put the Panning event on a container and the an Up/Down on the header that sets a variable such as 'AllowMoveInfoWindow', do you have any thoughts on this?

and making sure that in App.xaml.cs MainPage is wrapped in NavigationPageMainPage = new NavigationPage(new App1.MainPage());
so that toolbar is visible.

When I scroll so that Green box is behind the toolbar and click on Toolbar item I get both Alerts - for box itself and toolbar.
When I scroll so that Blue box or blank space is behind the toolbar I get only alert for toolbar.

Expected that in all cases when I click on Toolbar I get only Toolbar alert.