none
infobox.setMap(map): delay of infobox drawing RRS feed

  • Question

  • Based on the joined code, i notice that infobox.getVisible() returns false right after its insertion in map instead of true.

    I don't think it's a normal behavior. The element should be considered as visible right away.

    I guess it's a delay between the node insertion in the map and the calculus of the infobox position to set.

    Can something be done to make the code synchronous ?

    var map = new Microsoft.Maps.Map(document.getElementById('myMap'), {
        credentials: 'Your Bing Maps Key',
        center: new Microsoft.Maps.Location(47.60357, -122.32945)
    });
    var center = map.getCenter();
    var infobox = new Microsoft.Maps.Infobox(center, { title: 'Map Center',
        description: 'Seattle' });
    console.log('infobox visible before setMap: ', infobox.getVisible()); // Should return false: returns false
    infobox.setMap(map);
    console.log('infobox visible after setMap: ', infobox.getVisible()); // Should return true: returns false
    setTimeout( () => { 	
    	console.log('infobox visible 1s after setMap: ', infobox.getVisible()); // Should return true: returns true
    }, 1000);
    

    Monday, October 10, 2016 1:09 PM

Answers

  • The team has looked into this and it ends up this is by design. The reason for this is that the infobox is rendered asynchronously. As such when you get the visibility right after attaching the infobox to a map, it isn't yet rendered and thus the visibility is false. This is by design.

    [Blog] [twitter] [LinkedIn]


    Wednesday, November 2, 2016 6:30 PM

All replies

  • Very odd. Thanks for reporting. I'll have the team look into this.

    [Blog] [twitter] [LinkedIn]

    Monday, October 10, 2016 9:18 PM
  • The team has looked into this and it ends up this is by design. The reason for this is that the infobox is rendered asynchronously. As such when you get the visibility right after attaching the infobox to a map, it isn't yet rendered and thus the visibility is false. This is by design.

    [Blog] [twitter] [LinkedIn]


    Wednesday, November 2, 2016 6:30 PM