debian-mirror-gitlab/app/assets/javascripts/blob/stl_viewer.js

20 lines
545 B
JavaScript
Raw Normal View History

2017-08-17 22:00:37 +05:30
import Renderer from './3d_viewer';
2018-03-27 19:54:05 +05:30
export default () => {
2017-08-17 22:00:37 +05:30
const viewer = new Renderer(document.getElementById('js-stl-viewer'));
2021-03-08 18:12:59 +05:30
[].slice.call(document.querySelectorAll('.js-material-changer')).forEach((el) => {
el.addEventListener('click', (e) => {
2018-11-08 19:23:39 +05:30
const { target } = e;
2017-08-17 22:00:37 +05:30
e.preventDefault();
2021-04-29 21:17:54 +05:30
document.querySelector('.js-material-changer.selected').classList.remove('selected');
target.classList.add('selected');
2017-08-17 22:00:37 +05:30
target.blur();
viewer.changeObjectMaterials(target.dataset.type);
});
});
2018-03-27 19:54:05 +05:30
};