From 500cc017781808d05c5733d52c900eb0312e3da7 Mon Sep 17 00:00:00 2001 From: euzuro Date: Sun, 16 Jul 2006 18:18:29 +0000 Subject: [PATCH] rearrange loading structure to account for ve libraries not being loaded and for the mozilla match bug git-svn-id: http://svn.openlayers.org/trunk/openlayers@954 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Layer/VirtualEarth.js | 33 ++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/lib/OpenLayers/Layer/VirtualEarth.js b/lib/OpenLayers/Layer/VirtualEarth.js index 2385138405..95c2ad1191 100644 --- a/lib/OpenLayers/Layer/VirtualEarth.js +++ b/lib/OpenLayers/Layer/VirtualEarth.js @@ -75,16 +75,30 @@ OpenLayers.Layer.VirtualEarth.prototype = // create VEMap, hide nav controls this.vemap = new VEMap(this.name); - this.vemap.LoadMap(); - this.vemap.HideDashboard(); - - // catch pans and zooms from VE Map - this.vemap.AttachEvent("onendcontinuouspan", - this.catchPanZoom.bindAsEventListener(this)); - this.vemap.AttachEvent("onendzoom", - this.catchPanZoom.bindAsEventListener(this)); } catch (e) { + // do nothing this is to keep from crashing + // if the VE library was not loaded. + } + + + if (this.vemap == null) { this.loadWarningMessage(); + } else { + + + try { + this.vemap.LoadMap(); + } catch (e) { + // this is to catch a Mozilla bug without falling apart + } + + this.vemap.HideDashboard(); + + // catch pans and zooms from VE Map + this.vemap.AttachEvent("onendcontinuouspan", + this.catchPanZoom.bindAsEventListener(this)); + this.vemap.AttachEvent("onendzoom", + this.catchPanZoom.bindAsEventListener(this)); } }, @@ -142,7 +156,8 @@ OpenLayers.Layer.VirtualEarth.prototype = /** * @param {event} e */ - catchPanZoom: function(e) { + catchPanZoom: function(e) { + var veCenter = this.vemap.GetCenter(); var veZoom = this.vemap.GetZoomLevel();