none
Pushpin experimental htmlContent RRS feed

  • Question

  • I noticed Microsoft secretly released a new Pushpin feature (http://www.bingmapsportal.com/isdk/ajaxv7#Pushpins15).  As of Sep 28, 2012 the documentation, blogs, media releases, and fora do not mention this new PushpinOptions property.

      • Is this official or experimental?  Would you recommend using it on production?
      • Why does the pushpin click event stop working within nested EntityCollections in Firefox and Chrome?
        // Nested EntityCollection (pointer-events bug); run this in the SDK code textarea
        map.entities.clear(); 
        
        var pushpinOptions = {width: null, height: null, htmlContent: "<div style='font-size:12px;font-weight:bold;border:solid 2px;background-color:LightBlue;width:100px;'>Custom Pushpin</div>"}; 
        
        var pushpin = new Microsoft.Maps.Pushpin(map.getCenter(), pushpinOptions); 
        
        pushpinOver = Microsoft.Maps.Events.addHandler(pushpin, 'click', function () { alert('heoll'); } );
        
        
        var layerCollection = new Microsoft.Maps.EntityCollection();
        var pinCollection = new Microsoft.Maps.EntityCollection();
        
        pinCollection.push(pushpin);
        layerCollection.push(pinCollection);
        
        map.entities.push(layerCollection);
    -=Dan=-
    Friday, September 28, 2012 9:36 PM

Answers

  • This was officially released in August. The MSDN documentation hasn't been updated and there wasn't much else released so there was no announcement made on the blog.

    As for the EntityCollection issue this was discussed a while ago on the blog. The issue is with collections blocking the mouse events. Try using the Complex Shapes module as there is a new EntityCollection class in there.


    http://rbrundritt.wordpress.com

    Monday, October 1, 2012 7:54 AM

All replies

  • This was officially released in August. The MSDN documentation hasn't been updated and there wasn't much else released so there was no announcement made on the blog.

    As for the EntityCollection issue this was discussed a while ago on the blog. The issue is with collections blocking the mouse events. Try using the Complex Shapes module as there is a new EntityCollection class in there.


    http://rbrundritt.wordpress.com

    Monday, October 1, 2012 7:54 AM
  • Here's my code using the Advanced Shapes module.  The bug is still there with the new EntityCollection

    map.entities.clear();/* run this in the SDK code textarea*/ 
    function createPolygon() 
    {
        map.entities.clear(); 
        latlon = map.getCenter(); 
        var polygon = new Microsoft.Maps.Polygon([ 
                            [new Microsoft.Maps.Location(latlon.latitude, latlon.longitude-0.15), new Microsoft.Maps.Location(latlon.latitude+0.1, latlon.longitude-0.05), 
                                new Microsoft.Maps.Location(latlon.latitude+0.1, latlon.longitude+0.05), new Microsoft.Maps.Location(latlon.latitude, latlon.longitude+0.15), 
                                new Microsoft.Maps.Location(latlon.latitude-0.1, latlon.longitude+0.05), new Microsoft.Maps.Location(latlon.latitude-0.1, latlon.longitude-0.05), 
                                new Microsoft.Maps.Location(latlon.latitude, latlon.longitude-0.15)], 
                            [new Microsoft.Maps.Location(latlon.latitude, latlon.longitude-0.1), new Microsoft.Maps.Location(latlon.latitude+0.05, latlon.longitude-0.05), 
                                new Microsoft.Maps.Location(latlon.latitude+0.05, latlon.longitude+0.05), new Microsoft.Maps.Location(latlon.latitude, latlon.longitude+0.1), 
                                new Microsoft.Maps.Location(latlon.latitude-0.05, latlon.longitude+0.05), new Microsoft.Maps.Location(latlon.latitude-0.05, latlon.longitude-0.05), 
                                new Microsoft.Maps.Location(latlon.latitude, latlon.longitude-0.1)],  
                            [new Microsoft.Maps.Location(latlon.latitude, latlon.longitude-0.075), new Microsoft.Maps.Location(latlon.latitude+0.025, latlon.longitude-0.05), 
                                new Microsoft.Maps.Location(latlon.latitude+0.025, latlon.longitude+0.05), new Microsoft.Maps.Location(latlon.latitude, latlon.longitude+0.075), 
                                new Microsoft.Maps.Location(latlon.latitude-0.025, latlon.longitude+0.05), new Microsoft.Maps.Location(latlon.latitude-0.025, latlon.longitude-0.05), 
                                new Microsoft.Maps.Location(latlon.latitude, latlon.longitude-0.075)]  
                                               ]);  
    //    map.setView( {zoom:10});  
        map.entities.push(polygon); 
    }
    Microsoft.Maps.loadModule('Microsoft.Maps.AdvancedShapes', { callback: createPolygon })
    
    // Nested EntityCollection (pointer-events bug)
    
    
    var pushpinOptions = {width: null, height: null, htmlContent: "<div style='font-size:12px;font-weight:bold;border:solid 2px;background-color:LightBlue;width:100px;'>Custom Pushpin</div>"}; 
    
    var pushpin = new Microsoft.Maps.Pushpin(map.getCenter(), pushpinOptions); 
    
    pushpinOver = Microsoft.Maps.Events.addHandler(pushpin, 'click', function () { alert('heoll'); } );
    
    
    var layerCollection = new Microsoft.Maps.EntityCollection();
    var pinCollection = new Microsoft.Maps.EntityCollection();
    
    pinCollection.push(pushpin);
    layerCollection.push(pinCollection);
    
    map.entities.push(layerCollection);

    Tuesday, October 2, 2012 12:23 AM