gitlab-org--gitlab-foss/app/assets/javascripts/blob/stl_viewer.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
577 B
JavaScript
Raw Normal View History

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 { currentTarget } = e;
2017-04-06 06:02:24 -04:00
e.preventDefault();
document.querySelector('.js-material-changer.selected').classList.remove('selected');
currentTarget.classList.add('selected');
currentTarget.blur();
2017-04-06 06:02:24 -04:00
viewer.changeObjectMaterials(currentTarget.dataset.material);
2017-04-06 06:02:24 -04:00
});
});
2018-03-01 03:21:08 -05:00
};