diff --git a/code/index.html b/code/index.html index 06cbec9..2f9f1d1 100644 --- a/code/index.html +++ b/code/index.html @@ -104,6 +104,23 @@ function toutDessiner(pts,lecanvas,lectx) { lectx.clearRect(0, 0, lecanvas.width, lecanvas.height); + if(pts[0]) + { + for(i=1;i { + faireCercle(element[0],element[1],element[2],lectx); + })*/ + faireCercle(pts[i][0],pts[i][1],pts[i][2],lectx); + } + else + faireCercle(pts[i][0],pts[i][1],pts[i][2],lectx); + } + } + /* pts.forEach(element=> { if(Array.isArray(element[0])){ element.forEach(element2 => { @@ -112,7 +129,7 @@ } else faireCercle(element[0],element[1],element[2],lectx); - }) + })*/ } function empiler(obj=false) @@ -123,10 +140,16 @@ if(!obj) { tabTotal=[]; - tab1.forEach(element => { + if(tab1[0]) + { + + tab1.forEach(element => { tabTotal.push(element); }) - tab2.forEach(element => { + } + if(tab2[0]){ + + tab2.forEach(element => { colors.forEach(col => { test=[element[0],element[1],col]; if(!exists) @@ -136,7 +159,11 @@ tabTotal.push(element); exists=false; }) - tab3.forEach(element => { + } + if(tab3[0]) + { + + tab3.forEach(element => { colors.forEach(col => { test=[element[0],element[1],col]; if(!exists) @@ -146,7 +173,10 @@ tabTotal.push(element); exists=false; }) - tab4.forEach(element => { + } + if(tab4[0]){ + + tab4.forEach(element => { colors.forEach(col => { test=[element[0],element[1],col]; if(!exists) @@ -156,6 +186,7 @@ tabTotal.push(element); exists=false; }) + } checkAllOK(); toutDessiner(tabTotal,canvasT,ctxT); } @@ -311,6 +342,11 @@ } + + function toggleVisible(where) + { + eval("tab"+where+"[0]=!tab"+where+"[0];"); + } canvas1.addEventListener("mousedown",function(e){ @@ -352,10 +388,10 @@ tab4.push([-3,-3,"green"],[-3,2,"red"],[1,2,"blue"],[3,-3,"brown"]); */ - tab1.push([-1,-1,"green"],[-2,-2,"red"]); - tab2.push([-1,-1,"green"],[-2,-2,"red"]); - tab3.push([-1,-1,"green"],[-2,-2,"red"]); - tab4.push([-1,-1,"green"],[-2,-2,"red"]); + tab1.push(true,[-1,-1,"green"],[-2,-2,"red"]); + tab2.push(true,[-1,-1,"green"],[-2,-2,"red"]); + tab3.push(true,[-1,-1,"green"],[-2,-2,"red"]); + tab4.push(true,[-1,-1,"green"],[-2,-2,"red"]); toutDessiner(tab1,canvas1,ctx1);