none
How do I simulate a mouseup/click on a Bing map? Map drag problem RRS feed

  • Question

  • Hi guys,

    When a user clicks on the map and drags the mouse outside of the map div, the drag/scrolling continues when they return their mouse to the map div, creating an uncontrollable scroll that is pretty frustrating. This only seems to happen in Chrome, and I'm assuming it has something to do with the click event, and mouseup not being called correctly or something like that, so I assumed that calling a mouseclick event on the map object would stop the dragging mechanism once viewchangeend was called by the map. Something like this:

    Microsoft.Maps.Events.addHandler(map, 'viewchangeend', function(){
    Microsoft.Maps.Events.invoke(map,'click');
    }); 

    That didn't work, but am I on the right track?

    For some reason, I wasn't able to pass the event into the function either. e would be undefined, and I couldn't check e.target.

    I couldn't find any information on solving this problem online so I thought I'd ask here. Hopefully you guys can help.

    • Moved by Ricky_Brundritt Friday, March 16, 2012 6:54 PM (From:Bing Maps: Map Control and Web services Development)
    Tuesday, February 7, 2012 11:50 PM

Answers

All replies

  • How about using standard JavaScript to invoke the event i.e. document.getElementById('myMap').click();

    http://rbrundritt.wordpress.com

    Saturday, March 10, 2012 1:28 PM
  • @Richard: there's nothing standard about a click() method on divs.

    ps it results in a TypeError.

    Sunday, March 11, 2012 2:31 AM
  • I am not able to repro the behaviour on chrome using http://www.bingmapsportal.com/ISDK/AjaxV7. I keep on dragging map & release mouse out side container. Once I bring the mouse back in map, mouse has default behaviour. Could you send more info I am missing?  


    MSFT
    Hemant Goyal

    Sunday, March 11, 2012 7:05 AM