X-Git-Url: https://git.plutz.net/?p=confetti;a=blobdiff_plain;f=static%2Ftherapy_draw.js;h=8a8e936c6873b443a0d7ba0799b491e7f5d50f7e;hp=0b5dffa0366c9fd259ee09c13588458e83076869;hb=e75e1486ac6903578fbc20fdcea659412cb3866f;hpb=9e431de236bdca27bcfec6f9f9e86af02850578f diff --git a/static/therapy_draw.js b/static/therapy_draw.js old mode 100755 new mode 100644 index 0b5dffa..8a8e936 --- a/static/therapy_draw.js +++ b/static/therapy_draw.js @@ -29,17 +29,17 @@ image_serialize="" stx=0, sty=0 cux=0, cuy=0 +function setstroke(w) { + image.lineWidth = w + data.value += " stroke-width " + image.lineWidth +} function setcol(c) { this.c = c image.strokeStyle = 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" } -setcol("$tpy[color]") - function relX(x){ if ( body.clientWidth >= 800 ){ return Math.floor(cscaleW * (x - canvas.offsetLeft)) @@ -74,6 +74,9 @@ function drawstart(x, y) { stx=relX(x), sty=relY(y) + setstroke(document.querySelector('input[name="penwidth"]:checked').value); + setcol(document.querySelector('input[name="color"]:checked').value); + image.beginPath() draw(x, y) // why must this not use relative Coords ??? @@ -83,7 +86,7 @@ function drawstart(x, y) { function drawstop() { // if path ends close to beginning ( < 50 px); then close path and fill - if ( mouse == 1 && Math.sqrt( Math.pow(stx - cux, 2) + Math.pow(sty - cuy, 2)) <= 50 && c !== "#FFF" ){ + if ( false && mouse == 1 && Math.sqrt( Math.pow(stx - cux, 2) + Math.pow(sty - cuy, 2)) <= 50 && c !== "#FFF" ){ image.lineTo( stx, sty ) image.stroke()