forked from xml3d/xml3d.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathviewpoint.js
More file actions
41 lines (33 loc) · 1.2 KB
/
Copy pathviewpoint.js
File metadata and controls
41 lines (33 loc) · 1.2 KB
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
module("Viewpoint", {
setup : function() {
stop();
var that = this;
this.cb = function(e) {
ok(true, "Scene loaded");
that.doc = document.getElementById("xml3dframe").contentDocument;
start();
};
loadDocument("scenes/viewpoint.xhtml" + window.location.search, this.cb);
},
teardown : function() {
var v = document.getElementById("xml3dframe");
v.removeEventListener("load", this.cb, true);
}
});
test("Remove and add viewpoints", function() {
var xml3dElement = this.doc.getElementById("xml3DElem"),
views = this.doc.getElementById("views"),
meshGroup = this.doc.getElementById("mesh");
xml3dElement.removeChild(meshGroup);
xml3dElement.appendChild(meshGroup);
while(views.firstChild){
views.removeChild(views.firstChild);
}
var newGroup = this.doc.createElementNS(XML3D.xml3dNS, "group");
newGroup.setAttribute("style", "transform: translateY(3)");
var newView = this.doc.createElementNS(XML3D.xml3dNS, "view");
newView.id = "newView";
newGroup.appendChild(newView);
views.appendChild(newGroup);
xml3dElement.activeView = "#newView";
});