|
@@ -157,6 +157,10 @@ function draw_image(ox, oy) {
|
|
|
|
|
|
location.reload();
|
|
|
};
|
|
|
+ $('#expandmap').css({'visibility': 'visible'})
|
|
|
+ } else {
|
|
|
+
|
|
|
+ $('#expandmap').css({'visibility': 'hidden'})
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1250,30 +1254,42 @@ function load_map(){
|
|
|
map.on('click', function(e) {
|
|
|
|
|
|
var lat = toRad(e.latlng.lat);
|
|
|
- var phi = toRad(e.latlng.lng);
|
|
|
+ var lng = toRad(e.latlng.lng);
|
|
|
var lat_ref = toRad(panorama_lat);
|
|
|
- var phi_ref = toRad(panorama_lng);
|
|
|
+ var lng_ref = toRad(panorama_lng);
|
|
|
|
|
|
- var a = Math.acos( Math.cos(lat_ref) * Math.cos(phi - phi_ref) * Math.cos(lat) + Math.sin(lat_ref) * Math.sin(lat) );
|
|
|
-
|
|
|
- var B = Math.asin( Math.sin(phi - phi_ref) * Math.sin(Math.PI/2 - lat)/Math.sin(a));
|
|
|
-
|
|
|
-
|
|
|
- if (lat>lat_ref){
|
|
|
- var newCap = toDeg(B);
|
|
|
- } else {
|
|
|
- var newCap = toDeg(Math.PI-B);
|
|
|
- }
|
|
|
+ var y = Math.sin(lng-lng_ref) * Math.cos(lat);
|
|
|
+ var x = Math.cos(lat_ref)*Math.sin(lat) -
|
|
|
+ Math.sin(lat_ref)*Math.cos(lat)*Math.cos(lng-lng_ref);
|
|
|
+ var brng = Math.atan2(y, x);
|
|
|
+ var brng = toDeg(brng)
|
|
|
+
|
|
|
+ var newCap = brng
|
|
|
+
|
|
|
+
|
|
|
if (newCap < 0 ){
|
|
|
- newCap += 360;
|
|
|
+ newCap = 360 + brng
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- if (newCap < image_cap_min){
|
|
|
- newCap = image_cap_min;
|
|
|
- } else if (newCap > image_cap_max){
|
|
|
- newCap = image_cap_max;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ var rot = image_cap_min
|
|
|
+ var a_min = 0
|
|
|
+ if (image_cap_max != 360) {
|
|
|
+ var a_max = ((image_cap_max - rot) % 360 + 360) % 360
|
|
|
}
|
|
|
+ var b = ((newCap - rot) % 360 + 360) % 360
|
|
|
+ if (b > a_max){
|
|
|
+ var meanAngle = a_max+(360-a_max)/2
|
|
|
+ if (b < meanAngle){
|
|
|
+ newCap = image_cap_max;
|
|
|
+ }else{
|
|
|
+ newCap = image_cap_min;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
angle_control = document.getElementById('angle_ctrl');
|
|
|
angle_control.value = newCap;
|