diff --git a/site/vue/js/createElement.js b/site/vue/js/createElement.js index fed2be6..5d9453b 100644 --- a/site/vue/js/createElement.js +++ b/site/vue/js/createElement.js @@ -62,7 +62,6 @@ function createLine(points, id) { let newPoints = [startX, startY, startX + distance20, startY, endX - distance20, endY, endX, endY]; let line = new Konva.Line({ points: newPoints, - fill: 'blue', stroke: colorLineInnactive, strokeWidth: lineStroke, id: id, diff --git a/site/vue/js/generateGame.js b/site/vue/js/generateGame.js index 0919522..cb4dfc5 100644 --- a/site/vue/js/generateGame.js +++ b/site/vue/js/generateGame.js @@ -145,10 +145,13 @@ function calcul(launch) { var matchs = []; var fork = []; + var count = []; + for (let i = 0; i < col.length; i++) count[i] = 0; var error = null; document.querySelectorAll(".div_gen_col_fork").forEach(function (element) { element.childNodes[0].innerHTML = "Ajouter un fork pour la colonne " + element.childNodes[1].value + " qui se divise en " + element.childNodes[2].value; + count[(parseInt(element.childNodes[1].value) - 1)] = count[(parseInt(element.childNodes[1].value) - 1)] + parseInt(element.childNodes[2].value); matchs.push([(parseInt(element.childNodes[1].value) + 1), parseInt(element.childNodes[2].value)]); fork.push([parseInt(element.childNodes[1].value), parseInt(element.childNodes[2].value)]); if (parseInt(element.childNodes[1].value) < 1 || parseInt(element.childNodes[1].value) > col.length) { @@ -157,6 +160,12 @@ function calcul(launch) { } else { element.childNodes[1].style.borderColor = "white"; } + if (count[(parseInt(element.childNodes[1].value) - 1)] > col[count[(parseInt(element.childNodes[1].value) - 1)]]) { + error = "Problème nombre de porte dans la colonne"; + element.childNodes[2].style.borderColor = "red"; + } else { + element.childNodes[2].style.borderColor = "white"; + } }); if (error !== null) ErrorMessage(error); if (launch !== undefined && launch !== null && launch === true) { @@ -175,12 +184,14 @@ function addGenForkInput() { calcul(); }); input.value = 1; + input.setAttribute("type", "number"); div.append(input); input = document.createElement("input"); input.addEventListener('input', (event) => { calcul(); }); input.value = 2; + input.setAttribute("type", "number"); div.append(input); var i = document.createElement("i"); i.className = "fa fa-trash"; @@ -279,7 +290,7 @@ function createGameOne(niveau) { numberColonne2 = 1; timeEnd = 20; break; - //Fin premiere serie + //Fin premiere serie case 5: firstTime.push("inv"); isNotAllowed = true; @@ -567,6 +578,7 @@ function generate2(col, matchs, fork) { } } initEndGame(); + isLineCollapsing(); checkAllSortieLogique(); }