GestureSample
GestureSample copied to clipboard
PanEventArgs.Center always NaN on android
Hello! I´m using the following event handler for android and ios: ` scheduleLayout.Panning += (object sender, MR.Gestures.PanEventArgs e) => { Debug.WriteLine("ScheduleOne :: StackLayout :: Panning");
var hw = scheduleLayout.Children.ElementAtOrDefault(0) as HourView;
if (hw == null) return;
xMax = hw.XMax;
if (e.Center.X <= xMax)
{
//Unreachable code
}
}
`
e.Center.X and e.Center.Y are always NaN under android. iOS is workig fine. Any tips?
Best regards
Sorry, I can't reproduce that. In the GestureSample the sample Layouts / AbsoluteLayout sets the blue mark at the Center
position when you touch the display with 2+ fingers. This works as expected.
Center
is also implemented in the shared base class of all my EventArgs
. It works the same for all events on all platforms.
Can you send me a repro project?
Yes, I sent you an email. Thank you very much!
I created a repo here on github: https://github.com/isoindisystems/MrGeasturesPanningRepo
Your repo doesn't use Center
at all. But I added that and it is indeed NaN
.
You used the LicenseKey
of the "mySolarfocus" app for the "App5.Android" app. This cannot work and should actually throw an Exception
. If no LicenseKey
is set, then most values within the EventArgs
are not set. This is intended. See https://www.mrgestures.com/#EmptyEventArgs.
You also set the LicenseKey
before the call to Xamarin.Forms.Forms.Init()
. This can sometimes prevent me from reading the app name. So please move that after the Init()
call.
So if you use Center
in the mySolarfocus app, then it should have some values. If you want to use it in another app, then please buy a license for that one too.
I will see that the Android code also throws an Exception
if the LicenseKey
does not match the app name.
Ok thats very interesting, because on iOS the old key works for the new app name. Well that´s no problem, if we can fix this with buying a new license code, we have no problem here. Thank you very much!