]> git.plutz.net Git - confetti/blobdiff - templates/therapy.html.sh
enable drawing via android-4, quicker drawing via lines
[confetti] / templates / therapy.html.sh
index 0b3bfbe2574298b5279bd7747d06a374b2cecb54..78122fb48b42a692db0be528c38b09f75e8f983c 100755 (executable)
@@ -79,7 +79,7 @@ cat <<EOF
  --><span class=signature><input type=checkbox name="${sid}_signature" value=pos $sigcheck><button type=submit name=${sid}_sigset value=$sig></button></span>
   </label>
   <div class=tab>
-    <input class="dotmark ov" type="image" name=dotmark value="$sid" src="/therapies/${id%.tpy}_${sid}.png" alt="">
+    <img class="dotmark ov" src="/therapies/${id%.tpy}_${sid}.png" alt="">
     $(n=1; while [ -n "${tpy[${sid}_note${n}]+x}" ]; do
       t_session_note $session_n $n
       n=$(($n+1))
@@ -103,10 +103,10 @@ therapy_sessions(){
 
 cat <<EOF
   <fieldset class="tab">
-    <span class=no>…</span><!--
+    <button class=no type=submit name=new_session value=$sid>+</button><!--
  --><input class=date name=${sid}_date value="" placeholder="$(l10n date)" /><!--
  --><input class=therapist name=${sid}_therapist value="" placeholder="$(l10n therapist)" /><!--
- --><button type=submit name=new_session value=$sid>+</button></span>
+ --><span class=signature><span></span>
     <input type=hidden name="${sid}_note1" value="">
   </fieldset>
 EOF
@@ -157,10 +157,10 @@ cat <<EOF
   <input type="hidden" name="id" value="${id}">
 
   <label class="tab heading">
-    <span class=no>Nr.</span><!--
- --><span class=date>Datum</span><!--
- --><span class=therapist>Therapeut</span><!--
- --><span class=signature>Sig.</span>
+    <span class=no>$(l10n number)</span><!--
+ --><span class=date>$(l10n date)</span><!--
+ --><span class=therapist>$(l10n therapist)</span><!--
+ --><span class=signature>$(l10n signature)</span>
   </label>
 
   $(therapy_sessions)
@@ -191,13 +191,14 @@ cat <<EOF
   data=document.getElementById("image_serialize")
 
   function setcol(c) {
-    image.fillStyle = c
-    image_serialize += " fill " + c
+    image.strokeStyle = c
+    image.lineWidth = 2
+    image_serialize += " stroke " + c
   }
 
   setcol("$tpy[color]")
 
-  function circle(x, y) {
+  function draw(x, y) {
     if ( mouse == 1){
       if ( body.clientWidth >= 800 ){
         sx=Math.floor(cscaleW * (x - canvas.offsetLeft))
@@ -206,12 +207,10 @@ cat <<EOF
         sx=Math.floor(cscaleW * (x - canvas.offsetLeft + body.scrollLeft))
         sy=Math.floor(cscaleH * (y - canvas.offsetTop + body.scrollTop))
       }
-      image.beginPath()
-      image.arc( sx, sy, 5, 0, 2 * Math.PI )
-      image.fill()
-      image.closePath()
+      image.lineTo( sx, sy )
+      image.stroke()
 
-      image_serialize += " circle " + sx + "," + sy + " " + (sx-5) + "," + sy
+      image_serialize += " " + sx + "," + sy
     }
   }
 
@@ -221,21 +220,24 @@ cat <<EOF
     cscaleW = canvas.width / canvas.clientWidth
     cscaleH = canvas.height / canvas.clientHeight
 
-    circle(x, y)
+    image_serialize += " polyline"
+    image.beginPath()
+    draw(x, y)
   }
   function drawstop() {
    mouse = 0
+   image.closePath()
    dbg.innerHTML = image_serialize
    data.value = image_serialize
   }
 
-  window.addEventListener( 'mouseup', function() { drawstop() } )
-  canvas.addEventListener( 'mousedown', function(e) { drawstart(e.clientX, e.clientY) } )
-  canvas.addEventListener( 'mousemove', function(e) { circle(e.clientX, e.clientY)    } )
+  window.addEventListener( 'mouseup',   function()   { drawstop() } )
+  canvas.addEventListener( 'mousedown', function(e)  { drawstart(e.clientX, e.clientY) } )
+  canvas.addEventListener( 'mousemove', function(e)  {      draw(e.clientX, e.clientY) } )
 
-  window.addEventListener( 'touchend', function() { drawstop() } )
+  window.addEventListener( 'touchend',   function()  { drawstop() } )
   canvas.addEventListener( 'touchstart', function(e) { drawstart(e.touches[0].clientX, e.touches[0].clientY) } )
-  canvas.addEventListener( 'touchmove', function(e) { circle(e.touches[0].clientX, e.touches[0].clientY)    } )
+  canvas.addEventListener( 'touchmove',  function(e) { e.preventDefault(); draw(e.touches[0].clientX, e.touches[0].clientY) } )
 
   --></script>
 </form>