       @position.y, @canvas.height, oldScale, @scale)
 
     @repaint()
+    @trigger('zoom', {oldScale: oldScale, newScale: @scale})
 
   # Repaints the canvas.
   # If dirty is true then all saved shapes are completely redrawn,


  saveShape: (shape) ->
    @execute(new LC.AddShapeAction(this, shape))

  pan: (x, y) ->
    # Subtract because we are moving the viewport
    @position.x = @position.x - x
    @position.y = @position.y - y

  zoom: (factor) ->
    oldScale = @scale

    @execute(new LC.ClearAction(this))
    @shapes = []
    @repaint()
    @trigger('clear', null)

  execute: (action) ->
    @undoStack.push(action)
