Commit 3fe05c9d authored by Clouard Regis's avatar Clouard Regis
Browse files

Fix bug on Pace (RK)

parent 2a26faae
......@@ -142,7 +142,7 @@ function previewMap(data, divMap, divLeaflet, map, overlay, img) {
overlay.reposition(L.latLng(corner[0]), L.latLng(corner[1]), L.latLng(corner[3]));
map.fitBounds([corner[0], corner[2]]);
// Add recenter button
if (recenterButton != null){
if (recenterButton != null) {
recenterButton.remove();
}
recenterButton = L.easyButton('fa-map-marker', function (btn, map) {
......@@ -170,11 +170,10 @@ function addControlPointOnMap(data, map) {
usedControlPoints.push(value[0]);
}
for (let [key, value] of Object.entries(data.xml2)) {
if (usedControlPoints.includes(key)){
if (usedControlPoints.includes(key)) {
markerColor = '#ff0000';
markerOpacity = 0.8;
}
else {
} else {
markerColor = '#1f479f';
markerOpacity = 0.5;
}
......@@ -191,7 +190,7 @@ function addControlPointOnMap(data, map) {
}
function showPreview(data, divXml, divMap, divLeaflet, map, overlay, img) {
if (controlPointsMarkers == null){
if (controlPointsMarkers == null) {
controlPointsMarkers = L.layerGroup();
controlPointsMarkers.addTo(map);
}
......@@ -200,7 +199,7 @@ function showPreview(data, divXml, divMap, divLeaflet, map, overlay, img) {
addControlPointOnMap(data, map);
}
function downloadMap(imageURL){ //see library printJS for further print options.
function downloadMap(imageURL) { //see library printJS for further print options.
let printableMap = window.open(window.location.origin + "/" + imageURL);
printableMap.download();
}
......@@ -208,6 +207,14 @@ function downloadMap(imageURL){ //see library printJS for further print options.
function switchMapDisplay(overlay, overlayOpacity) {
let hideButton = document.getElementById("hide-map");
let showButton = document.getElementById("show-map");
overlayOpacity === 100 ? (overlayOpacity = 0, hideButton.style.display = "block", showButton.style.display = "none") : (overlayOpacity = 100, hideButton.style.display = "none", showButton.style.display = "block");
if (overlayOpacity === 100) {
overlayOpacity = 0;
hideButton.style.display = "block";
showButton.style.display = "none";
} else {
overlayOpacity = 100;
hideButton.style.display = "none";
showButton.style.display = "block";
}
overlay.setOpacity(overlayOpacity);
}
\ No newline at end of file
......@@ -87,16 +87,16 @@
<div class="row align-items-start" style="">
<div class="col" style="width:100%">
<div class="tab">
<button class="tab-links" onclick="openTab('tab1', 'map-tab')" id="tab1">{% trans %} course.menu.map {% endtrans %}</button>
<button class="tab-links" onclick="openTab('tab2', 'description-tab')" id="tab2">{% trans %} course.menu.info {% endtrans %}</button>
<button class="tab-links" onclick="openTab('tab1', 'map-tab')" id="tab1">{% trans %}course.menu.map{% endtrans %}</button>
<button class="tab-links" onclick="openTab('tab2', 'description-tab')" id="tab2">{% trans %}course.menu.info{% endtrans %}</button>
</div>
<!-- Tab content -->
<div id="map-tab" class="tab-content">
<button class="btn btn-primary" id="show-map" onclick="switchMapDisplay(overlay, 100)" style="position: absolute; z-index: 9999; top: 60px; right: 35px">{% trans %} course.description.mask.map {% endtrans %}</button>
<button class="btn btn-primary" id="hide-map" onclick="switchMapDisplay(overlay, 0)" style="display:none; position: absolute; z-index: 9999; top: 60px; right: 35px">{% trans %} course.description.show.map {% endtrans %}</button>
<button class="btn btn-primary" id="show-map" onclick="switchMapDisplay(overlay, 100)" style="position: absolute; z-index: 9999; top: 60px; right: 35px">{% trans %}course.description.mask.map{% endtrans %}</button>
<button class="btn btn-primary" id="hide-map" onclick="switchMapDisplay(overlay, 0)" style="display:none; position: absolute; z-index: 9999; top: 60px; right: 35px">{% trans %}course.description.show.map{% endtrans %}</button>
{% if isPrintable %}
<button class="btn btn-primary" onclick="downloadMap(imageURL)" style="position: absolute; z-index: 9999; top: 105px; right: 35px">{% trans %} course.description.download {% endtrans %}</button>
<button class="btn btn-primary" onclick="downloadMap(imageURL)" style="position: absolute; z-index: 9999; top: 105px; right: 35px">{% trans %}course.description.download{% endtrans %}</button>
{% endif %}
<div id="map-div" style="min-width: 300px">
</div>
......@@ -106,17 +106,17 @@
<div id="description-tab" class="tab-content list-group">
<div class="d-flex">
<div class="">
<p>{% trans %}course.description.author{% endtrans %} {{ creator }}</p>
<p>{% trans %}course.description.author{% endtrans %}{{ creator }}</p>
{% if club != null %}
<p>{% trans %}course.description.club.name{% endtrans %} {{ club }}</p>
<p>{% trans %}course.description.club.name{% endtrans %}{{ club }}</p>
{% endif %}
{% if app.request.locale == 'fr' %}
<p>{% trans %}course.description.date{% endtrans %} {{ day }}/{{ month }}/{{ year }}</p>
<p>{% trans %}course.description.date{% endtrans %}{{ day }}/{{ month }}/{{ year }}</p>
{% else %}
<p>{% trans %}course.description.date{% endtrans %} {{ month }}/{{ day }}/{{ year }}</p>
<p>{% trans %}course.description.date{% endtrans %}{{ month }}/{{ day }}/{{ year }}</p>
{% endif %}
<p>{% trans %}course.description.control.point.number{% endtrans %} {{ control_point_number }}</p>
<p>{% trans %}course.description.length{% endtrans %} {{ length }} m</p>
<p>{% trans %}course.description.control.point.number{% endtrans %}{{ control_point_number }}</p>
<p>{% trans %}course.description.length{% endtrans %}{{ length }} m</p>
</div>
</div>
</div>
......
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