]> git.plutz.net Git - lobster/commitdiff
enable drawing via android-4, quicker drawing via lines
authorpaul <paul@plutz.net>
Sun, 10 Apr 2016 16:32:15 +0000 (16:32 +0000)
committerpaul <paul@plutz.net>
Sun, 10 Apr 2016 16:32:15 +0000 (16:32 +0000)
svn path=/trunk/; revision=97

actions/update_therapy.sh
templates/text_frame.sh
templates/therapy.css.sh
templates/therapy.html.sh

index 52daa11ba0e042f921a66738edee62c7c21e16d7..e7dcae2def0196465dbc5b599c32abb1a5f37f6f 100755 (executable)
@@ -52,24 +52,16 @@ elif [ -n "$_POST[new_session]" ]; then
   printf '%s:exists\n' "$sid" >>"$tempfile"
   printf '%s_open:checked\n' "$sid" >>"$tempfile"
 
-elif [ -n "$_POST[dotmark.x]" -a -n "$_POST[dotmark.y]" ]; then
-  sed -rn 's;^(session[0-9]+)_open:checked$;\1;p' "$tempfile" \
-  | sort -n \
-  | tail -n1 \
-  | read sid
-
-  x="$_POST[dotmark.x]"
-  y="$_POST[dotmark.y]"
-
-  convert "${tpyfile%.tpy}_${sid}.png" -draw "fill $_POST[color] circle $x,$y $(($x+5)),$y" "${tpyfile%.tpy}_${sid}.png"
-
 elif [ -n "$_POST[imagedata]" ]; then
   sed -rn 's;^(session[0-9]+)_open:checked$;\1;p' "$tempfile" \
   | sort -n \
   | tail -n1 \
   | read sid
 
-  convert "${tpyfile%.tpy}_${sid}.png" -draw "${_POST[imagedata]}" -transparent white "${tpyfile%.tpy}_${sid}.png"
+  convert "${tpyfile%.tpy}_${sid}.png" \
+          -strokewidth 2 -fill '#00000000' \
+          -draw "${_POST[imagedata]}" -transparent white \
+          "${tpyfile%.tpy}_${sid}.png"
   sync
 fi
 
index 03eddcdbd85eb3219a56828bd5aceba6b197a49d..e5f2dcbf219c847808edeee2ff7c254a9610857c 100755 (executable)
@@ -20,6 +20,7 @@ item_name[p_email]="Email"
 item_name[p_error]="Fehler"
 item_name[p_categories]="Kategorien"
 item_name[p_prescriptions]="Verschreibungen"
+item_name[p_therapy]="Therapie"
 
 case $PROFILE in
 medical)
index face0b84899326ec10ab8158eaf8f4c394456f91..e3184a52656093cf18579bee2a710a81fcc7affb 100755 (executable)
@@ -3,6 +3,7 @@
 cat <<EOF
 * { box-sizing: border-box; }
 body {
+  overflow: scroll;
   position: relative;
   width: 100%;
   margin: 0; padding: 0;
index d850a70d21a46dab95dbb6317b84182ec33f5446..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))
@@ -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) } )
+  canvas.addEventListener( 'mousemove', function(e)  {      draw(e.clientX, e.clientY) } )
 
   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>