Задействована кнопка добавления точки
This commit is contained in:
parent
c6e09a3963
commit
b4b0d690b4
|
|
@ -18,7 +18,7 @@
|
|||
<button class="btn btn-default" type="button" onclick="showMeOnTheMap()"><span class="glyphicon glyphicon-screenshot"></span> Я на карте</button>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<button class="btn btn-default" type="button"><span class="glyphicon glyphicon-plus-sign"></span> Добавить точку</button>
|
||||
<button class="btn btn-default" type="button" id="addPointButton" onclick="tryAddPoint($(this))"><span class="glyphicon glyphicon-plus-sign"></span> Добавить точку</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ function init() {
|
|||
|
||||
myMap.events.add('click', function (e) {
|
||||
if (!myMap.balloon.isOpen()) {
|
||||
if ( $('#addPointButton').hasClass('btn-success') )
|
||||
{
|
||||
var coords = e.get('coordPosition');
|
||||
myMap.balloon.open(coords, {
|
||||
contentHeader:'Добавление точки',
|
||||
|
|
@ -47,6 +49,7 @@ function init() {
|
|||
'</form>'
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
myMap.balloon.close();
|
||||
}
|
||||
|
|
@ -147,3 +150,12 @@ function showMeOnTheMap()
|
|||
myMap.setCenter([userLat, userLng]);
|
||||
});
|
||||
}
|
||||
|
||||
function tryAddPoint(el)
|
||||
{
|
||||
$(el).toggleClass('btn-success').toggleClass('btn-default');
|
||||
if ( $('#addPointButton').hasClass('btn-success') )
|
||||
myMap.cursors.push('crosshair');
|
||||
else
|
||||
myMap.cursors.push('arrow');
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue