- <span id="jsdebug" style="display: none; position: fixed; right:0; bottom:0">Debug</span>
-
- <script><!--
- body = document.body
- canvas = document.getElementById("canvas")
- dbg = document.getElementById("jsdebug")
- image = canvas.getContext("2d")
- mouse = 0
- image_serialize=""
- data=document.getElementById("image_serialize")
-
- function setcol(c) {
- image.fillStyle = c
- image_serialize += " fill " + c
- }
-
- setcol("$tpy[color]")
-
- function circle(x, y) {
- if ( mouse == 1){
- if ( body.clientWidth >= 800 ){
- sx=Math.floor(cscaleW * (x - canvas.offsetLeft))
- sy=Math.floor(cscaleH * (y - canvas.offsetTop))
- } else {
- 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_serialize += " circle " + sx + "," + sy + " " + (sx-5) + "," + sy
- }
- }
-
- function drawstart(x, y) {
- mouse = 1