blob: 768bbce9c57813c6374ee1bcf62204f7b5c77691 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
import Renderer from './3d_viewer';
export default () => {
const viewer = new Renderer(document.getElementById('js-stl-viewer'));
[].slice.call(document.querySelectorAll('.js-material-changer')).forEach((el) => {
el.addEventListener('click', (e) => {
const { currentTarget } = e;
e.preventDefault();
document.querySelector('.js-material-changer.selected').classList.remove('selected');
currentTarget.classList.add('selected');
currentTarget.blur();
viewer.changeObjectMaterials(currentTarget.dataset.material);
});
});
};
|