街景全景完全灰色

Ale*_*and 5 google-maps google-maps-api-3

我创建了街景骨干视图.问题是,当显示时,全景图是完全灰色的.我不确定它是否与标签内的事实有关,并且在打开标签时会呈现全景图.

我猜这可能是一个类似的问题,修复调用resize事件.我能做什么类似的事情吗?

App.DetailStreetView = Backbone.View.extend({
    initialize: function() {
        this.latLng = new google.maps.LatLng(37.869085,-122.254775);
    },
    render: function() {
        var sv = new google.maps.StreetViewService();
        this.panorama = new google.maps.StreetViewPanorama(this.el);
        sv.getPanoramaByLocation(this.latLng, 50, this.processSVData);        
    },
    processSVData: function(data, status) {
        if (status == google.maps.StreetViewStatus.OK) {
            // calculate correct heading for POV
            var heading = google.maps.geometry.spherical.computeHeading(data.location.latLng, this.latLng);
            this.panorama.setPano(data.location.pano);
            this.panorama.setPov({
                heading: 270,
                pitch:0,
                zoom:1, 
            });
        }
    },
    refresh: function() {
        this.panorama.setVisible(true);
        google.maps.event.trigger(this.panorama, 'resize');
    }
});
Run Code Online (Sandbox Code Playgroud)

编辑:

我创建了一个复制问题的JSFiddle:http://jsfiddle.net/kNS2L/3/

Man*_*rks 5

是的,这是旧display:none的地图和全景.它在我添加时有效setVisible(true):

  $('button').click(function() {
        $('#pano').show();
    panorama.setVisible(true);
    });
Run Code Online (Sandbox Code Playgroud)