         icons: 
           primary: "ui-icon-play"
 
+  $("#resetButton").on "click", ->
+    currentFrame = 0
+    currentModel = currentModel.atVersion(0)
+
+    editors.modelEditor.setValue(JSON.stringify(currentModel.data, null, MODEL_FORMATTING_INDENTATION))
+    # The new contect will be selected by default
+    editors.modelEditor.selection.clearSelection() 
+
+
+
 setupEditor = (id) ->
   editor = ace.edit(id)
   editor.getSession().setMode("ace/mode/javascript")

globals = @

CODE_CHANGE_TIMEOUT = 1000

MessageType = GE.makeConstantSet("Error", "Info")


handleAnimation = ->
  if not isPlaying then return false

  currentModel = executeCode()
  currentFrame++

  editors.modelEditor.setValue(JSON.stringify(currentModel.data, null, MODEL_FORMATTING_INDENTATION))
  # The new contect will be selected by default
  editors.modelEditor.selection.clearSelection() 

