From 1c7bba82f5b6bc81fdedb9e4907019462982a749 Mon Sep 17 00:00:00 2001 From: paul <paul@plutz.net> Date: Tue, 19 Jul 2016 11:43:53 +0000 Subject: [PATCH] more reliable color selection, bugfix regarding backend color transparency svn path=/trunk/; revision=125 --- static/therapy_draw.js | 7 +++++-- templates/therapy.html.sh | 16 ++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/static/therapy_draw.js b/static/therapy_draw.js index 0b5dffa..5a06728 100644 --- a/static/therapy_draw.js +++ b/static/therapy_draw.js @@ -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 ??? diff --git a/templates/therapy.html.sh b/templates/therapy.html.sh index 4b8717d..6addbed 100755 --- a/templates/therapy.html.sh +++ b/templates/therapy.html.sh @@ -186,14 +186,14 @@ therapy_sessions cat <<EOF <fieldset class=color> - <input class=color type=radio name=color onclick="javascript:setcol('#000')" value="#000" id=c000 $c0><label for=c000></label> - <input class=color type=radio name=color onclick="javascript:setcol('#00A')" value="#00A" id=c001 $c1><label for=c001></label> - <input class=color type=radio name=color onclick="javascript:setcol('#0A0')" value="#0A0" id=c010 $c2><label for=c010></label> - <input class=color type=radio name=color onclick="javascript:setcol('#0AA')" value="#0AA" id=c011 $c3><label for=c011></label> - <input class=color type=radio name=color onclick="javascript:setcol('#A00')" value="#A00" id=c100 $c4><label for=c100></label> - <input class=color type=radio name=color onclick="javascript:setcol('#A0A')" value="#A0A" id=c101 $c5><label for=c101></label> - <input class=color type=radio name=color onclick="javascript:setcol('#AA0')" value="#AA0" id=c110 $c6><label for=c110></label> - <input class=color type=radio name=color onclick="javascript:setcol('#FFF')" value="#FFF" id=c111 $c7><label for=c111></label> + <input class="color" type="radio" name="color" value="#000" id="c000" $c0><label for="c000"></label> + <input class="color" type="radio" name="color" value="#00A" id="c001" $c1><label for="c001"></label> + <input class="color" type="radio" name="color" value="#0A0" id="c010" $c2><label for="c010"></label> + <input class="color" type="radio" name="color" value="#0AA" id="c011" $c3><label for="c011"></label> + <input class="color" type="radio" name="color" value="#A00" id="c100" $c4><label for="c100"></label> + <input class="color" type="radio" name="color" value="#A0A" id="c101" $c5><label for="c101"></label> + <input class="color" type="radio" name="color" value="#AA0" id="c110" $c6><label for="c110"></label> + <input class="color" type="radio" name="color" value="#FFF" id="c111" $c7><label for="c111"></label> </fieldset> <img class="dotmark bg" src="?static=therapy_background.png" alt="WARNING: Background Image not available!"> <canvas id="canvas" class="dotmark ov" width="${bg_dim%x*}" height="${bg_dim#*x}"></canvas> -- 2.39.5