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'));
|
|
|
|
|
|
|
|
[].slice.call(document.querySelectorAll('.js-material-changer')).forEach((el) => {
|
|
|
|
el.addEventListener('click', (e) => {
|
|
|
|
const target = e.target;
|
|
|
|
|
|
|
|
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
|
|
|
};
|