summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/ui/editor/EditorView.js
blob: 4067c4d031d07f0ed9d5305149173b4d18385e4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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.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 })
	},

	load: function(name){
		name = sanitize(name)
		$.get(this.projectAction + name, this.ready.bind(this))
	},
	
	loadLayout: function(layout){
		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){
		this.mediaEditor.pick(scenery)
	},
	
	hideExtras: function(){
		this.mediaEditor.hide()
	}

})