Skip to content

Commit

Permalink
Using pitch 0 for the panorama view
Browse files Browse the repository at this point in the history
  • Loading branch information
csarven committed Jun 7, 2011
1 parent f21828e commit 4cddc2f
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions js/homepage.js
Expand Up @@ -51,15 +51,7 @@ $(document).ready(function(){
google.maps.event.addListener(panorama, 'position_changed', function() {
var pos = panorama.getPosition();
var bearing = getBearing(pos, new google.maps.LatLng(mapCenterLat, mapCenterLng));
var pitch = getPitch(pos, new google.maps.LatLng(mapCenterLat, mapCenterLng));
if (pitch < -25.0) pitch = -25.0;
panorama.setPov({'heading': bearing, 'pitch': pitch, 'zoom': 1});
});

// handle point of view in SV
google.maps.event.addListener(panorama, 'pov_changed', function() {
var heading = Math.floor(panorama.getPov().heading);
var pitch = Math.floor(panorama.getPov().pitch*100+1)/100;
panorama.setPov({'heading': bearing, 'pitch': 0, 'zoom': 1});
});

map.setStreetView(panorama);
Expand All @@ -83,14 +75,6 @@ $(document).ready(function(){
}
}

function getPitch(pos1, pos2) {
var dlat = pos2.lat() - pos1.lat();
var dlng = pos2.lng() - pos1.lng();
var distance = Math.sqrt(dlat*dlat + dlng*dlng);
var height = 0.00003;
return -Math.atan(height/distance) * 180.0 / Math.PI;
}

$('.map').maphilight();

initializeStreetView();
Expand Down

0 comments on commit 4cddc2f

Please sign in to comment.