scrolling fixes for firefox, different stroke-width for erazer
[confetti] / templates / therapy.html.sh
index f1c42ac..eb93553 100755 (executable)
@@ -202,8 +202,9 @@ cat <<EOF
 
   function setcol(c) {
     image.strokeStyle = c
-    image.lineWidth = 2
-    image_serialize += " stroke " + c
+    if ( c == "#FFF" ) image.lineWidth = 32
+    else image.lineWidth = 4
+    image_serialize += " stroke " + c + " stroke-width " + image.lineWidth
   }
 
   setcol("$tpy[color]")
@@ -214,8 +215,8 @@ cat <<EOF
         sx=Math.floor(cscaleW * (x - canvas.offsetLeft))
         sy=Math.floor(cscaleH * (y - canvas.offsetTop))
       } else { 
-        sx=Math.floor(cscaleW * (x - canvas.offsetLeft + body.scrollLeft))
-        sy=Math.floor(cscaleH * (y - canvas.offsetTop + body.scrollTop))
+        sx=Math.floor(cscaleW * (x - canvas.offsetLeft + window.pageXOffset))
+        sy=Math.floor(cscaleH * (y - canvas.offsetTop + window.pageYOffset))
       }
       image.lineTo( sx, sy )
       image.stroke()