2016-12-01 4 views
0

私は少し問題があり、解決策を見つけることができません。多分誰かがそれを修正する方法を知っているでしょう。 Google StreetViewPanoramaとすべて(ドラッグ、ズーム)が正常に動作するコードは次のとおりです。しかし、このオブジェクトの他のイメージを初期化すると、イメージがオブジェクトにロードされた後、イメージは動作を停止します。ズームもエッジも表示されず、ドラッグは半減します。 イメージを変更する前にオブジェクトを破棄しても機能しません。 このオブジェクトを更新する方法がありますか?StreetViewPanorama - 他の画像に変更するには

function initPano() { 
    // Set up Street View and initially set it visible. Register the 
    // custom panorama provider function. Set the StreetView to display 
    // the custom panorama 'reception' which we check for below. 
    var panorama = new google.maps.StreetViewPanorama(
     document.getElementById('map'), { 
      pano: 'reception', 
      visible: true, 
      panoProvider: getCustomPanorama 
     } 
    ); 
} 
// Return a pano image given the panoID. 
function getCustomPanoramaTileUrl(pano, zoom, tileX, tileY) { 
    // Note: robust custom panorama methods would require tiled pano data. 
    // Here we're just using a single tile, set to the tile size and equal 
    // to the pano "world" size. 
    return 'img/pano-1.jpg'; // <----------- HERE 
} 
// Construct the appropriate StreetViewPanoramaData given 
// the passed pano IDs. 
function getCustomPanorama(pano, zoom, tileX, tileY) { 
    if(pano === 'reception') { 
     return { 
      location: { 
       pano: 'reception', 
       description: 'Description' 
      }, 
      links: [], 
      // The text for the copyright control. 
      copyright: 'Imagery (c) 2010 Google', 
      // The definition of the tiles for this panorama. 
      tiles: { 
       tileSize: new google.maps.Size(1024, 512), 
       worldSize: new google.maps.Size(1024, 512), 
       // The heading in degrees at the origin of the panorama 
       // tile set. 
       centerHeading: 105, 
       getTileUrl: getCustomPanoramaTileUrl 
      } 
     }; 
    } 
} 

答えて

0

私は(7)

てsetMapを呼び出して画像を変更するための

var panorama; 
function initialize() { 
    var panoOptions = { 
     pano: 'sfera-4', 
     visible: true, 
     panoProvider: getCustomPanorama 
    } 
    panorama = new google.maps.StreetViewPanorama(
     document.getElementById('map'), 
     panoOptions 
    ); 
} 
function getCustomPanoramaTileUrl(pano,zoom,tileX,tileY) { 
    return 'i/'+pano+'s.jpg'; 
} 
function getCustomPanorama(pano,zoom,tileX,tileY) { 
    switch(pano) { 
     case 'sfera-4': 
      return { 
       location: { 
        pano: 'sfera-4', 
        description: 'Sfera 4' 
       }, 
       copyright: 'Description', 
       tiles: { 
        tileSize: new google.maps.Size(4096,2048), 
        worldSize: new google.maps.Size(4096,2048), 
        centerHeading: 0, 
        getTileUrl: getCustomPanoramaTileUrl 
       } 
      }; 
     break; 
     case 'sfera-7': 
      return { 
       location: { 
        pano: 'sfera-7', 
        description: 'Sfera 7' 
       }, 
       copyright: 'Description', 
       tiles: { 
        tileSize: new google.maps.Size(4096,2048), 
        worldSize: new google.maps.Size(4096,2048), 
        centerHeading: 0, 
        getTileUrl: getCustomPanoramaTileUrl 
       } 
      }; 
     break; 
    } 
} 
function setMap(id) { 
    panorama.setPano('sfera-'+id); 
} 

..私はこのような何かを考え出した、そして今のところ、それはcorectly取り組んでいます

関連する問題