Add dat.gui, and enable to update dxf elevation for bim_2_overlay_with_dxf
This commit is contained in:
@ -37,7 +37,6 @@ import { DxfViewer, DxfViewerConfig, ModelConfig } from "@pattern-x/gemini-viewe
|
||||
|
||||
const viewerCfg: DxfViewerConfig = {
|
||||
containerId: "myCanvas",
|
||||
enableToolbar: true,
|
||||
enableSpinner: true,
|
||||
enableLayoutBar: true,
|
||||
};
|
||||
|
@ -24,6 +24,8 @@
|
||||
NavCubePlugin,
|
||||
SectionPlugin,
|
||||
} from "./demo/libs/gemini-viewer.esm.min.js";
|
||||
import * as dat from "./demo/libs/dat.gui.module.js";
|
||||
const gui = new dat.GUI();
|
||||
|
||||
const project = {
|
||||
"id": "building1",
|
||||
@ -82,6 +84,22 @@
|
||||
// viewer.setToOrthographicCamera(false);
|
||||
});
|
||||
});
|
||||
|
||||
// dat.gui controls
|
||||
const controls = {
|
||||
dxfElevation: 0,
|
||||
}
|
||||
// update dxf elevation between -2 to 30, default value is 17.
|
||||
gui.add(controls, "dxfElevation", -2.0, 30.0, 0.1)
|
||||
.name("Dxf elevation")
|
||||
.setValue(17) // the origin value is 17
|
||||
.onChange((val) => {
|
||||
const dxf = viewer.loadedModels.find((model) => model.modelId.endsWith(".dxf"));
|
||||
const object = dxf.object;
|
||||
object.position.setY(val);
|
||||
object.updateMatrix();
|
||||
viewer.enableRender();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
@ -31,7 +31,6 @@
|
||||
const viewerCfg = {
|
||||
containerId: "myCanvas",
|
||||
language: "en",
|
||||
enableToolbar: false,
|
||||
}
|
||||
const viewer = new BimViewer(viewerCfg);
|
||||
|
||||
|
2524
public/demo/libs/dat.gui.module.js
Normal file
2524
public/demo/libs/dat.gui.module.js
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user