StreetViewPanorama setVisible bug

282 views
Skip to first unread message

Mel

unread,
Jul 23, 2010, 5:38:32 PM7/23/10
to Google Maps JavaScript API v3
In the following code:

<div id="sview" style="width:100%; height:100%"></div>

<script type="text/javascript">

var initialLocation = new google.maps.LatLng(40.760779,
-111.891047); //Salt Lake City
var sview = new
google.maps.StreetViewPanorama(document.getElementById("sview"), {

position: initialLocation,

addressControl: false,

enableCloseButton: false,

linksControl: false,

navigationControl: false,

visible: false });


sview.setVisible(true); //Panorama is properly displayed
...
sview.setVisible(false); //Panorama disappears properly
...
sview.setVisible(true); //Panorama is...still disappeared!

</script>




*Sorry for no link - I discovered this while debugging with a
javascript shell (http://www.squarefree.com/shell/). So I don't
really have a complete example code...

*The bug doesn't show if you do all the setVisible calls in a row -
apparently it has to settle down between each call?

*At the end, sview.getVisible() returns true;

*If sview.setPosition is called at the end, it gets properly displayed
again - but ONLY IF the position being set is different.

*Calling sview.setPov has no effect at the end.

Mel

unread,
Jul 23, 2010, 9:44:42 PM7/23/10
to Google Maps JavaScript API v3
Here is a link that demonstrates the bug:
http://pennyauctionsplus.com/tmp/debug.html

William

unread,
Jul 24, 2010, 12:30:03 AM7/24/10
to Google Maps JavaScript API v3
On Jul 24, 7:38 am, Mel <melman2...@gmail.com> wrote:
>
> sview.setVisible(true); //Panorama is properly displayed
> ...
> sview.setVisible(false); //Panorama disappears properly
> ...
> sview.setVisible(true);  //Panorama is...still disappeared!
>
yeah I see it with your test map, and even though the final panorama
has disappeared, it reappears when you use the mouse scroll wheel
(like you said it gets properly displayed if the position being set is
different).

The bug is kinda similar to the following thread:
http://groups.google.com/group/google-maps-js-api-v3/browse_thread/thread/5fc2aba037635378

...

Mel

unread,
Jul 24, 2010, 7:39:14 AM7/24/10
to Google Maps JavaScript API v3
Okay - yeah, now I see that sview.setPov does have an effect if you
change the zoom.
> The bug is kinda similar to the following thread:http://groups.google.com/group/google-maps-js-api-v3/browse_thread/th...
>
> ...

William

unread,
Jul 24, 2010, 11:08:58 PM7/24/10
to Google Maps JavaScript API v3
I've taken the Street View Events example and modified it to display
the Visible property, with a "Toggle Visibility" link to test it, and
it seems to confirm the bug:
http://www.william-map.com/20100725/2/sv.htm

original example code:
http://code.google.com/apis/maps/documentation/javascript/examples/streetview-events.html

...

iCollins

unread,
Aug 2, 2010, 6:25:10 PM8/2/10
to Google Maps JavaScript API v3
I'm experiencing the same bug and I've seen nothing online about how
to fix it yet, but I was able to come up with a temporary hack. By
changing the zoom level of the panorama each time the visibility
property is set to true, the panorama will remain visible (at least in
Firefox).
Ex:
var pov = panorama.getPov();
var cur_zoom= pov.zoom;
if(cur_zoom > 0){
pov.zoom = 0;
}else{
pov.zoom = pov.zoom + 1;
}
panorama.setPov(pov);

panorama.setVisible(true);
> original example code:http://code.google.com/apis/maps/documentation/javascript/examples/st...
>
> ...
Reply all
Reply to author
Forward
0 new messages