33 lines
727 B
JavaScript
33 lines
727 B
JavaScript
'use strict';
|
|
|
|
import BIM from './bim.js';
|
|
|
|
/**
|
|
* @namespace UI
|
|
*/
|
|
const UI = {};
|
|
/**
|
|
*
|
|
* @param {HTMLElement} container The scene container element
|
|
*/
|
|
UI.setScene = function (container) {
|
|
BIM.createScene(container);
|
|
}
|
|
/**
|
|
* Returns the loaded model
|
|
* @param {string} btnId The loading button's id
|
|
*/
|
|
UI.ifcLoader = function (btnId = 'load-ifc') {
|
|
const loadBtn = document.querySelector(`#${btnId}`);
|
|
let model = null;
|
|
loadBtn.onchange = async function () {
|
|
const files = this.files;
|
|
model = await BIM.loadIfc(new Uint8Array(await files[0].arrayBuffer()));
|
|
// Set a raycaster to select objects
|
|
BIM.setupHighligther(model);
|
|
}
|
|
|
|
return model;
|
|
};
|
|
|
|
export default UI; |