     @coordinateGrid.showGrid() if @world.showGrid or @options.grid
     @coordinateDisplay ?= new CoordinateDisplay camera: @camera, layer: @surfaceTextLayer if @world.showCoordinates or @options.coords
 
-  onResize: (e) =>
+  hookUpChooseControls: ->
+    chooserOptions = stage: @stage, surfaceLayer: @surfaceLayer, camera: @camera, restrictRatio: @options.choosing is 'ratio-region'
+    klass = if @options.choosing is 'point' then PointChooser else RegionChooser
+    @chooser = new klass chooserOptions
+
+  initAudio: ->
+    @musicPlayer = new MusicPlayer()
+
+
+
+  #- Setting the world
+    
+  setWorld: (@world) ->
+    @worldLoaded = true
+    lastFrame = Math.min(@getCurrentFrame(), @world.frames.length - 1)
+    @world.getFrame(lastFrame).restoreState() unless @options.choosing
+    @spriteBoss.world = @world
+
+    @showLevel()
+    @updateState true if @loaded
+    @onFrameChanged()
+    Backbone.Mediator.publish 'surface:world-set-up', {world: @world}
+
+  showLevel: ->
     return if @destroyed
-    oldWidth = parseInt @canvas.attr('width'), 10
-    oldHeight = parseInt @canvas.attr('height'), 10
-    aspectRatio = oldWidth / oldHeight
-    pageWidth = $('#page-container').width() - 17  # 17px nano scroll bar
-    if @realTime or @options.spectateGame
-      pageHeight = $('#page-container').height() - $('#control-bar-view').outerHeight() - $('#playback-view').outerHeight()
-      newWidth = Math.min pageWidth, pageHeight * aspectRatio
-      newHeight = newWidth / aspectRatio
-    else if $('#thangs-tab-view')
-      newWidth = $('#canvas-wrapper').width()
-      newHeight = newWidth / aspectRatio
-    else
-      newWidth = 0.55 * pageWidth
-      newHeight = newWidth / aspectRatio
-    return unless newWidth > 0 and newHeight > 0
-    ##if InstallTrigger?  # Firefox rendering performance goes down as canvas size goes up
-    ##  newWidth = Math.min 924, newWidth
-    ##  newHeight = Math.min 589, newHeight
-    #@canvas.width newWidth
-    #@canvas.height newHeight
-    @canvas.attr width: newWidth, height: newHeight
-    @stage.scaleX *= newWidth / oldWidth
-    @stage.scaleY *= newHeight / oldHeight
-    @camera.onResize newWidth, newHeight
-
-  showLevel: ->
-    return if @dead
-    return unless @worldLoaded
     return if @loaded
     @loaded = true
     @spriteBoss.createMarks()

    ++@totalFramesDrawn
    @stage.update e

  # Real-time playback
  onRealTimePlaybackWaiting: (e) ->
    @onRealTimePlaybackStarted e


    return if not @paths
    @paths.parent.removeChild @paths
    @paths = null
    
    
    
  #- Screenshot

  screenshot: (scale=0.25, format='image/jpeg', quality=0.8, zoom=2) ->
    # Quality doesn't work with image/png, just image/jpeg and image/webp
