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();
|
|
|
|
|
|
|
|
document.querySelector('.js-material-changer.active').classList.remove('active');
|
|
|
|
target.classList.add('active');
|
|
|
|
target.blur();
|
|
|
|
|
|
|
|
viewer.changeObjectMaterials(target.dataset.type);
|
|
|
|
});
|
|
|
|
});
|
2018-03-27 19:54:05 +05:30
|
|
|
};
|