var EditorView = View.extend({ el: "#editorView", projectAction: "/api/project/", layoutAction: "/api/layout/", events: { }, initialize: function(){ this.toolbar = new EditorToolbar ({ parent: this }) this.settings = new EditorSettings ({ parent: this }) this.info = new BuilderInfo ({ parent: this }) this.mediaViewer = new MediaViewer ({ parent: this }) this.mediaUpload = new MediaUpload ({ parent: this }) this.mediaEditor = new MediaEditor ({ parent: this }) this.wallpaperPicker = new WallpaperPicker ({ parent: this }) this.lightControl = new LightControl ({ parent: this }) this.textEditor = new TextEditor ({ parent: this }) this.collaborators = new Collaborators ({ parent: this }) this.presets = new Presets ({ parent: this }) }, load: function(name){ name = sanitize(name) $.get(this.projectAction + name, this.ready.bind(this)) }, loadLayout: function(layout){ if (layout == "empty") { this.readyLayout({}) this.toolbar.toggleMap() return } layout = sanitize(layout) $.get(this.layoutAction + layout, this.readyLayout.bind(this)) }, ready: function(data){ $("#map").hide() this.settings.load(data) }, readyLayout: function(data){ data.isNew = true this.ready(data) }, pick: function(scenery){ if (scenery.type == "text") { this.mediaEditor.hide() this.textEditor.pick(scenery) } else { this.textEditor.hide() this.mediaEditor.pick(scenery) } }, pickWall: function(wall, pos){ this.hideExtras() this.wallpaperPicker.pickWall(wall) }, hideExtras: function(){ this.mediaEditor.hide() this.textEditor.hide() Scenery.resize.hide() Scenery.hovering = false } })