Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Virtual Earth SharePoint webpart double-click bug

  Asked By: Tara    Date: Aug 11    Category: Sharepoint    Views: 1163

As I have been unable to find anyone with the same problem, I seek
advice on how to solve this issue - I consider it a bug.

I have built a simple SharePoint web part that implements Microsoft
Virtual Earth maps and I have placed the web part on a SharePoint page.
The view of the map works exactly as expected, except for one error or

I built the webpart by simply rendering two div tags using an
HtmlTextWriter, one called "message" for messages to the user and one
called "myMap" that contains the map. I also render a little javascript
that adds the InitailizeMap() function in my Maps.js file to the OnLoad
function. I also override the OnInit and added two javascript controls
to the page header, one that uses
"dev.virtualearth.net/.../....ashx?v=6" as the
source (for using VEMaps), and one that uses "/_layouts/1033/Maps.js" as
the source.

Maps.js looks like this:

var map = null;

function InitializeMap()
map = new VEMap('myMap');
map.LoadMap(null, 4, 'r', false);
map.AttachEvent('oninitmode', GetMapView);
map.AttachEvent('onchangeview', MapViewChanged);

catch (e)
alert('error in InitializeMap: ' + e.name + ' ' + e.message );

function GetMapView()
view = map.GetMapView();
topleft = view.TopLeftLatLong;
bottomright = view.BottomRightLatLong;
info = 'TopLeftLatLong: ' + topleft + '<br/>';
info += 'BottomRightLatLong: ' + bottomright + '<br/>';
message.innerHTML = info;

function MapViewChanged(ev)
view = map.GetMapView();
zoomLevel = ev.zoomLevel;
topleft = view.TopLeftLatLong;
bottomright = view.BottomRightLatLong;
info = 'TopLeftLatLong: ' + topleft + '<br/>';
info += 'BottomRightLatLong: ' + bottomright + '<br/>';
info += 'Zoom Level: ' + zoomLevel + '<br/>';
message.innerHTML = info;

As you can see, there isn't much there; I'm just displaying some
information about the map as the view changes. As I said before,
everything works great, except for one small bug. It functions
identically in Firefox and in IE.

The bug in question only manifests itself when the user uses the scroll
bars of the browser to view the map more completely. When the user
views the page using higher resolution than 800 by 600 pixels or
refrains from using the browser scroll bars when viewing the map, the
bug is not manifest. However, when the user scrolls either down or
right using the browser scroll bars, the map does not center correctly
when the user double-clicks on the map. When the user scrolls down or
scrolls right, the map seems to think the desired center of the map is
in relation to the top-left corner of the page and not the top-left
corner of the map.

For instance, I set the dimensions of the "myMap" div to be 600 by 450
pixels. A user brings up the map using 800 by 600 pixels resolution and
can't quite see the entire map, so the user scrolls down a little and to
the right a little. The user then double-clicks on Denver, but the map
zooms in to center on Wyoming.



1 Answer Found

Answer #1    Answered By: Geraldine Slater     Answered On: Aug 11

In case anyone is interested, I was not able to solve  this problem
satisfactorily using Microsoft Virtual Earth, so I simply changed the
web part  to implement the Google Maps API. The web  part now functions
without the double-click/zoom issue. If anyone can discover how to
eliminate the double-click/zoom issue  using Virtual Earth, I would
still be interested in learning how to do so.

Didn't find what you were looking for? Find more on Virtual Earth SharePoint webpart double-click bug Or get search suggestion and latest updates.