Map clicking and panning events

2 posts, 1 answers
  1. Marc
    Marc avatar
    1 posts
    Member since:
    Oct 2012

    Posted 30 Jan 2014 Link to this post

    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.
  2. Answer
    Alexander Popov
    Alexander Popov avatar
    1445 posts

    Posted 03 Feb 2014 Link to this post

    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.

    Alexander Popov

    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).

Back to Top