Add dat.gui, and enable to update dxf elevation for bim_2_overlay_with_dxf

This commit is contained in:
yanzexuan
2023-09-03 17:54:59 +08:00
parent ebd4cdf1a5
commit 7ea3f560b6
4 changed files with 2542 additions and 2 deletions

View File

@ -37,7 +37,6 @@ import { DxfViewer, DxfViewerConfig, ModelConfig } from "@pattern-x/gemini-viewe
const viewerCfg: DxfViewerConfig = { const viewerCfg: DxfViewerConfig = {
containerId: "myCanvas", containerId: "myCanvas",
enableToolbar: true,
enableSpinner: true, enableSpinner: true,
enableLayoutBar: true, enableLayoutBar: true,
}; };

View File

@ -24,6 +24,8 @@
NavCubePlugin, NavCubePlugin,
SectionPlugin, SectionPlugin,
} from "./demo/libs/gemini-viewer.esm.min.js"; } 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 = { const project = {
"id": "building1", "id": "building1",
@ -82,6 +84,22 @@
// viewer.setToOrthographicCamera(false); // 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> </script>
</body> </body>

View File

@ -31,7 +31,6 @@
const viewerCfg = { const viewerCfg = {
containerId: "myCanvas", containerId: "myCanvas",
language: "en", language: "en",
enableToolbar: false,
} }
const viewer = new BimViewer(viewerCfg); const viewer = new BimViewer(viewerCfg);

File diff suppressed because one or more lines are too long