@inweb/viewer-three
Version:
JavaScript library for rendering CAD and BIM files in a browser using Three.js
26 lines (22 loc) • 825 B
JavaScript
import Stats from "three/examples/jsm/libs/stats.module.js";
import { components } from "@inweb/viewer-three";
class StatsPanelComponent {
constructor(viewer) {
this.updateStats = () => {
this.viewer.render(null, true);
this.stats.update();
};
this.stats = new Stats;
this.stats.dom.style.position = "absolute";
viewer.canvas.parentElement.appendChild(this.stats.dom);
this.viewer = viewer;
this.viewer.on("animate", this.updateStats);
}
dispose() {
this.viewer.off("animate", this.updateStats);
this.stats.dom.remove();
this.stats = undefined;
}
}
components.registerComponent("StatsPanelComponent", (viewer => new StatsPanelComponent(viewer)));
//# sourceMappingURL=StatsPanelComponent.module.js.map