Skip to content

Commit

Permalink
Merge pull request #115 from pattern-x/feature/dat.gui
Browse files Browse the repository at this point in the history
Add dat.gui, and enable to update dxf elevation for bim_2_overlay_wit…
  • Loading branch information
pattern-x committed Sep 4, 2023
2 parents ebd4cdf + 7ea3f56 commit d894350
Show file tree
Hide file tree
Showing 4 changed files with 2,542 additions and 2 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import { DxfViewer, DxfViewerConfig, ModelConfig } from "@pattern-x/gemini-viewe

const viewerCfg: DxfViewerConfig = {
containerId: "myCanvas",
enableToolbar: true,
enableSpinner: true,
enableLayoutBar: true,
};
Expand Down
18 changes: 18 additions & 0 deletions public/demo/bim_2_overlay_with_dxf.html
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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>

Expand Down
1 change: 0 additions & 1 deletion public/demo/bim_3_explode.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
const viewerCfg = {
containerId: "myCanvas",
language: "en",
enableToolbar: false,
}
const viewer = new BimViewer(viewerCfg);

Expand Down
Loading

0 comments on commit d894350

Please sign in to comment.