This is a migrated thread and some comments may be shown as answers.

Map clicking and panning events

1 Answer 48 Views
Map
This is a migrated thread and some comments may be shown as answers.
Marc
Top achievements
Rank 1
Marc asked on 30 Jan 2014, 03:43 PM
When the user clicks an area on a map, I want to record the lat/long and create a marker where the click occurred.
I use the 'click' event to achieve this. This works fine, except that when the user pans the map (holds the mouse button and moves the map), I don't want to record the lat/long and create a marker. I basically want to ignore panning.

Inside the click event, is there a way to differentiate between a regular click and a click that occurs as part of the panning? I also tried attaching to the 'panEnd' event, but haven't found anything to achieve what I want, such as some sort of offset value indicating if the map moved.

I'm using Kendo UI Complete v2013.3.1119 with IE10.

1 Answer, 1 is accepted

Sort by
0
Accepted
Alexander Popov
Telerik team
answered on 03 Feb 2014, 10:50 AM
Hi Marc,

In the current scenario I would recommend the following approach:
  1. Attach a handler to the pan event and raise a flag once it's triggered 
  2. Once the click event handler is reached check the flag. If it it's raised then the user has panned, so there is no need to execute the logic in the click event handler.
  3. At the end of the click handler lower the flag.

Regards,
Alexander Popov
Telerik

Check out the new Telerik Platform - the only modular platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native apps. Register for the free online keynote and webinar to learn more about the Platform on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT).

Tags
Map
Asked by
Marc
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or