It seems that, in the last few hours, Microsoft have pushed out a new release of the Bing Maps AJAX control (or, maybe their content delivery network has only just started serving a new version – the timestamp attached to the library URL, http://ecn.dev.virtualearth.net/mapcontrol/v7.0/js/bin/7.0.20110426171249.81/en-us/veapicore.js, suggests that it may have been compiled 10 days ago, on 26th April 2011).
This is a minor release – it’s not version 7.1 – so you wouldn’t normally expect to see much in the way of new features. However, it is significant since it appears to resolve a fairly crippling bug that previously made the map control unusable if instantiated in a container of the page that was not visible on initial load (i.e. if you wanted your map to be absolutely positioned in a div near the bottom of a long page that required the user to scroll to get to it).
There is also at least one change made to the default behaviour of the map, in that panning now exhibits an inertia effect – the map does not abruptly stop when you release the mouse button after panning, but slides to a gradual standstill. This change follows the trend of a lot of previous enhancements to v7, in making the AJAX control behave more like its Silverlight cousin (which has always had optional inertia).
You don’t need to do anything to use the new version – any requests to the v7 library will automatically retrieve the latest version, as follows:
Of course, you might not want to use the new inertia effect. A quick dig around the code reveals that there is now a useInertia boolean property that can be passed in the mapOptions of the map constructor. To disable the inertia effect, create your map as follows:
map = new Microsoft.Maps.Map( document.getElementById("divMap"), { credentials: "ENTER YOUR KEY", center: new Microsoft.Maps.Location(54, -2), zoom: 4, mapTypeId: Microsoft.Maps.MapTypeId.road, useInertia: false } );
You can also change the intensity of the inertial effect by setting the inertialIntensity property. If you want to make yourself dizzy, try the following and then give the map a give flick!
map = new Microsoft.Maps.Map( document.getElementById("divMap"), { credentials: "ENTER YOUR KEY", center: new Microsoft.Maps.Location(54, -2), zoom: 4, mapTypeId: Microsoft.Maps.MapTypeId.road, useInertia: true, inertiaIntensity: 1 } );
It’s almost impossible to make a side-by-side comparison of any other changes that occur between versions – the source code of the control is obfuscated, causing functions and parameters to be renamed with random letters between versions, so z = new function(cB, a) might be exactly the same as A = new function(h, t), but without comparing line-by-line you can’t be certain.
However, a quick examination of the new library does reveal some other interesting things to note:
- New touch events: “touchstart“, “touchmove“, “touchend“, and “touchcancel“
- New classes: Microsoft.Maps.Streetside and Microsoft.Maps.VenueMaps
Of course, you can’t necessarily infer too much based only on the name of a class in the library but, even if these features aren’t exposed yet, it’s interesting to see what might be coming just round the corner…