title: Drawing a circle on the canvas using mouse events
body: <p>I am trying to draw a circle using mouse on the canvas using mouse events, but it does not draw anything:</p>
  
  <pre><code>tools.circle = function () {
  var tool = this;
  this.started = false;
  this.mousedown = function (ev) {
  tool.started = true;
  tool.x0 = ev._x;
  tool.y0 = ev._y;
  ctx.moveTo(tool.x0,tool.y0);
  };
  
  this.mousemove = function (ev) {
  var centerX = Math.max(tool.x0,ev._x) - Math.abs(tool.x0 - ev._x)/2;
  var centerY = Math.max(tool.y0,ev._y) - Math.abs(tool.y0 - ev._y)/2;
  var distance = Math.sqrt(Math.pow(tool.x0 - ev._x,2) + Math.pow(tool.y0 - ev._y));
  context.circle(tool.x0, tool.y0, distance/2,0,Math.PI*2 ,true);
  context.stroke();
  };
  };
  </code></pre>
  
  <p>What am I doing wrong?</p>