bimatter-viewer-react 0.5.5 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/lib/index.js +106 -103
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -169,7 +169,7 @@ const models = await loader.loadModel(["/models/model.ifc"], {
169
169
  });
170
170
  ```
171
171
 
172
- IFC worker loading uses the same parser wasm file. Keep it in `public/ifc-parser.wasm`, or pass a custom `wasmPath`:
172
+ IFC worker loading uses the same parser wasm file. By default, `ifc-parser.wasm` is resolved relative to the app document base URL, so it works with Vite `base` paths like `/my-app/` when the file is in that app's `public` folder. Pass a custom `wasmPath` only when the file is hosted elsewhere:
173
173
 
174
174
  ```ts
175
175
  await loader.loadModel(["/models/model.ifc"], {
package/lib/index.js CHANGED
@@ -3923,17 +3923,20 @@ function ca(e) {
3923
3923
  function la(e) {
3924
3924
  return e.split(/[?#]/)[0].split(/[\\/]/).pop() || "model.ifc";
3925
3925
  }
3926
- function ua(e) {
3927
- let t = e ?? "/ifc-parser.wasm";
3928
- return /^(https?:|blob:|data:)/i.test(t) ? t : new URL(t, globalThis.location.href).href;
3926
+ function ua() {
3927
+ return globalThis.document?.baseURI ?? globalThis.location.href;
3929
3928
  }
3930
3929
  function da(e) {
3930
+ let t = e ?? "ifc-parser.wasm";
3931
+ return /^(https?:|blob:|data:)/i.test(t) ? t : new URL(t, ua()).href;
3932
+ }
3933
+ function fa(e) {
3931
3934
  return e.map((e) => e.kind === "buffer" ? e.buffer : null).filter((e) => e instanceof ArrayBuffer);
3932
3935
  }
3933
- function fa() {
3936
+ function pa() {
3934
3937
  return new aa();
3935
3938
  }
3936
- function pa(e) {
3939
+ function ma(e) {
3937
3940
  return {
3938
3941
  chunk: e.chunk,
3939
3942
  coordinationMatrix: e.coordinationMatrix,
@@ -3942,12 +3945,12 @@ function pa(e) {
3942
3945
  useIfcColors: e.useIfcColors,
3943
3946
  useIfcElementAssembly: e.useIfcElementAssembly,
3944
3947
  useIfcSpace: e.useIfcSpace,
3945
- wasmPath: ua(e.wasmPath)
3948
+ wasmPath: da(e.wasmPath)
3946
3949
  };
3947
3950
  }
3948
- function ma(e, t = {}) {
3949
- let n = t.worker ?? fa(), r = t.terminateOnComplete ?? !t.worker, i = t.collectChunks ?? !0, a = sa(e).map(ca), o = oa(), s = {}, c = {
3950
- options: pa(t),
3951
+ function ha(e, t = {}) {
3952
+ let n = t.worker ?? pa(), r = t.terminateOnComplete ?? !t.worker, i = t.collectChunks ?? !0, a = sa(e).map(ca), o = oa(), s = {}, c = {
3953
+ options: ma(t),
3951
3954
  sources: a,
3952
3955
  taskId: o,
3953
3956
  type: "load-ifc-model"
@@ -3985,34 +3988,34 @@ function ma(e, t = {}) {
3985
3988
  let a = Error(r.error.message);
3986
3989
  r.error.stack && (a.stack = r.error.stack), l(a);
3987
3990
  };
3988
- n.addEventListener("message", f), n.addEventListener("error", d), n.postMessage(c, da(a));
3991
+ n.addEventListener("message", f), n.addEventListener("error", d), n.postMessage(c, fa(a));
3989
3992
  });
3990
3993
  }
3991
- function ha() {
3992
- return fa();
3994
+ function ga() {
3995
+ return pa();
3993
3996
  }
3994
3997
  //#endregion
3995
3998
  //#region src/viewer/api/loader.ts
3996
- function ga(e) {
3997
- return typeof e == "string" ? e : e.name;
3998
- }
3999
3999
  function _a(e) {
4000
- return (ga(e).split(/[?#]/)[0].split(/[\\/]/).pop() || "model").replace(/\.min\.bmt$/i, "").replace(/\.[^.]+$/i, "") || "model";
4000
+ return typeof e == "string" ? e : e.name;
4001
4001
  }
4002
4002
  function va(e) {
4003
- let t = ga(e).split(/[?#]/)[0].toLowerCase(), n = t.lastIndexOf(".");
4004
- return n === -1 ? "" : t.slice(n + 1);
4003
+ return (_a(e).split(/[?#]/)[0].split(/[\\/]/).pop() || "model").replace(/\.min\.bmt$/i, "").replace(/\.[^.]+$/i, "") || "model";
4005
4004
  }
4006
4005
  function ya(e) {
4007
- return /\.min\.bmt$/i.test(e.name) ? e.name.replace(/\.min\.bmt$/i, "_props.json") : null;
4006
+ let t = _a(e).split(/[?#]/)[0].toLowerCase(), n = t.lastIndexOf(".");
4007
+ return n === -1 ? "" : t.slice(n + 1);
4008
4008
  }
4009
4009
  function ba(e) {
4010
- return /_props\.json$/i.test(ga(e).split(/[?#]/)[0]);
4010
+ return /\.min\.bmt$/i.test(e.name) ? e.name.replace(/\.min\.bmt$/i, "_props.json") : null;
4011
4011
  }
4012
4012
  function xa(e) {
4013
+ return /_props\.json$/i.test(_a(e).split(/[?#]/)[0]);
4014
+ }
4015
+ function Sa(e) {
4013
4016
  return e.coordinationMatrix ? e.coordinationMatrix : Object.values(e.data)[0]?.matrix || void 0;
4014
4017
  }
4015
- var Sa = new class {
4018
+ var Ca = new class {
4016
4019
  coordinationMatrix;
4017
4020
  useIfcSpace = !1;
4018
4021
  bmtLoader = null;
@@ -4051,7 +4054,7 @@ var Sa = new class {
4051
4054
  async loadBmtModel(e, t) {
4052
4055
  let n = this.getBmtLoader();
4053
4056
  if (typeof e == "string") return n.loadModel(e);
4054
- let r = n.parseBinaryFile(await e.arrayBuffer()), i = ya(e), a = i ? t.get(i) : void 0;
4057
+ let r = n.parseBinaryFile(await e.arrayBuffer()), i = ba(e), a = i ? t.get(i) : void 0;
4055
4058
  return this.applyBmtMetadata(r, a);
4056
4059
  }
4057
4060
  createWorkerProgressHandler(e, t, n, r) {
@@ -4074,7 +4077,7 @@ var Sa = new class {
4074
4077
  };
4075
4078
  }
4076
4079
  async loadIfcModelInWorker(e, t, n, r, i) {
4077
- return (await ma(e, {
4080
+ return (await ha(e, {
4078
4081
  chunk: t.chunk,
4079
4082
  collectChunks: t.collectWorkerChunks,
4080
4083
  coordinationMatrix: this.coordinationMatrix,
@@ -4094,7 +4097,7 @@ var Sa = new class {
4094
4097
  streamGeometryChunks: n.streamGeometryChunks ?? !!n.onChunk
4095
4098
  }))[0];
4096
4099
  if (e instanceof File) {
4097
- let n = ya(e), r = n ? t.get(n) : void 0;
4100
+ let n = ba(e), r = n ? t.get(n) : void 0;
4098
4101
  return this.applyBmtMetadata(o, r);
4099
4102
  }
4100
4103
  return o;
@@ -4107,21 +4110,21 @@ var Sa = new class {
4107
4110
  }
4108
4111
  async loadModel(e, t = {}) {
4109
4112
  this.initLoaders();
4110
- let n = Array.isArray(e) ? e : [e], r = this.getFileSourceMap(n), i = {}, a = n.filter((e) => !ba(e)).length, o = 0;
4113
+ let n = Array.isArray(e) ? e : [e], r = this.getFileSourceMap(n), i = {}, a = n.filter((e) => !xa(e)).length, o = 0;
4111
4114
  this.loadedModelCount === 0 && this.resetCoordinationMatrixState();
4112
4115
  for (let e = 0; e < n.length; e++) {
4113
- let s = n[e], c = va(s), l;
4114
- if (c === "json" && ba(s)) continue;
4116
+ let s = n[e], c = ya(s), l;
4117
+ if (c === "json" && xa(s)) continue;
4115
4118
  let u = this.nextModelID, d = o;
4116
4119
  if (o++, c === "ifc") l = t.useWorker ? await this.loadIfcModelInWorker(s, t, u, d, a) : (await (await this.getIfcLoader(t)).loadModel(s, this.coordinationMatrix))[0];
4117
4120
  else if (c === "bmt") l = t.useWorker ? await this.loadBmtModelInWorker(s, r, t, u, d, a) : await this.loadBmtModel(s, r);
4118
- else throw Error(`Unsupported model format: ${ga(s)}`);
4119
- let f = xa(l);
4120
- !this.coordinationMatrix && f && (this.coordinationMatrix = f), !l.coordinationMatrix && this.coordinationMatrix && (l.coordinationMatrix = this.coordinationMatrix), l.name ??= _a(s), this.nextModelID += 1, this.loadedModelCount += 1, i[u] = l;
4121
+ else throw Error(`Unsupported model format: ${_a(s)}`);
4122
+ let f = Sa(l);
4123
+ !this.coordinationMatrix && f && (this.coordinationMatrix = f), !l.coordinationMatrix && this.coordinationMatrix && (l.coordinationMatrix = this.coordinationMatrix), l.name ??= va(s), this.nextModelID += 1, this.loadedModelCount += 1, i[u] = l;
4121
4124
  }
4122
4125
  return i;
4123
4126
  }
4124
- }(), Ca = .5, X = .04, Z = .16, wa = Z, Q = Ca * 2 - Z * 2, Ta = Ca - X / 2, Ea = Ca - Z / 2, Da = Ca - wa / 2, Oa = .63, ka = "#dfe6ec", Aa = 260, ja = 52, Ma = .17, Na = new g(), $ = new ue(), Pa = [
4127
+ }(), wa = .5, X = .04, Z = .16, Ta = Z, Q = wa * 2 - Z * 2, Ea = wa - X / 2, Da = wa - Z / 2, Oa = wa - Ta / 2, ka = .63, Aa = "#dfe6ec", ja = 260, Ma = 52, Na = .17, Pa = new g(), $ = new ue(), Fa = [
4125
4128
  {
4126
4129
  direction: [
4127
4130
  0,
@@ -4132,7 +4135,7 @@ var Sa = new class {
4132
4135
  position: [
4133
4136
  0,
4134
4137
  0,
4135
- Ta
4138
+ Ea
4136
4139
  ],
4137
4140
  scale: [
4138
4141
  Q,
@@ -4152,7 +4155,7 @@ var Sa = new class {
4152
4155
  position: [
4153
4156
  0,
4154
4157
  0,
4155
- -Ta
4158
+ -Ea
4156
4159
  ],
4157
4160
  rotation: [
4158
4161
  0,
@@ -4175,7 +4178,7 @@ var Sa = new class {
4175
4178
  ],
4176
4179
  label: "right",
4177
4180
  position: [
4178
- Ta,
4181
+ Ea,
4179
4182
  0,
4180
4183
  0
4181
4184
  ],
@@ -4200,7 +4203,7 @@ var Sa = new class {
4200
4203
  ],
4201
4204
  label: "left",
4202
4205
  position: [
4203
- -Ta,
4206
+ -Ea,
4204
4207
  0,
4205
4208
  0
4206
4209
  ],
@@ -4226,7 +4229,7 @@ var Sa = new class {
4226
4229
  label: "top",
4227
4230
  position: [
4228
4231
  0,
4229
- Ta,
4232
+ Ea,
4230
4233
  0
4231
4234
  ],
4232
4235
  rotation: [
@@ -4251,7 +4254,7 @@ var Sa = new class {
4251
4254
  label: "bot",
4252
4255
  position: [
4253
4256
  0,
4254
- -Ta,
4257
+ -Ea,
4255
4258
  0
4256
4259
  ],
4257
4260
  rotation: [
@@ -4268,7 +4271,7 @@ var Sa = new class {
4268
4271
  type: "face"
4269
4272
  }
4270
4273
  ];
4271
- function Fa() {
4274
+ function Ia() {
4272
4275
  let e = [], t = [-1, 1];
4273
4276
  return t.forEach((n) => {
4274
4277
  t.forEach((t) => {
@@ -4280,8 +4283,8 @@ function Fa() {
4280
4283
  ],
4281
4284
  position: [
4282
4285
  0,
4283
- n * Ea,
4284
- t * Ea
4286
+ n * Da,
4287
+ t * Da
4285
4288
  ],
4286
4289
  scale: [
4287
4290
  Q,
@@ -4301,9 +4304,9 @@ function Fa() {
4301
4304
  t
4302
4305
  ],
4303
4306
  position: [
4304
- n * Ea,
4307
+ n * Da,
4305
4308
  0,
4306
- t * Ea
4309
+ t * Da
4307
4310
  ],
4308
4311
  scale: [
4309
4312
  Z,
@@ -4323,8 +4326,8 @@ function Fa() {
4323
4326
  0
4324
4327
  ],
4325
4328
  position: [
4326
- n * Ea,
4327
- t * Ea,
4329
+ n * Da,
4330
+ t * Da,
4328
4331
  0
4329
4332
  ],
4330
4333
  scale: [
@@ -4338,7 +4341,7 @@ function Fa() {
4338
4341
  });
4339
4342
  }), e;
4340
4343
  }
4341
- function Ia() {
4344
+ function La() {
4342
4345
  let e = [], t = [-1, 1];
4343
4346
  return t.forEach((n) => {
4344
4347
  t.forEach((r) => {
@@ -4350,14 +4353,14 @@ function Ia() {
4350
4353
  t
4351
4354
  ],
4352
4355
  position: [
4353
- n * Da,
4354
- r * Da,
4355
- t * Da
4356
+ n * Oa,
4357
+ r * Oa,
4358
+ t * Oa
4356
4359
  ],
4357
4360
  scale: [
4358
- wa,
4359
- wa,
4360
- wa
4361
+ Ta,
4362
+ Ta,
4363
+ Ta
4361
4364
  ],
4362
4365
  title: `${r > 0 ? "Top" : "Bottom"} ${n > 0 ? "Right" : "Left"} ${t > 0 ? "Front" : "Back"}`,
4363
4366
  type: "corner"
@@ -4366,21 +4369,21 @@ function Ia() {
4366
4369
  });
4367
4370
  }), e;
4368
4371
  }
4369
- function La(e) {
4370
- e.stopPropagation(), e.nativeEvent.stopPropagation(), e.nativeEvent.stopImmediatePropagation?.();
4371
- }
4372
4372
  function Ra(e) {
4373
- return e ? "#4f7fa3" : ka;
4373
+ e.stopPropagation(), e.nativeEvent.stopPropagation(), e.nativeEvent.stopImmediatePropagation?.();
4374
4374
  }
4375
4375
  function za(e) {
4376
+ return e ? "#4f7fa3" : Aa;
4377
+ }
4378
+ function Ba(e) {
4376
4379
  return e ? 1 : .96;
4377
4380
  }
4378
- function Ba(e, t) {
4381
+ function Va(e, t) {
4379
4382
  let n = document.createElement("canvas"), r = n.getContext("2d");
4380
4383
  if (!r) throw Error("Could not create navigation cube label context");
4381
- let i = `600 ${ja}px system-ui, "Segoe UI", sans-serif`;
4384
+ let i = `600 ${Ma}px system-ui, "Segoe UI", sans-serif`;
4382
4385
  r.font = i;
4383
- let a = r.measureText(e), o = a.actualBoundingBoxAscent || ja * .8, s = a.actualBoundingBoxDescent || ja * .2, c = Math.ceil(a.width + 36), l = Math.ceil(o + s + 20);
4386
+ let a = r.measureText(e), o = a.actualBoundingBoxAscent || Ma * .8, s = a.actualBoundingBoxDescent || Ma * .2, c = Math.ceil(a.width + 36), l = Math.ceil(o + s + 20);
4384
4387
  n.width = c, n.height = l, r.clearRect(0, 0, c, l), r.font = i, r.fillStyle = t, r.textAlign = "center", r.textBaseline = "alphabetic", r.fillText(e, c / 2, 10 + o);
4385
4388
  let u = new b(n);
4386
4389
  return u.colorSpace = le, u.generateMipmaps = !1, u.magFilter = M, u.minFilter = M, u.needsUpdate = !0, {
@@ -4388,12 +4391,12 @@ function Ba(e, t) {
4388
4391
  texture: u
4389
4392
  };
4390
4393
  }
4391
- function Va({ color: e, label: t, position: n, rotation: r }) {
4392
- let { aspect: i, texture: a } = c(() => Ba(t, e), [e, t]);
4394
+ function Ha({ color: e, label: t, position: n, rotation: r }) {
4395
+ let { aspect: i, texture: a } = c(() => Va(t, e), [e, t]);
4393
4396
  return o(() => () => a.dispose(), [a]), /* @__PURE__ */ z("mesh", {
4394
4397
  position: n,
4395
4398
  rotation: r,
4396
- children: [/* @__PURE__ */ R("planeGeometry", { args: [Ma * i, Ma] }), /* @__PURE__ */ R("meshBasicMaterial", {
4399
+ children: [/* @__PURE__ */ R("planeGeometry", { args: [Na * i, Na] }), /* @__PURE__ */ R("meshBasicMaterial", {
4397
4400
  alphaTest: .1,
4398
4401
  depthWrite: !1,
4399
4402
  map: a,
@@ -4402,41 +4405,41 @@ function Va({ color: e, label: t, position: n, rotation: r }) {
4402
4405
  })]
4403
4406
  });
4404
4407
  }
4405
- function Ha(e) {
4408
+ function Ua(e) {
4406
4409
  return Math.abs(e.y) > .9 ? new L(0, 0, e.y > 0 ? -1 : 1) : new L(0, 1, 0);
4407
4410
  }
4408
- function Ua(e, t) {
4411
+ function Wa(e, t) {
4409
4412
  let n = e.current;
4410
- return !n || (n.updateWorldMatrix(!0, !0), Na.setFromObject(n), Na.isEmpty()) ? ($.center.copy(t), $.radius = 10, $) : (Na.getBoundingSphere($), (!Number.isFinite($.radius) || $.radius <= 0) && ($.radius = 10), $);
4413
+ return !n || (n.updateWorldMatrix(!0, !0), Pa.setFromObject(n), Pa.isEmpty()) ? ($.center.copy(t), $.radius = 10, $) : (Pa.getBoundingSphere($), (!Number.isFinite($.radius) || $.radius <= 0) && ($.radius = 10), $);
4411
4414
  }
4412
- function Wa(e) {
4415
+ function Ga(e) {
4413
4416
  return e.current?.target.clone() ?? new L();
4414
4417
  }
4415
- function Ga({ camera: e, controlRef: t, direction: n, modelRef: r, transitionRef: i }) {
4416
- let a = Wa(t), o = Ua(r, a), s = o.center.clone(), c = new L(...n).normalize(), l = e.position.distanceTo(a), u = Number.isFinite(l) && l > o.radius * .5 ? l : o.radius * 2.4;
4418
+ function Ka({ camera: e, controlRef: t, direction: n, modelRef: r, transitionRef: i }) {
4419
+ let a = Ga(t), o = Wa(r, a), s = o.center.clone(), c = new L(...n).normalize(), l = e.position.distanceTo(a), u = Number.isFinite(l) && l > o.radius * .5 ? l : o.radius * 2.4;
4417
4420
  i.current = {
4418
4421
  endPosition: s.clone().addScaledVector(c, u),
4419
4422
  endTarget: s,
4420
- endUp: Ha(c),
4423
+ endUp: Ua(c),
4421
4424
  startPosition: e.position.clone(),
4422
4425
  startTarget: a,
4423
4426
  startTime: performance.now(),
4424
4427
  startUp: e.up.clone()
4425
4428
  };
4426
4429
  }
4427
- function Ka({ action: e, onPick: t }) {
4430
+ function qa({ action: e, onPick: t }) {
4428
4431
  let [n, r] = u(!1);
4429
4432
  return /* @__PURE__ */ z("group", {
4430
4433
  position: e.position,
4431
- onClick: La,
4434
+ onClick: Ra,
4432
4435
  onPointerDown: (n) => {
4433
- La(n), t(e);
4436
+ Ra(n), t(e);
4434
4437
  },
4435
4438
  onPointerEnter: (e) => {
4436
- La(e), r(!0);
4439
+ Ra(e), r(!0);
4437
4440
  },
4438
4441
  onPointerLeave: (e) => {
4439
- La(e), r(!1);
4442
+ Ra(e), r(!1);
4440
4443
  },
4441
4444
  children: [/* @__PURE__ */ z("mesh", {
4442
4445
  scale: e.scale,
@@ -4445,11 +4448,11 @@ function Ka({ action: e, onPick: t }) {
4445
4448
  1,
4446
4449
  1
4447
4450
  ] }), /* @__PURE__ */ R("meshBasicMaterial", {
4448
- color: Ra(n),
4449
- opacity: za(n),
4451
+ color: za(n),
4452
+ opacity: Ba(n),
4450
4453
  transparent: !0
4451
4454
  })]
4452
- }), e.label && /* @__PURE__ */ R(Va, {
4455
+ }), e.label && /* @__PURE__ */ R(Ha, {
4453
4456
  color: n ? "#ffffff" : "#50606f",
4454
4457
  label: e.label,
4455
4458
  position: [
@@ -4461,11 +4464,11 @@ function Ka({ action: e, onPick: t }) {
4461
4464
  })]
4462
4465
  });
4463
4466
  }
4464
- function qa({ active: e = !0, cameraRef: t, controlRef: n, modelRef: r }) {
4467
+ function Ja({ active: e = !0, cameraRef: t, controlRef: n, modelRef: r }) {
4465
4468
  let i = l(null), a = l(null), o = c(() => [
4466
- ...Pa,
4467
- ...Fa(),
4468
- ...Ia()
4469
+ ...Fa,
4470
+ ...Ia(),
4471
+ ...La()
4469
4472
  ], []);
4470
4473
  return f(() => {
4471
4474
  if (!e) return;
@@ -4474,16 +4477,16 @@ function qa({ active: e = !0, cameraRef: t, controlRef: n, modelRef: r }) {
4474
4477
  i.current && i.current.quaternion.copy(r.quaternion).invert();
4475
4478
  let o = a.current;
4476
4479
  if (!o) return;
4477
- let s = performance.now() - o.startTime, c = Math.min(s / Aa, 1), l = 1 - (1 - c) ** 3, u = n.current;
4480
+ let s = performance.now() - o.startTime, c = Math.min(s / ja, 1), l = 1 - (1 - c) ** 3, u = n.current;
4478
4481
  r.position.lerpVectors(o.startPosition, o.endPosition, l), r.up.lerpVectors(o.startUp, o.endUp, l), u ? (u.target.lerpVectors(o.startTarget, o.endTarget, l), u.update()) : r.lookAt(o.endTarget), c >= 1 && (r.up.copy(o.endUp), u?.target.copy(o.endTarget), u?.update(), a.current = null);
4479
4482
  }), e ? /* @__PURE__ */ R("group", {
4480
4483
  ref: i,
4481
- scale: Oa,
4482
- children: o.map((e) => /* @__PURE__ */ R(Ka, {
4484
+ scale: ka,
4485
+ children: o.map((e) => /* @__PURE__ */ R(qa, {
4483
4486
  action: e,
4484
4487
  onPick: (e) => {
4485
4488
  let i = t.current;
4486
- i && Ga({
4489
+ i && Ka({
4487
4490
  camera: i,
4488
4491
  controlRef: n,
4489
4492
  direction: e.direction,
@@ -4496,7 +4499,7 @@ function qa({ active: e = !0, cameraRef: t, controlRef: n, modelRef: r }) {
4496
4499
  }
4497
4500
  //#endregion
4498
4501
  //#region src/viewer/Viewer.tsx
4499
- var Ja = {
4502
+ var Ya = {
4500
4503
  bottom: 16,
4501
4504
  height: 96,
4502
4505
  pointerEvents: "auto",
@@ -4505,11 +4508,11 @@ var Ja = {
4505
4508
  touchAction: "none",
4506
4509
  width: 96,
4507
4510
  zIndex: 2
4508
- }, Ya = {
4511
+ }, Xa = {
4509
4512
  height: "100%",
4510
4513
  position: "relative",
4511
4514
  width: "100%"
4512
- }, Xa = {
4515
+ }, Za = {
4513
4516
  far: 50,
4514
4517
  near: .1,
4515
4518
  position: [
@@ -4518,15 +4521,15 @@ var Ja = {
4518
4521
  10
4519
4522
  ],
4520
4523
  zoom: 72
4521
- }, Za = {
4524
+ }, Qa = {
4522
4525
  alpha: !0,
4523
4526
  antialias: !0
4524
4527
  };
4525
- function Qa() {
4528
+ function $a() {
4526
4529
  let e = navigator, t = navigator.userAgent.toLowerCase(), n = navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, r = window.matchMedia?.("(pointer: coarse)").matches ?? !1;
4527
4530
  return e.userAgentData?.mobile || n || /android|iphone|ipad|ipod|mobile|tablet/.test(t) || navigator.maxTouchPoints > 1 && r ? "mobile" : "pc";
4528
4531
  }
4529
- function $a({ cameraRef: e, controlRef: t, lightRef: n, modelRef: r, modelsData: i, onReady: a, publicApi: s, setSceneApi: u }) {
4532
+ function eo({ cameraRef: e, controlRef: t, lightRef: n, modelRef: r, modelsData: i, onReady: a, publicApi: s, setSceneApi: u }) {
4530
4533
  let d = p((e) => e.camera), f = At(r), g = Vt(f), { colorPaletteTexture: _, colorUtils: v } = Ue(f), y = Ln(r), b = hn(r, t, y), x = An(r, t, y), S = c(() => new ki(), []), C = g.buildIndex, w = f.resetIndex, T = v.applyStoredColors, E = Mr(), D = l(!1), O = B((e) => e.showStats), k = c(() => {
4531
4534
  let e = Object.keys(i).sort((e, t) => Number(e) - Number(t));
4532
4535
  for (let t of e) {
@@ -4669,7 +4672,7 @@ function $a({ cameraRef: e, controlRef: t, lightRef: n, modelRef: r, modelsData:
4669
4672
  })
4670
4673
  ] });
4671
4674
  }
4672
- function eo({ camera: e = {
4675
+ function to({ camera: e = {
4673
4676
  position: [
4674
4677
  10,
4675
4678
  10,
@@ -4679,7 +4682,7 @@ function eo({ camera: e = {
4679
4682
  }, dpr: t = window.devicePixelRatio, modelUrls: n, modelSources: r, modelsData: i, onReady: a, publicApi: s, setSceneApi: c, showNavCube: f, showStats: p }) {
4680
4683
  let m = l(null), h = l(null), g = l(null), _ = l(null), [v, y] = u(), b = Te(), x = B((e) => e.setModelNames), S = B((e) => e.setModelProps), C = B((e) => e.setModelStructure), w = B((e) => e.setShowNavCube), T = B((e) => e.setShowStats), E = B((e) => e.setUserDevice), D = B((e) => e.showNavCube), O = i ?? v;
4681
4684
  return o(() => {
4682
- E(Qa());
4685
+ E($a());
4683
4686
  }, [E]), o(() => {
4684
4687
  T(!!p);
4685
4688
  }, [T, p]), o(() => {
@@ -4700,7 +4703,7 @@ function eo({ camera: e = {
4700
4703
  let e = r ?? n;
4701
4704
  if (!e?.length) return;
4702
4705
  let t = !0;
4703
- return Sa.loadModel(e).then((e) => {
4706
+ return Ca.loadModel(e).then((e) => {
4704
4707
  t && y(e);
4705
4708
  }), () => {
4706
4709
  t = !1;
@@ -4710,13 +4713,13 @@ function eo({ camera: e = {
4710
4713
  r,
4711
4714
  n
4712
4715
  ]), O ? /* @__PURE__ */ z("div", {
4713
- style: Ya,
4716
+ style: Xa,
4714
4717
  children: [/* @__PURE__ */ R(d, {
4715
4718
  camera: e,
4716
4719
  dpr: t,
4717
4720
  children: /* @__PURE__ */ R(Nr, {
4718
4721
  store: b,
4719
- children: /* @__PURE__ */ R($a, {
4722
+ children: /* @__PURE__ */ R(eo, {
4720
4723
  cameraRef: m,
4721
4724
  controlRef: h,
4722
4725
  lightRef: _,
@@ -4728,13 +4731,13 @@ function eo({ camera: e = {
4728
4731
  })
4729
4732
  })
4730
4733
  }), D && /* @__PURE__ */ R("div", {
4731
- style: Ja,
4734
+ style: Ya,
4732
4735
  children: /* @__PURE__ */ R(d, {
4733
- camera: Xa,
4736
+ camera: Za,
4734
4737
  dpr: t,
4735
- gl: Za,
4738
+ gl: Qa,
4736
4739
  orthographic: !0,
4737
- children: /* @__PURE__ */ R(qa, {
4740
+ children: /* @__PURE__ */ R(Ja, {
4738
4741
  active: !0,
4739
4742
  cameraRef: m,
4740
4743
  controlRef: h,
@@ -4744,7 +4747,7 @@ function eo({ camera: e = {
4744
4747
  })]
4745
4748
  }) : /* @__PURE__ */ R(Se, {});
4746
4749
  }
4747
- var to = n(function(e, t) {
4750
+ var no = n(function(e, t) {
4748
4751
  let [n] = u(ke), r = l(!1), a = l(!1), d = l(null), { defaultSelected: f, onSelectedChange: p, selected: m } = e, h = i((e) => {
4749
4752
  d.current = e;
4750
4753
  }, []), g = c(() => Ki(n, () => d.current), [n]);
@@ -4764,13 +4767,13 @@ var to = n(function(e, t) {
4764
4767
  });
4765
4768
  }, [p, n]), /* @__PURE__ */ R(Nr, {
4766
4769
  store: n,
4767
- children: /* @__PURE__ */ R(eo, {
4770
+ children: /* @__PURE__ */ R(to, {
4768
4771
  ...e,
4769
4772
  publicApi: g,
4770
4773
  setSceneApi: h
4771
4774
  })
4772
4775
  });
4773
4776
  });
4774
- to.displayName = "Viewer";
4777
+ no.displayName = "Viewer";
4775
4778
  //#endregion
4776
- export { Ji as BMTLoader, ki as BmtConverter, ji as ConvertIfcFileToBmt, Mi as ConvertToBmt, Sn as DimensionLine, kn as DimensionsUtils, Ui as FilteredElementsCollector, gt as ModelGrids, qa as NavigationCube, to as Viewer, Nr as ViewerStoreProvider, Ai as bmtConverter, ia as createBmtWorker, ha as createIfcWorker, ke as createViewerStore, xi as exportExcel, vi as exportModelPropertiesToExcel, ra as loadBmtModelsInWorker, ma as loadIfcModelsInWorker, Sa as loader, An as useDimensionsUtils, B as useViewerStore, Te as useViewerStoreApi };
4779
+ export { Ji as BMTLoader, ki as BmtConverter, ji as ConvertIfcFileToBmt, Mi as ConvertToBmt, Sn as DimensionLine, kn as DimensionsUtils, Ui as FilteredElementsCollector, gt as ModelGrids, Ja as NavigationCube, no as Viewer, Nr as ViewerStoreProvider, Ai as bmtConverter, ia as createBmtWorker, ga as createIfcWorker, ke as createViewerStore, xi as exportExcel, vi as exportModelPropertiesToExcel, ra as loadBmtModelsInWorker, ha as loadIfcModelsInWorker, Ca as loader, An as useDimensionsUtils, B as useViewerStore, Te as useViewerStoreApi };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bimatter-viewer-react",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "license": "PolyForm-Noncommercial-1.0.0",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",