locked
Touch-Friendly Location Selection RRS feed

  • Question

  • I am using the AJAX control to allow users to select locations on my website by dragging a pushpin. One of my big target audiences is mobile users; and although the dragging works well for desktops, it's really hard to use on a phone or other touch device. I am looking for a way to make the pushpin stay centered in the map view so that as the user drags the view the pushpin fires move events with the location that it was moved to, even though it was never dragged by the user directly.

    How can I do this?


    Wasabi Fan

    Sunday, January 26, 2014 8:49 PM

Answers

  • Here is an idea of how to do this. Add a click event to the pushpin. When clicked store the pushpin in a variable and set a Boolean flag to indicate you are in dragging mode. Attach a viewchange event to the map and if the dragging mode is enabled and a pushpin is stored in the variable, then update it's position with the maps center coordinate. If the user clicks the pushpin a second time then take it out of dragging mode.

    http://rbrundritt.wordpress.com

    • Proposed as answer by Ricky_Brundritt Monday, January 27, 2014 1:24 PM
    • Marked as answer by Ricky_Brundritt Thursday, January 30, 2014 2:22 PM
    • Unmarked as answer by Wasabi Fan Thursday, January 30, 2014 3:15 PM
    • Marked as answer by Ricky_Brundritt Thursday, February 20, 2014 3:28 PM
    • Unmarked as answer by Ricky_Brundritt Thursday, February 20, 2014 3:29 PM
    • Marked as answer by Ricky_Brundritt Thursday, March 13, 2014 10:26 AM
    Monday, January 27, 2014 1:23 PM

All replies

  • Here is an idea of how to do this. Add a click event to the pushpin. When clicked store the pushpin in a variable and set a Boolean flag to indicate you are in dragging mode. Attach a viewchange event to the map and if the dragging mode is enabled and a pushpin is stored in the variable, then update it's position with the maps center coordinate. If the user clicks the pushpin a second time then take it out of dragging mode.

    http://rbrundritt.wordpress.com

    • Proposed as answer by Ricky_Brundritt Monday, January 27, 2014 1:24 PM
    • Marked as answer by Ricky_Brundritt Thursday, January 30, 2014 2:22 PM
    • Unmarked as answer by Wasabi Fan Thursday, January 30, 2014 3:15 PM
    • Marked as answer by Ricky_Brundritt Thursday, February 20, 2014 3:28 PM
    • Unmarked as answer by Ricky_Brundritt Thursday, February 20, 2014 3:29 PM
    • Marked as answer by Ricky_Brundritt Thursday, March 13, 2014 10:26 AM
    Monday, January 27, 2014 1:23 PM
  • I am still trying to test your proposal's validity. Once I have determined that this is the correct answer, I'll mark it as such. But please allow me time to determine if this works.

    Wasabi Fan

    Thursday, January 30, 2014 3:23 PM
  • Sorry about that. It's the end of the month and I'm cleaning up the backlog in the forums.

    http://rbrundritt.wordpress.com

    Thursday, January 30, 2014 4:34 PM