Convert TouchInteractionEventArgs point value to a value relative to the width of the control

Hello,

I want to know if a user tap in the left or in the right side of the control. The code I'm using is:

private void PdfViewer_OnTapped(object a_Sender, TouchInteractionEventArgs a_E)

{

bool? toLeft = null;


if (a_E.Position.X < Width * 0.3)

{

toLeft = false;

}

else if (a_E.Position.X > Width * 0.7)

{

toLeft = true;

}

}


But X value, if I tap on the right edge it's far greater than the Width. How can I transform Point values to map to Width and Height values?.


Or there is any way to get the maximum value  TouchInteractionEventArgs.Point.X can have? 


Greetings,

David


5 Replies

VD Vikram Devaraj Syncfusion Team October 6, 2021 12:49 PM UTC

Hi David,


Based on your query we assumed that you are trying to find the left and right side of the control based on the tapped position.
If your requirement is different from our understanding please provide more details and also to provide better solution please provide more details about your use case scenarios.


Regards,
Vikram
 



DS David Sancho October 6, 2021 12:51 PM UTC

Yes, that its. If the user taps on the left side then the previous pdf will be loaded but if the user taps on the right side then the next pdf will be loaded.



VD Vikram Devaraj Syncfusion Team October 7, 2021 05:18 PM UTC

Hi David,

Currently we are preparing sample based on your requirement to recognize  the left and right side of the control using gesture recognizer. We will update the further details on
October 11, 2021  
 
Regards,
Vikram


 



VD Vikram Devaraj Syncfusion Team October 11, 2021 03:31 PM UTC

Hi David,

We are still working on the sample creation to achieve your requirement “Recognize  the left and right side of the control using gesture recognizer 
”.  We will update the further details on October 13, 2021. We appreciate your patience until then. 

Regards,
Vikram





VD Vikram Devaraj Syncfusion Team October 13, 2021 02:25 PM UTC

Hi David,

 
Thank you for your patience,

We have created a sample as for your requirement “Recognize the left side and right side  when we tap on the control ”. Please find the sample below,

 


Loader.
Up arrow icon