-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.html
68 lines (62 loc) · 2.15 KB
/
test.html
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
<html>
<head>
<meta charset="utf-8">
<title>Test</title>
<style>
*{margin: 0; padding: 0;}
body{padding: 50px;}
#container{display: none;}
#canvas{border: #000 solid 1px; width: 1000px; height: 600px;}
</style>
<!--<script type="text/javascript" src="./assets/javascripts/hidpi-canvas.min.js"></script>-->
<script type="text/javascript" src="./assets/javascripts/canvas.js"></script>
<script type="text/javascript" src="./assets/javascripts/zepto.min.js"></script>
<script type="text/javascript">
$(function(){
$('#show_button').click(function(){
$('#container').css({'display': 'block'});
window.CurrentScene.digest();
window.RootNode.digest();
});
$('#hide_button').click(function(){
$('#container').css({'display': 'none'});
});
});
</script>
</head>
<body>
<input id="show_button" type="button" value="Show Canvas" />
<input id="hide_button" type="button" value="Hide Canvas" />
<br /><br /><br />
<div id="container">
<canvas width='1000' height='600' id="canvas"></canvas>
<div id="elementContainer"></div>
</div>
<script type="text/javascript" src="./bundle.js"></script>
<script type="text/javascript">
var scene = window.CurrentScene = new Scene('canvas', {
infinity: true,
elementContainer: 'elementContainer'
});
var serial = 0;
// Drawing a Node
var rootElement = $('<h1 />');
rootElement.text('Root');
var node = window.RootNode = new Node({
element: rootElement,
color: 'red'
});
scene.addBox(node.box, 20, 120, 0);
for(var i = 0; i < 2; i++){
var childnode = new Node({color: 'blue'});
node.addChildNode(childnode);
for(var i_ = 0; i_ < 2; i_++){
var childnode_ = new Node({color: 'green'});
childnode.addChildNode(childnode_);
var childnode2_ = new Node();
childnode_.addChildNode(childnode2_);
}
}
</script>
</body>
</html>