From 552903c3daa968f3aa3ffa8aad8d290a51832cd0 Mon Sep 17 00:00:00 2001 From: adplantade Date: Fri, 24 Jul 2020 16:56:52 +0200 Subject: [PATCH] =?UTF-8?q?d=C3=A9tection=20r=C3=A9par=C3=A9e=20+=20d?= =?UTF-8?q?=C3=A9but=20color=20picker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit le problème venait plus de la fonction de création des vitraux que du reste, copyMDArray ignorait le true au début, il a fallu le rajouter après l'ajout des dots... --- code/button_displayer.js | 2 -- code/index.php | 5 ++++ code/options.js | 65 +++++++++++++++++++++++++++++++++++++++- code/vitraux.js | 32 +++++++++++++------- 4 files changed, 90 insertions(+), 14 deletions(-) diff --git a/code/button_displayer.js b/code/button_displayer.js index 3c2dcb2..21d2d6b 100644 --- a/code/button_displayer.js +++ b/code/button_displayer.js @@ -42,7 +42,6 @@ modes.forEach(element => { document.getElementById("btn_play").style.display="flex"; document.getElementById("btn_play_des").style.display="none"; } - dispHighscores(); }); } }); @@ -65,7 +64,6 @@ diffs.forEach(element => { document.getElementById("btn_play").style.display="flex"; document.getElementById("btn_play_des").style.display="none"; } - dispHighscores(); }); }) diff --git a/code/index.php b/code/index.php index 0991100..196a788 100644 --- a/code/index.php +++ b/code/index.php @@ -2,6 +2,8 @@ On The Dot + + @@ -83,6 +85,9 @@ Jouer la partie en :
+
Choisir les couleurs des points (ne fonctionne pas en mode "gemmes" ou "les deux") +
+

diff --git a/code/options.js b/code/options.js index 53d2458..4d03d40 100644 --- a/code/options.js +++ b/code/options.js @@ -48,4 +48,67 @@ else document.getElementById((getCookie("displayMode")!="" ? getCookie("displayMode")+"_disp" : "gems_disp")).selected=true; document.getElementById("range_dots").value= (getCookie("dotsAmount")!="" ? getCookie("dotsAmount") : 4); -output.innerHTML = (getCookie("dotsAmount")!="" ? getCookie("dotsAmount") : 4); \ No newline at end of file +output.innerHTML = (getCookie("dotsAmount")!="" ? getCookie("dotsAmount") : 4); + +// Simple example, see optional options for more configuration. +const pickr = Pickr.create({ + el: '.color-picker', + theme: 'monolith', // or 'monolith', or 'nano' + + swatches: [ + 'rgba(244, 67, 54, 1)', + 'rgba(233, 30, 99, 0.95)', + 'rgba(156, 39, 176, 0.9)', + 'rgba(103, 58, 183, 0.85)', + 'rgba(63, 81, 181, 0.8)', + 'rgba(33, 150, 243, 0.75)', + 'rgba(3, 169, 244, 0.7)', + 'rgba(0, 188, 212, 0.7)', + 'rgba(0, 150, 136, 0.75)', + 'rgba(76, 175, 80, 0.8)', + 'rgba(139, 195, 74, 0.85)', + 'rgba(205, 220, 57, 0.9)', + 'rgba(255, 235, 59, 0.95)', + 'rgba(255, 193, 7, 1)' + ], + + components: { + + // Main components + preview: true, + opacity: true, + hue: true, + + // Input / output Options + interaction: { + hex: true, + rgba: true, + hsla: true, + hsva: true, + cmyk: true, + input: true, + clear: true, + save: true + } + } +}); + +pickr.on('init', instance => { + console.log('init', instance); +}).on('hide', instance => { + console.log('hide', instance); +}).on('show', (color, instance) => { + console.log('show', color, instance); +}).on('save', (color, instance) => { + console.log('save', color, instance); +}).on('clear', instance => { + console.log('clear', instance); +}).on('change', (color, instance) => { + console.log('change', color, instance); +}).on('changestop', instance => { + console.log('changestop', instance); +}).on('cancel', instance => { + console.log('cancel', instance); +}).on('swatchselect', (color, instance) => { + console.log('swatchselect', color, instance); +}); \ No newline at end of file diff --git a/code/vitraux.js b/code/vitraux.js index f898ceb..9cdac1b 100644 --- a/code/vitraux.js +++ b/code/vitraux.js @@ -97,7 +97,7 @@ function genVitraux() var mat = matrix(6,6); var x; var y; - var baseVitrail=[true]; + var baseVitrail=[]; var tries; for(var cpt=0;cpt"+cpt); tries++; } @@ -122,14 +119,13 @@ function genVitraux() x-=2; y-=2; baseVitrail.push([(x>0 ? x : x-1),(y>0 ? y : y-1),colors[cpt]]); - console.log("mat = "+mat); tries=0; } - //console.log("final : "+baseVitrail+" et :"+Array.isArray(baseVitrail)); for(var i=1;i<5;i++) { eval("tab"+i+"=copyMDArray(baseVitrail)"); + eval("tab"+i+".unshift(true)"); } } @@ -195,20 +191,26 @@ function empiler(obj=false) if(!obj) { tabTotal=[]; + console.log("tabtotal début "+tabTotal); + console.log("tab1 = "+tab1); if(tab1[0]) { - + console.log("tab1 = "+tab1); tab1.forEach(element => { - if(Array.isArray(element)) + console.log("element t1="+element); + if(Array.isArray(element) && element.length!=0) { tabTotal.push(element); + //console.log("tabtotal tab1 "+tabTotal+"|"); } }) } if(tab2[0]){ + console.log("tab2 = "+tab2); tab2.forEach(element => { - if(Array.isArray(element)) + console.log("element t2="+element); + if(Array.isArray(element) && element.length!=0) { colors.forEach(col => { test=[element[0],element[1],col]; @@ -217,6 +219,7 @@ function empiler(obj=false) }) if(!exists) tabTotal.push(element); + //console.log("tabtotal tab2 "+tabTotal+"|"); exists=false; } }) @@ -224,8 +227,10 @@ function empiler(obj=false) if(tab3[0]) { + console.log("tab3 = "+tab3); tab3.forEach(element => { - if(Array.isArray(element)){ + console.log("element t3="+element); + if(Array.isArray(element) && element.length!=0){ colors.forEach(col => { test=[element[0],element[1],col]; if(!exists) @@ -233,14 +238,17 @@ function empiler(obj=false) }) if(!exists) tabTotal.push(element); + //console.log("tabtotal tab3 "+tabTotal+"|"); exists=false; } }) } if(tab4[0]){ + console.log("tab4 = "+tab4); tab4.forEach(element => { - if(Array.isArray(element)) + console.log("element t4="+element); + if(Array.isArray(element) && element.length!=0) { colors.forEach(col => { test=[element[0],element[1],col]; @@ -249,6 +257,7 @@ function empiler(obj=false) }) if(!exists) tabTotal.push(element); + //console.log("tabtotal tab4 "+tabTotal+"|"); exists=false; } }) @@ -492,6 +501,7 @@ function checkAllOK(){ for(i=0;i point.toString()==tabObjCmp[i].toString()); + console.log(verifTab.filter(point => point.toString()+" et "+tabObjCmp[i].toString())); exists*=result.length; } }