color="$(TPY color |grep -xE -m1 '#(000|00A|0A0|0AA|A00|A0A|AA0|FFF)' || printf '#000')"
cat <<EOF
[fieldset .penwidth
- [radio "penwidth" "4" #pw1 $(selected $penwidth 4) ][label for="pw2"]
- [radio "penwidth" "12" #pw2 $(selected $penwidth 12)][label for="pw3"]
- [radio "penwidth" "36" #pw3 $(selected $penwidth 36)][label for="pw1"]
+ [radio "penwidth" "4" #pw1 $(checked "$penwidth" 4) ][label for="pw2"]
+ [radio "penwidth" "12" #pw2 $(checked "$penwidth" 12)][label for="pw3"]
+ [radio "penwidth" "36" #pw3 $(checked "$penwidth" 36)][label for="pw1"]
]
[fieldset .color
- [radio "color" "#000" .color #c000 $(checked $color '#000') ][label for=c000 ]
- [radio "color" "#00A" .color #c001 $(checked $color '#00A') ][label for=c001 ]
- [radio "color" "#0A0" .color #c010 $(checked $color '#0A0') ][label for=c010 ]
- [radio "color" "#0AA" .color #c011 $(checked $color '#0AA') ][label for=c011 ]
- [radio "color" "#A00" .color #c100 $(checked $color '#A00') ][label for=c100 ]
- [radio "color" "#A0A" .color #c101 $(checked $color '#A0A') ][label for=c101 ]
- [radio "color" "#AA0" .color #c110 $(checked $color '#AA0') ][label for=c110 ]
- [radio "color" "#FFF" .color #c111 $(checked $color '#FFF') ][label for=c111 ]
+ [radio "color" "#000" .color #c000 $(checked "$color" '#000') ][label for=c000 ]
+ [radio "color" "#00A" .color #c001 $(checked "$color" '#00A') ][label for=c001 ]
+ [radio "color" "#0A0" .color #c010 $(checked "$color" '#0A0') ][label for=c010 ]
+ [radio "color" "#0AA" .color #c011 $(checked "$color" '#0AA') ][label for=c011 ]
+ [radio "color" "#A00" .color #c100 $(checked "$color" '#A00') ][label for=c100 ]
+ [radio "color" "#A0A" .color #c101 $(checked "$color" '#A0A') ][label for=c101 ]
+ [radio "color" "#AA0" .color #c110 $(checked "$color" '#AA0') ][label for=c110 ]
+ [radio "color" "#FFF" .color #c111 $(checked "$color" '#FFF') ][label for=c111 ]
]
[img .dotmark .bg src="/therapies/therapy_background.png" alt="WARNING: Missing background image!"]
[canvas #canvas .dotmark .ov width="${bg_dim%x*}" height="${bg_dim#*x}" ]
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 ???
+ image.beginPath();
+ draw(x, y); // why must this not use relative Coords ???
- image_serialize = " polyline"
+ image_serialize = " polyline " + stx + "," + sty;
}
function drawstop() {
// if path ends close to beginning ( < 50 px); then close path and fill
- if ( false && mouse == 1 && Math.sqrt( Math.pow(stx - cux, 2) + Math.pow(sty - cuy, 2)) <= 50 && c !== "#FFF" ){
+ if ( mouse == 1 && Math.sqrt( Math.pow(stx - cux, 2) + Math.pow(sty - cuy, 2)) <= 50 && c !== "#FFF" ){
image.lineTo( stx, sty )
image.stroke()