Skip to content

Commit

Permalink
feat: improve coordination logic
Browse files Browse the repository at this point in the history
  • Loading branch information
agviegas committed Mar 6, 2024
1 parent 699ce7d commit ec14e54
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openbim-components",
"version": "1.4.13",
"version": "1.4.14",
"main": "src/index.js",
"author": "harry collin, antonio gonzalez viegas",
"license": "MIT",
Expand Down
7 changes: 4 additions & 3 deletions resources/openbim-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -101482,7 +101482,6 @@ class FragmentIfcLoader extends Component {
this.onDisposed = new Event();
this.settings = new IfcFragmentSettings();
this.enabled = true;
this.autoCoordinate = true;
this.uiElement = new UIElement();
this._material = new THREE$1.MeshLambertMaterial();
this._spatialTree = new SpatialStructure();
Expand Down Expand Up @@ -101519,7 +101518,7 @@ class FragmentIfcLoader extends Component {
}
await this.onSetup.trigger();
}
async load(data) {
async load(data, coordinate = true) {
const before = performance.now();
await this.onIfcStartedLoading.trigger();
await this.readIfcFile(data);
Expand All @@ -101536,8 +101535,10 @@ class FragmentIfcLoader extends Component {
frag.group = group;
this.components.meshes.add(frag.mesh);
}
if (coordinate) {
fragments.coordinate([group]);
}
await this.onIfcLoaded.trigger(group);
fragments.coordinate();
return group;
}
setupUI() {
Expand Down
1 change: 0 additions & 1 deletion src/fragments/FragmentIfcLoader/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@
fragmentIfcLoader.onIfcLoaded.add((model) => {

console.log(model);
fragments.coordinate([model]);

// let sorted = [];
// for(const frag of model.fragments) {
Expand Down
10 changes: 5 additions & 5 deletions src/fragments/FragmentIfcLoader/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ export class FragmentIfcLoader

enabled: boolean = true;

autoCoordinate = true;

uiElement = new UIElement<{ main: Button; toast: ToastNotification }>();

private _material = new THREE.MeshLambertMaterial();
Expand Down Expand Up @@ -81,7 +79,7 @@ export class FragmentIfcLoader
await this.onSetup.trigger();
}

async load(data: Uint8Array) {
async load(data: Uint8Array, coordinate = true) {
const before = performance.now();
await this.onIfcStartedLoading.trigger();
await this.readIfcFile(data);
Expand All @@ -103,9 +101,11 @@ export class FragmentIfcLoader
this.components.meshes.add(frag.mesh);
}

await this.onIfcLoaded.trigger(group);
if (coordinate) {
fragments.coordinate([group]);
}

fragments.coordinate()
await this.onIfcLoaded.trigger(group);

return group;
}
Expand Down

0 comments on commit ec14e54

Please sign in to comment.