1
0
Fork 0
web2019/templates/page-solvespace.html

92 lines
3.0 KiB
HTML

{% extends 'page.html' %}
{% block js %}
<script src="/js/models/kf25.js"></script>
<script src="/js/models/viewport.js"></script>
<script src="/js/models/multiport.js"></script>
<script src="/js/models/chamber.js"></script>
<script src="/js/models/k526s-body.js"></script>
<script src="/js/models/k526s-head.js"></script>
<script src="/js/models/k526s-fixture.js"></script>
<script src="/js/models/k526s-adapter.js"></script>
<script src="/js/models/k526s-adapter-assy.js"></script>
<script>
(function () {
function findBootstrapEnvironment() {
let envs = ['xs', 'sm', 'md', 'lg', 'xl'];
let el = document.createElement('div');
document.body.appendChild(el);
let curEnv = envs.shift();
for (let env of envs.reverse()) {
el.classList.add(`d-${env}-none`);
if (window.getComputedStyle(el).display === 'none') {
curEnv = env;
break;
}
}
document.body.removeChild(el);
return curEnv;
}
var bootstrap_env = findBootstrapEnvironment();
var params_chamber = (bootstrap_env === 'xs' || bootstrap_env == 'sm') ? {width: 400, height: 200, scale: 1} : {width: 800, height: 600, scale: 3};
var params_k526s_fixture = (bootstrap_env === 'xs' || bootstrap_env == 'sm') ? {width: 400, height: 200, scale: 6} : {width: 800, height: 400, scale: 12};
var nodes = [{
id: 'kf25',
model: solvespace_model_kf25,
params: {width: 400, height: 300, scale: 10, offset: new THREE.Vector3(-8, 0, 0)},
}, {
id: 'viewport',
model: solvespace_model_viewport,
params: {width: 400, height: 300, scale: 3},
}, {
id: 'multiport',
model: solvespace_model_multiport,
params: {width: 400, height: 300, scale: 3},
}, {
id: 'chamber',
model: solvespace_model_chamber,
params: params_chamber,
}, {
id: 'k526s-body',
model: solvespace_model_k526s_body,
params: {width: 400, height: 300, scale: 6, offset: new THREE.Vector3(-10, -15, 0)},
}, {
id: 'k526s-head',
model: solvespace_model_k526s_head,
params: {width: 400, height: 300, scale: 8, offset: new THREE.Vector3(25, 0, 0)},
}, {
id: 'k526s-fixture',
model: solvespace_model_k526s_fixture,
params: params_k526s_fixture,
}, {
id: 'k526s-adapter',
model: solvespace_model_k526s_adapter,
params: {width: 400, height: 300, scale: 8, offset: new THREE.Vector3(-8, 0, 0)},
}, {
id: 'k526s-adapter-assy',
model: solvespace_model_k526s_adapter_assy,
params: {width: 400, height: 300, scale: 8},
}];
var node;
for (var i = nodes.length - 1; i >= 0; i--) {
node = document.getElementById(nodes[i].id);
node.parentNode.replaceChild(solvespace(nodes[i].model, nodes[i].params), node);
}
})();
</script>
{% endblock %}