]> git.plutz.net Git - confetti/blobdiff - static/therapy_draw.js
more reliable color selection, bugfix regarding backend color transparency
[confetti] / static / therapy_draw.js
index 0b5dffa0366c9fd259ee09c13588458e83076869..5a06728683532f1888753042794ab06bf8c79b3e 100644 (file)
@@ -35,10 +35,9 @@ function setcol(c) {
   image.fillStyle =  c
   if ( c == "#FFF" ) image.lineWidth = 32
   else image.lineWidth = 4
-  data.value += " stroke " + c + " stroke-width " + image.lineWidth
+  data.value += " stroke " + c + "F" + " stroke-width " + image.lineWidth
 }
 
-setcol("$tpy[color]")
 
 function relX(x){
   if ( body.clientWidth >= 800 ){
@@ -74,6 +73,10 @@ function drawstart(x, y) {
 
   stx=relX(x), sty=relY(y)
 
+  document.getElementsByName("color").forEach(
+    function(x, y, z){ if (x.checked) setcol(x.value); }
+  );
+
   image.beginPath()
   draw(x, y)  // why must this not use relative Coords ???