 doCanvasClick = (e) ->
   e.preventDefault()
   [x,y] = getCanvasCursorPosition e, canvas
-  #toggleCellAt x, y
-  cx = canvas.width*0.5
-  cy = canvas.height*0.5
-  r = Math.min(cx, cy)
-
-  dx = x-cx
-  dy = y-cy
-  if dx*dx + dy*dy <= r*r*0.8*0.8
-    dragHandler = new MovingDragger x, y
-  else
-    dragHandler = new RotatingDragger x, y
+  unless (e.button is 0) and not e.shiftKey
+    toggleCellAt x, y
+  else 
+    cx = canvas.width*0.5
+    cy = canvas.height*0.5
+    r = Math.min(cx, cy)
+
+    dx = x-cx
+    dy = y-cy
+    if dx*dx + dy*dy <= r*r*(0.8*0.8)
+      dragHandler = new MovingDragger x, y
+    else
+      dragHandler = new RotatingDragger x, y
 
 doCanvasMouseMove = (e) ->
   if dragHandler isnt null

  #viewCenter = M.mulv tfm, [0.0,0.0,1.0]
  #Math.acosh(viewCenter[2])
  Math.acosh tfm[8]
  
redraw()


  [c,   s,   0.0,
   -s,  c,   0.0,
   0.0, 0.0, 1.0]

jumpLimit = 1.5
  
modifyView = (m) ->
  tfm = M.mul m, tfm
  originDistance = viewDistanceToOrigin()
  if originDistance > jumpLimit
    rebaseView()
  E('distance').innerHTML = '' + originDistance.toFixed(2)
  redraw()  

rotateView = (angle) -> modifyView rotateMatrix angle
