-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
80 lines (74 loc) · 3.02 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
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<title>test jsx</title>
<link rel="stylesheet" type="text/css" href="thirdParty/jsxgraph/jsxgraph.css" />
<script type="text/javascript" src="thirdParty/jsxgraph/jsxgraphcore.js"></script>
<script type="text/javascript" src="thirdParty/require/require.min.js"></script>
<script type="text/javascript" src="thirdParty/jquery/jquery.min.js"></script>
<script type="text/javascript" src="./bundle.js"></script>
</head>
<body style="touch-action:none;">
<h1>test</h1>
<div>
<div id="theDiv" style="display:inline-block;border: solid 2px #ccc;border-radius: 4px;"></div>
<div style="margin:0 20px;display:inline-block;vertical-align:top;">
<h3>modes:</h3>
<ul class="modes" style="list-style:none;padding: 0;margin: 0;">
<li>
<input name="mode" type="radio" value="0" id="addSegment" checked />
<label for="addSegment"> addSegment</label>
</li>
<li>
<input name="mode" type="radio" value="2" id="move" />
<label for="move"> move</label>
</li>
<li>
<input name="mode" type="radio" value="6" id="delete" />
<label for="delete"> delete</label>
</li>
</ul>
<div>
<textarea id="stateField" style="width: 300px; height: 300px;"></textarea>
<br /><button id="setState">Set State</button>
</div>
</div>
</div>
<h2>and another one...</h2>
<div>
<div id="theDiv2" style="display:inline-block; border: solid 2px #ccc;border-radius: 4px;"></div>
<div style="margin:0 20px;display:inline-block;vertical-align:top;">
<h3>modes:</h3>
<ul class="modes2" style="list-style:none;padding: 0;margin: 0;">
<li>
<input name="mode2" type="radio" value="0" id="addSegment2" checked />
<label for="addSegment2"> addSegment</label>
</li>
<li>
<input name="mode2" type="radio" value="2" id="move2" />
<label for="move2"> move</label>
</li>
<li>
<input name="mode2" type="radio" value="6" id="delete2" />
<label for="delete2"> delete</label>
</li>
</ul>
</div>
</div>
<script>
console.log(JXG);
require(['cet.geometry/app/geoboard'], Geoboard => {
var theDiv = document.getElementById('theDiv');
const board = new Geoboard(theDiv, {}, {});
var theDiv = document.getElementById('theDiv2');
const board2 = new Geoboard(theDiv2, { gridType: 1 }, {});
$('.modes input').click(function () { board.setMode(parseInt(this.value)) });
$('.modes2 input').click(function () { board2.setMode(parseInt(this.value)) });
board.onChange(() => $('#stateField').val(JSON.stringify(board.getState())));
$('#setState').click(() => board.setState(JSON.parse($('#stateField').val())));
});
</script>
</body>
</html>