Limite le nombre de flèche dans cible intéractive en fonction du nombre de flèche par volée dans configuration - Follow Up Deployment
Browse files- index.html +19 -4
index.html
CHANGED
@@ -82,10 +82,10 @@
|
|
82 |
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
83 |
<div>
|
84 |
<label class="block text-sm font-medium text-gray-700 mb-1">Nombre de flèches par volée</label>
|
85 |
-
<select class="w-full border border-gray-300 rounded-md px-3 py-2">
|
86 |
-
<option>3 flèches</option>
|
87 |
-
<option selected>6 flèches</option>
|
88 |
-
<option>12 flèches</option>
|
89 |
</select>
|
90 |
</div>
|
91 |
<div>
|
@@ -232,9 +232,14 @@
|
|
232 |
// Variables globales
|
233 |
let currentVolley = [];
|
234 |
let history = [];
|
|
|
235 |
|
236 |
// Ajouter une flèche à la volée en cours
|
237 |
function addArrow(points) {
|
|
|
|
|
|
|
|
|
238 |
currentVolley.push(points);
|
239 |
updateDisplay();
|
240 |
}
|
@@ -651,6 +656,16 @@
|
|
651 |
statsChart.update();
|
652 |
}
|
653 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
654 |
// Initialisation
|
655 |
document.addEventListener('DOMContentLoaded', () => {
|
656 |
initStatsChart();
|
|
|
82 |
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
83 |
<div>
|
84 |
<label class="block text-sm font-medium text-gray-700 mb-1">Nombre de flèches par volée</label>
|
85 |
+
<select id="arrowsPerVolley" class="w-full border border-gray-300 rounded-md px-3 py-2" onchange="updateMaxArrows()">
|
86 |
+
<option value="3">3 flèches</option>
|
87 |
+
<option value="6" selected>6 flèches</option>
|
88 |
+
<option value="12">12 flèches</option>
|
89 |
</select>
|
90 |
</div>
|
91 |
<div>
|
|
|
232 |
// Variables globales
|
233 |
let currentVolley = [];
|
234 |
let history = [];
|
235 |
+
let maxArrows = 6; // Default to 6 arrows
|
236 |
|
237 |
// Ajouter une flèche à la volée en cours
|
238 |
function addArrow(points) {
|
239 |
+
if (currentVolley.length >= maxArrows) {
|
240 |
+
alert(`Vous avez atteint la limite de ${maxArrows} flèches par volée`);
|
241 |
+
return;
|
242 |
+
}
|
243 |
currentVolley.push(points);
|
244 |
updateDisplay();
|
245 |
}
|
|
|
656 |
statsChart.update();
|
657 |
}
|
658 |
|
659 |
+
// Mettre à jour le nombre maximum de flèches
|
660 |
+
function updateMaxArrows() {
|
661 |
+
const select = document.getElementById('arrowsPerVolley');
|
662 |
+
maxArrows = parseInt(select.value);
|
663 |
+
if (currentVolley.length > maxArrows) {
|
664 |
+
currentVolley = currentVolley.slice(0, maxArrows);
|
665 |
+
updateDisplay();
|
666 |
+
}
|
667 |
+
}
|
668 |
+
|
669 |
// Initialisation
|
670 |
document.addEventListener('DOMContentLoaded', () => {
|
671 |
initStatsChart();
|