| Issue 2588: | Calling setVisible(false) on Panorama object with a listener attached causes a JS error in IE | |
| 2 people starred this issue and may be notified of changes. | Back to list |
This is a bit tricky to explain, but basically if you create a panorama object in a separate div and tell the map to use that, then add a listener to the visible_changed event on that panorama, and then call setVisible(false) because you don't want it displayed yet, and then drag the pegman onto the map (thereby causing the event to fire) you will get a JS error stating that "je is null or not an object". The panorama window then shows the address but no image. In FireFox the error does not appear but the panorama does not appear correctly either. I'm sure this was not the case a few days ago. Sample page below to reproduce the problem. Changing the setVisible(false) to be before the listener is defined makes no difference. <html> <head> <script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3&sensor=false"></script> <script type="text/javascript"> var paris; var map; function initialize() { paris = new google.maps.LatLng(48.85661, 2.35077); var mapOptions = { zoom: 8, center: paris, scaleControl: true, streetViewControl: true, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions); var panoramaOptions = { enableCloseButton: true }; panorama = new google.maps.StreetViewPanorama(document.getElementById("pano"),panoramaOptions); //Create the main Street View Panorama object. map.setStreetView(panorama); //bind it to the map to override the default one. google.maps.event.addListener(panorama,'visible_changed',function() { alert("listener fired"); }); panorama.setVisible(false); } </script> </head> <body onload="initialize()"> <div id="pano" style="width:100%; height:300px; top:0px;"></div> <div id="map_canvas" style="width:100%; height:300px;"></div> </body> </html>
Jul 22, 2010
#1
[email protected]
Jul 22, 2010
(No comment was entered for this change.)
Labels:
Browser-IE8 Internal-2861818
Jul 22, 2010
Thank you for your report, this seems to happen only on IE 8 when calling panorama.setVisible(false) before dropping the pegman.
Status:
Confirmed
Jul 22, 2010
I've been doing some more playing with this myself to try and work around it (I only show the div when the user drops the pegman, the user usually has a full-screen map). Having tried to work around it and removed all references to panorama.setVisible(false) I still get the error so perhaps the problem is more deep-rooted or setVisible(false) is called internally by the API at some point.
Aug 4, 2010
Issue 2615 has been merged into this issue.
Aug 4, 2010
(No comment was entered for this change.)
Status:
Fixed
Labels: Fixed-3.1 |
|
| ► Sign in to add a comment |