Скрытие списка точек при подгрузке роута из урла и при проклыдывании маршрута по кнопке 'проложить'

This commit is contained in:
Krivchikov Dmitry 2014-07-02 14:57:14 +04:00
parent 39c7abe761
commit 498851352a
3 changed files with 8 additions and 4 deletions

View File

@ -51,7 +51,7 @@
<h3>Маршрут</h3>
<div id="wayPoints"></div>
<div id="routeDistance"></div>
<button class="btn btn-info" onclick="buildRoute()"><span class="glyphicon glyphicon-send"></span> Проложить</button>
<button class="btn btn-info" onclick="buildRoute(true)"><span class="glyphicon glyphicon-send"></span> Проложить</button>
<?php if ($user): ?>
<button class="btn btn-default" onclick="saveRoute()"><span class="glyphicon glyphicon-cloud-upload" title="Сохранить"></span></button>
<?php endif; ?>

View File

@ -139,7 +139,7 @@ function initPoints()
} else if (getURLParameter('route') != 'null')
{
loadRouteJSON(getURLParameter('route'));
buildRoute();
buildRoute(true);
} else if ((getURLParameter('lat') != 'null') && (getURLParameter('lng') != 'null') && (getURLParameter('zoom') != 'null'))
{
myMap.setView([getURLParameter('lat'), getURLParameter('lng')], getURLParameter('zoom'));

View File

@ -6,7 +6,7 @@
* Строит маршрут по выбранным точкам.
* @returns {undefined}
*/
function buildRoute()
function buildRoute(fit)
{
wayPoints = Array();
if (route)
@ -51,7 +51,11 @@ function buildRoute()
}
});
myMap.fitBounds(bounds).zoomOut();
if (fit === true)
{
closeBox();
myMap.fitBounds(bounds).zoomOut();
}
routeToURL();
}