-
Notifications
You must be signed in to change notification settings - Fork 0
/
ControllerMan.js
66 lines (50 loc) · 1.31 KB
/
ControllerMan.js
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
function ControllerMan(model)
{
console.log('creating controllerman');
var self = this;
self.addTriangle = function()
{
console.log('controllerman addtriangle');
model.addTriangle(model.createTriangle());
}
self.removeTriangle = function(index)
{
console.log('controllerman removetriangle');
model.removeTriangle(index);
}
self.triangleChanged = function(triangle,index)
{
console.log('controllerman trianglechanged');
model.changeTriangle(triangle, index);
}
self.addLight = function()
{
console.log('controllerman addlight');
model.addLight(model.createLight());
}
self.removeLight = function(index)
{
console.log('controllerman removelight');
model.removeLight(index);
}
self.lightChanged = function(light,index)
{
console.log('controllerman lightchanged');
model.changeLight(light, index);
}
self.loadJson = function(triangles, lights)
{
console.log('controllerman loadjson');
model.removeAllTriangles();
model.removeAllLights();
for(var i = 0; i < triangles.length; i++)
model.addTriangle(triangles[i]);
for(var i = 0; i < lights.length; i++)
model.addLight(lights[i]);
}
self.outputJson = function()
{
console.log('controllerman outputjson');
model.requestStateDeclaration();
}
}