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
--><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))
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))
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
}
}
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>