Add icon changing on type changing in poi editor

This commit is contained in:
Léo Serre 2020-05-18 09:34:26 +04:00
parent 91c9517dac
commit 5034763a18
3 changed files with 13 additions and 1 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
/includes/config.php
/medias/*
/_maps
_ressources/dump.sql
*.sublime-project
*.sublime-workspace
*.log

View File

@ -14,7 +14,7 @@
<i id="slide-icon" class="fas fa-chevron-up"></i>
<form class="form" action="<?=$config['rel_root_folder']?>wiki/<?=$poi->permalink?>/edit" method="post">
<br>
<div class="flex_line">
<div class="flex_line" id="type_selector">
<? foreach($poi_types as $type) { ?>
<input type="radio" name="poi_type" value="<?=$type[3]?>" id="<?=$type[3]?>">
<label for="<?=$type[3]?>"><img src="<?=$config['views_url']?>img/<?=$type[3]?>.svg"><br><?=$type[0]?></label>

View File

@ -56,4 +56,15 @@ $( document ).ready(function() {
$("#lat").val(e.latlng.lat);
$("#lon").val(e.latlng.lng);
})
var poiicon = L.icon({
iconSize: [24, 24],
iconAnchor: [12, 12]
});
$("#type_selector label").click(function(e) {
console.log(e);
poiicon.options.iconUrl = e.currentTarget.firstChild.currentSrc;
poi_layer.setIcon(poiicon);
})
});