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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
var EditorToolbar = View.extend({
el: "#editorToolbar",
events: {
"click [data-role='toggle-map-view']": 'toggleMap',
"click [data-role='toggle-project-settings']": 'toggleSettings',
"click [data-role='open-media-viewer']": 'openMediaViewer',
// "click [data-role='resize-media']": 'resizeMedia',
"click [data-role='destroy-media']": 'destroyMedia',
"click [data-role='toggle-wallpaper-panel']": 'toggleWallpaper',
"click [data-role='toggle-light-control']": 'toggleLightControl',
"click [data-role='edit-wall-text']": 'editWallText',
},
initialize: function(opt){
this.parent = opt.parent
},
toggleMap: function(){
map.toggle()
// $("#minimap").toggleClass("hide");
},
toggleSettings: function(){
this.resetMode()
$(".inuse").removeClass("inuse")
this.parent.lightControl.hide()
this.parent.wallpaperPicker.hide()
this.parent.mediaEditor.hide()
this.parent.settings.toggle()
},
openMediaViewer: function(){
this.parent.mediaViewer.show()
this.parent.mediaUpload.show()
this.resetMode()
this.resetControls()
},
resetMode: function(){
// this.resizeMedia(true)
this.destroyMedia(false)
app.controller.hideExtras()
base.resetPermissions()
},
resetControls: function(){
$(".inuse").removeClass("inuse")
this.parent.wallpaperPicker.hide()
this.parent.lightControl.hide()
this.parent.settings.hide()
},
resetPermissions: function(){
editor.permissions.assign("pick", true)
editor.permissions.assign("move", true)
editor.permissions.assign("resize", true)
editor.permissions.assign("destroy", false)
},
// resizeMedia: function(e, state){
// this.resetControls()
// if (! state && typeof e == "boolean") {
// state = e
// editor.permissions.assign("resize", state)
// }
// else {
// state = editor.permissions.toggle("resize")
// }
// ! state && editor.permissions.assign("move", true)
// $(".inuse").removeClass("inuse")
// $("[data-role='resize-media']").toggleClass("inuse", state)
// if (state) {
// if (this.parent.mediaEditor.scenery) {
// Scenery.resize.show( this.parent.mediaEditor.scenery )
// }
// }
// else {
// Scenery.resize.hide()
// }
// },
destroyMedia: function(e, state){
this.resetControls()
if (! state && typeof e == "boolean") {
state = e
editor.permissions.assign("destroy", state)
}
else {
state = editor.permissions.toggle("destroy")
}
if (! state) {
this.resetPermissions()
}
else {
app.controller.hideExtras()
}
$(".inuse").removeClass("inuse")
$("[data-role='destroy-media']").toggleClass("inuse", state)
$("body").toggleClass("destroyActive", state)
},
toggleWallpaper: function(){
var state = ! $("[data-role='toggle-wallpaper-panel']").hasClass("inuse")
this.resetMode()
$("[data-role='toggle-wallpaper-panel']").toggleClass("inuse", state)
this.parent.mediaEditor.hide()
this.parent.lightControl.hide()
this.parent.settings.hide()
this.parent.wallpaperPicker.toggle(state)
},
toggleLightControl: function(){
var state = ! $("[data-role='toggle-light-control']").hasClass("inuse")
this.resetMode()
$("[data-role='toggle-light-control']").toggleClass("inuse", state)
this.parent.mediaEditor.hide()
this.parent.wallpaperPicker.hide()
this.parent.settings.hide()
this.parent.lightControl.toggle(state)
},
editWallText: function(){
},
})
var editor = new function(){
this.permissions = new Permissions({
'pick': true,
'move': true,
'resize': true,
'destroy': false,
})
}
|