Commit 3498a812 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

map autofit

parent c13fa0c8
...@@ -5,6 +5,8 @@ var markers = []; ...@@ -5,6 +5,8 @@ var markers = [];
var selected; var selected;
var map_autofit = true;
var BLOCK_MOVEEND = false; var BLOCK_MOVEEND = false;
$(function(){ $(function(){
...@@ -26,6 +28,7 @@ $(function(){ ...@@ -26,6 +28,7 @@ $(function(){
success: function(response){ success: function(response){
List = response; List = response;
if (map_autofit) fit_map(response);
parse_list(response); parse_list(response);
init_dragging(); init_dragging();
map.fire('moveend'); map.fire('moveend');
...@@ -48,6 +51,17 @@ var SETTINGS = { ...@@ -48,6 +51,17 @@ var SETTINGS = {
var Dragged = false; var Dragged = false;
function fit_map(xml){
var coords = [];
$(xml).find("Camera").each(function(){
coords.push([$(this).find("latitude").text(),$(this).find("longitude").text()]);
});
map.fitBounds(coords);
}
function init_dragging(){ function init_dragging(){
var bigcounter = 0; var bigcounter = 0;
...@@ -137,8 +151,8 @@ function parseURL(){ ...@@ -137,8 +151,8 @@ function parseURL(){
switch (parameters[i][0]) { switch (parameters[i][0]) {
case "showall": SETTINGS.showall = true; break; case "showall": SETTINGS.showall = true; break;
case "rating": SETTINGS.rating = parseInt(parameters[i][1]); break; case "rating": SETTINGS.rating = parseInt(parameters[i][1]); break;
case "lat": SETTINGS.lat = parseFloat(parameters[i][1]); break; case "lat": SETTINGS.lat = parseFloat(parameters[i][1]); map_autofit = false; break;
case "lng": SETTINGS.lng = parseFloat(parameters[i][1]); break; case "lng": SETTINGS.lng = parseFloat(parameters[i][1]); map_autofit = false; break;
case "zoom": SETTINGS.zoom = parseFloat(parameters[i][1]); break; case "zoom": SETTINGS.zoom = parseFloat(parameters[i][1]); break;
// selected model // selected model
case "model": SETTINGS.model = parameters[i][1]; break; case "model": SETTINGS.model = parameters[i][1]; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment