diff --git a/code/index.html b/code/index.html index e96f186..fbdff7d 100644 --- a/code/index.html +++ b/code/index.html @@ -28,7 +28,7 @@ tab1=[]; tab2=[]; tabTotal=[]; - +mousePos=[]; width=300; // 6 lignes de 50px height=300; // 6 colonnes de 50px @@ -142,7 +142,7 @@ function generateEasy(){ actions=getRandomInt(5); while(actions>0){ - tourneD(tabObj,canvasO,ctxO,getRandomInt(2)-1); //pb identifié, modifier toutDessiner + tourneD(tabObj,canvasO,ctxO,getRandomInt(2)-1); console.log(tabObj); actions--; } @@ -171,7 +171,16 @@ canvas.addEventListener("click",function(e) getMousePosition(canvas2, e, ctx2, tab2); }); - canvasO.addEventListener("click",function(e){console.log("aaaa");}) + canvasO.addEventListener("mousedown",function(e){ + console.log("down : ",e.clientX,",",e.clientY); + mousePos=["obj",e.clientX-canvasO.getBoundingClientRect().leftcanvasO.width/2 && mousePos[1]==true) + console.log("ok"); + }) tab1.push([-3,-3,"green"],[-3,2,"red"],[1,2,"orange"]); tab2.push([-2,-3,"green"],[-3,1,"blue"],[-1,2,"purple"]);