Declined
Last Updated: 09 Aug 2019 11:33 by ADMIN
Chris
Created on: 01 Aug 2019 19:28
Category: Map
Type: Bug Report
1
ShapeClick gets fired when panning

When a user clicks on the map outside of a shape (i.e. in an ocean) and drags to pan around the map, the click event does not get fired fired after panEnd.  

When a user clicks on a shape (i.e. a Montana) and then drags to pan around the map, the shapeClick event fires after panEnd.

This issue is reproducible on the events demo page: https://demos.telerik.com/kendo-ui/map/events

 

The events reported when clicking and dragging on a shape, (bottom being first event):

Shape click :: Montana
Pan ended at :: 50.401515,-62.841797
Pan to :: 50.401515,-62.841797
Pan to :: 50.401515,-62.666016
Pan to :: 50.625073,-62.666016
Pan to :: 50.736455,-62.666016

Shape mouseEnter :: Montana

3 comments
ADMIN
Marin Bratanov
Posted on: 09 Aug 2019 11:33
Thank you for the clarification, Chris.

The tile layer is just a few elements that are standard HTML elements, the element behind the shapes is a single div, while a shape layer consists of a lot of SVG elements, and attaching events to all of them like that is likely to deteriorate performance and may also break other scenarios developers rely on.

We haven't had other people raise this as a problem in the several years since this has been available, which leads me to believe that the current behavior is acceptable for the majority of the users of this widget. Thus, considering that a workaround can be made if this is unwanted, we would rather avoid the risk of breaking existing scenarios and causing worsened performance.


Regards,
Marin Bratanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Chris
Posted on: 08 Aug 2019 12:31
Marin, I understand the functionality that it currently exhibits, and I understand that I clicked on a shape.  What I was pointing out was that when you click with out dragging while NOT over a shape, you get the click event, when you click and drag while NOT over a shape, you do not get the click event.  You always get the click event when clicking on a shape.  That's the difference, and really does feel like a bug to me.  Why suppress one click event but not the other?
ADMIN
Marin Bratanov
Posted on: 08 Aug 2019 09:29
Hi Chris,

In this scenario, a click was actually executed on the shape. If you click and hold the left button on an element, move the mouse around that element, and release the button, the click event of the element will fire. This is what happens here, the difference is that the element moves around with the mouse because of the dragging feature. Here's a basic example that illustrates this browser behavior: https://dojo.telerik.com/@bratanov/ONiDIRoC. Since such behavior is the normal browser behavior, I believe it is expected of the map to fire the click event on a shape in such a scenario.

If you don't want logic tied to shape click to execute after panning, using a simple throttling technique on the panEnd event can let you check for a flag to know whether there was a pan that happened, or only a click. A basic example of throttling an event is available here: https://stackoverflow.com/questions/667426/javascript-resize-event-firing-multiple-times-while-dragging-the-resize-handle/668185#668185.


Regards,
Marin Bratanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.