Bing Microsoft.Maps.Layer.add function bug RRS feed

  • Question

  • I am experiencing something similar to this problem:

    When I try to display a pushpin on top of other pushpins in a layer by removing it from the layer and adding it back in at index 0, the the removed/re-inserted pushpin ends up at the end of the list of pushpins, and thus, at the bottom of stack, visually, due to the way that the pushpins are rendered on the Canvas element.

    I reproduced this behavior in the Bing Maps V8 interactive SDK page with the Branch set to Release using this code:

    var map = new Microsoft.Maps.Map(document.getElementById('myMap'), {});

    var center = map.getCenter();
    var center_offset_by_a_bit = center.clone();
    center_offset_by_a_bit.longitude += 0.005;
    var red_pushpin = new Microsoft.Maps.Pushpin(center, { color: 'red' });
    var blue_pushpin = new Microsoft.Maps.Pushpin(center_offset_by_a_bit, { color: 'blue' });
    var layer = new Microsoft.Maps.Layer();
    document.getElementById('printoutPanel').innerHTML =
        'Red on top of blue<br>swapping red and blue in 2 seconds...';
    setTimeout(function() {
    layer.add(blue_pushpin, 0);
    document.getElementById('printoutPanel').innerHTML +=
    '<br>Should be blue on top of red now. Is it?';
    }, 2000);

    What am I doing wrong here?
    Thursday, February 15, 2018 5:01 PM


All replies