2017-04-06 06:02:24 -04:00
|
|
|
import Renderer from './3d_viewer';
|
|
|
|
|
2018-03-01 03:21:08 -05:00
|
|
|
export default () => {
|
2017-04-06 06:02:24 -04:00
|
|
|
const viewer = new Renderer(document.getElementById('js-stl-viewer'));
|
|
|
|
|
2018-10-10 02:09:55 -04:00
|
|
|
[].slice.call(document.querySelectorAll('.js-material-changer')).forEach(el => {
|
|
|
|
el.addEventListener('click', e => {
|
2018-06-16 17:50:13 -04:00
|
|
|
const { target } = e;
|
2017-04-06 06:02:24 -04:00
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
document.querySelector('.js-material-changer.active').classList.remove('active');
|
|
|
|
target.classList.add('active');
|
|
|
|
target.blur();
|
|
|
|
|
|
|
|
viewer.changeObjectMaterials(target.dataset.type);
|
|
|
|
});
|
|
|
|
});
|
2018-03-01 03:21:08 -05:00
|
|
|
};
|