-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpropertiesUI.js
63 lines (60 loc) · 2.56 KB
/
propertiesUI.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
var uiFactory = new UIFactory();
var activeElement = null;
var showProperties = function(node) {
document.getElementById("sidebar_right").style.display = "block";
addClass(node, "button_dark_active");
currentObjectId = node.dataset.id;
uiFactory.resetAttributes();
if (node.dataset.type == "plane"||
node.dataset.type == "cube"||
node.dataset.type == "sphere"||
node.dataset.type == "icosahedron"||
node.dataset.type == "obj"){
uiFactory.parent = true;
uiFactory.position = true;
uiFactory.rotation = true;
uiFactory.scale = true;
uiFactory.color = true;
uiFactory.twoFaceTransparency = true;
uiFactory.lighting = true;
uiFactory.visibility = true;
uiFactory.editScript = true;
if(objects[currentObjectId].textureCoords&&objects[currentObjectId].textureIndices){
uiFactory.texture = true;
uiFactory.numberOfTextures = getNumberOfUniqueElements(objects[currentObjectId].textureIndices);
}
}else if(node.dataset.type == "light"){
uiFactory.position = true;
uiFactory.lightColor = true;
uiFactory.lightSpecularColor = true;
uiFactory.editScript = true;
}else if(node.dataset.type == "camera"){
uiFactory.camera = true;
//uiFactory.parent = true;
// TODO: add editScript
}else if(node.dataset.type == "skybox"){
//uiFactory.editScript = true; // TODO: editScript, visibility
//uiFactory.visibility = true;
uiFactory.skybox = true;
uiFactory.numberOfTextures = getNumberOfUniqueElements(objects[currentObjectId].textureIndices);
}else if(node.dataset.type == "empty"){
uiFactory.parent = true;
uiFactory.position = true;
uiFactory.rotation = true;
}
uiFactory.inflatePropertiesUI(document.getElementById("properties_list"));
node.removeEventListener("click", handleClickOnObject);
node.addEventListener("click", hideProperties, false);
if(activeElement!=null && activeElement != node){
activeElement.removeEventListener("click", hideProperties);
activeElement.addEventListener("click", handleClickOnObject);
removeClass(activeElement, "button_dark_active");
}
activeElement = node;
};
var hideProperties = function(){
document.getElementById("sidebar_right").style.display = "none";
activeElement.removeEventListener("click", hideProperties);
activeElement.addEventListener("click", handleClickOnObject);
removeClass(activeElement, "button_dark_active");
};