// A simple sketch editor.

// Select whole workspace, and press [do it]

ctx = $('playArea').getContext('2d');
ctx.beginPath();
ctx.lineCap = "round";
// You can change the color or width of the pen to modify following expression.
ctx.strokeStyle = "rgba(255, 128, 64, 0.1)";
ctx.lineWidth = 8;
canvas.onmousedown = function (e) {
  this.pendown = true
}
canvas.onmouseup = function (e) {
  ctx.beginPath();
  this.pendown = false
}
canvas.onmousemove = function (e) {
topLeft = YAHOO.util.Dom.getXY(this)
  if (this.pendown) {
    ctx.lineTo(e.pageX - topLeft[0], e.pageY - topLeft[1]);
    ctx.stroke();
  } else {
   ctx.moveTo(e.pageX - topLeft[0], e.pageY - topLeft[1]);
  }
}