forked from qvvdata/molecule-vizualisation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimport-test.html
96 lines (76 loc) · 2.68 KB
/
import-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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Import Test</title>
<link rel="stylesheet" href="./example/css/import-test.css"/>
</head>
<body class="import-test">
<div id="controls">
<button id="resetZoom">Reset zoom</button>
<button id="zoomThyroid">Zoom on thyroid</button>
<button id="appendThyroid">Append thyroid</button>
</div>
<div class="chart-holder chart-holder-original"></div>
<div class="chart-holder chart-holder-two-third"></div>
<div class="chart-holder chart-holder-half"></div>
<!-- <div class="chart-holder chart-holder-random"></div> -->
<script type="module">
import './dist/MoleculeVizualisation.js';
import MLCV_ENUMS from './src/enums.js';
import MLCV_STATES from './src/mlcvStates.js';
import thyroid from './src/states/thyroid.js';
import figure from './src/states/figure.js';
const vizList = [];
const settings = {
mode: MLCV_ENUMS.VIEW,
debug: false,
performanceMonitoring: false,
showGizmos: false,
editor: false
};
const moleculeVizualisationOriginalSize = new MoleculeVizualisation(
document, '.chart-holder-original', settings
);
moleculeVizualisationOriginalSize.init()
.importDefaultState(figure)
.startRenderLoop();
const moleculeVizualisationTwoThird = new MoleculeVizualisation(
document, '.chart-holder-two-third', settings
);
moleculeVizualisationTwoThird.init()
.importDefaultState(figure)
.startRenderLoop();
const moleculeVizualisationHalfSize = new MoleculeVizualisation(
document, '.chart-holder-half', settings
);
moleculeVizualisationHalfSize.init()
.importDefaultState(figure)
.startRenderLoop();
vizList.push(moleculeVizualisationOriginalSize);
vizList.push(moleculeVizualisationTwoThird);
vizList.push(moleculeVizualisationHalfSize);
// const moleculeVizualisationRandomSize = new MoleculeVizualisation(
// document, '.chart-holder-random', settings
// );
// moleculeVizualisationRandomSize.init()
// .importDefaultState(MLCV_STATES.Default)
// .startRenderLoop();
//
function loopOverViz(functionName, argumentArray = []) {
for (let i = 0; i < vizList.length; i++) {
vizList[i][functionName](...argumentArray);
}
}
window.document.querySelector('#appendThyroid').addEventListener('click', () => {
loopOverViz('importState', [thyroid]);
});
window.document.querySelector('#zoomThyroid').addEventListener('click', () => {
loopOverViz('zoomOnEmitterWithId', ['thyroid', 3]);
});
window.document.querySelector('#resetZoom').addEventListener('click', () => {
loopOverViz('resetZoom', [2000]);
});
</script>
</body>
</html>