question

heyyy avatar image
0 Votes"
heyyy asked IoTGirl edited

Bing Maps V8 dispatchevent not working

When clicking on a pushpin, need to programmatically click on something else.

 Microsoft.Maps.Events.addHandler(layer, 'click', function(evt){
             console.log("layerHandler");
             simulateClick();
         });
    
 function simulateClick() {
             console.log("in simulateClick");
           const event = new MouseEvent('click', {
             //view: window,
             bubbles: true,
             cancelable: false
           });
           const elem = [some div]
           console.log("elem: " + elem);
              
           elem.dispatchEvent(event);
         }

simulateClick() works great on its own, outside the Microsoft.Maps.Events.addHandler code block.

The dispatchEvent does not work when simulateClick is called from inside the Microsoft.Maps.Events.addHandler code block. I see all the console messages, but dispatchEvent does not work.

Have spent 3 days trying to troubleshoot. I understand the MS team has worked hard to provide a Bing Maps product but there have been more than a few bugs that I have wasted several days to discover. I expect better from Microsoft.

Please fix.



Also no tags for bing maps and can't enter custom tags. Aggravated and frustrated. What is going on here.

windows-maps
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

heyyy avatar image
0 Votes"
heyyy answered

Nvm it was because of event bubbling. My bad lol

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.