Need a way to differentiate between "mouse click" vs "touch tap" when user clicks/taps map marker.

Hello,

I'm using the map component and the focus of my question is the OnMarkerClick event.

Currently, this event is triggered regardless if the input is a "mouse click" or a "touch tap".

My intention is for the map to have different behavior depending on whether the marker is "clicked" or "tapped"

For example, "mouse click" on a point transports the user to another page, while "tapping" the point just shows a preview of other information. This is driven by the fact that intuitive actions on desktop are not always the same on mobile.


One way to achieve this might be to add some kind of JS based browser detection and check for a mobile browser and pair this together with the OnMarkerClick event. Another way might be to use JS to check the browser window size. However both of these potential solutions have big flaws (for example in the case of touchscreen laptops).


Ideally I think it would be best if the map provided the events for "marker touch start", "marker touch end", "marker mouse down", and "marker mouse up".

I would appreciate any ideas if this is possible.

Thank you!


4 Replies

SB Swetha Babu Syncfusion Team July 1, 2021 02:14 PM UTC

Hi Sorin, 
 
Thank you for contacting Syncfusion support. 
 
We have considered the reported scenario - "marker touch start and marker touch end" as an improvement and logged a request for the same. However, we will include the implementation in our weekly patch release which is scheduled at the mid of July, 2021. Please find the below feedback link to keep track of the implementation. 
 
 
Please let us know if you need further assistance. 
 
Regards, 
Swetha Babu.


SO Sorin July 3, 2021 12:44 PM UTC

Thank you so much Swetha!



SB Swetha Babu Syncfusion Team July 5, 2021 10:09 AM UTC

Hi Sorin, 
 
Thank you for your update. 
 
We will let you know once the fix is available in our weekly patch release. 
 
Regards, 
Swetha Babu.


IR Indumathi Ravi Syncfusion Team July 14, 2021 04:30 PM UTC

Hi Sorin, 
  
Thank you for your patience. 
  
We have exposed a property  “IsTouch” in the event argument of “OnMarkerMouseDown”, “OnMarkerMouseMove” and “OnMarkerMouseLeave” to notify the touch start, touch move and touch end events respectively over the marker. The “IsTouch” property will be “true” when the events are triggered with touch events. We have included this fix in our weekly patch release (v19.2.47). Please update the ”Syncfusion.Blazor.Maps” package to utilize this implementation. Please find the link to the package below. 
  
  
Code Snippet:  
<SfMaps> 
     <MapsEvents OnMarkerMouseMove="MarkerMove" OnMarkerClick="MarkerClick" OnMarkerMouseLeave="MarkerLeave" ></MapsEvents> 
            //.. 
           //.. 
</SfMaps> 
  
@code{ 
    
    public void MarkerLeave(Syncfusion.Blazor.Maps.MarkerMouseLeaveEventArgs args) 
    { 
        Console.WriteLine(args.IsTouch); 
    } 
  
    public void MarkerMove(Syncfusion.Blazor.Maps.MarkerMoveEventArgs args) 
    { 
        Console.WriteLine(args.IsTouch); 
    } 
  
    public void MarkerClick(Syncfusion.Blazor.Maps.MarkerClickEventArgs args) 
    { 
        Console.WriteLine(args.IsTouch); 
    } 
  
Please let us know if you need any further assistance. 
  
Regards, 
Indumathi. 


Loader.
Up arrow icon