vis-core 0.18.4 → 0.18.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.
@@ -43587,7 +43587,7 @@ function sa(i) {
43587
43587
  const t = new Dt();
43588
43588
  return t.color.setScalar(i), t;
43589
43589
  }
43590
- const yf = "0.18.4";
43590
+ const yf = "0.18.6";
43591
43591
  class Rz {
43592
43592
  constructor() {
43593
43593
  A(this, "event", new TX());
@@ -44310,19 +44310,35 @@ class wz {
44310
44310
  s.type.endsWith("Command") && (s.type = s.type.replace("Command", ""));
44311
44311
  const l = new Jz[s.type](this.editor);
44312
44312
  l.json = s, l.id = s.id, l.name = s.name, this.undos.push(l), this.idCounter = s.id > this.idCounter ? s.id : this.idCounter;
44313
+ const a = n + 1, o = t.u.length;
44314
+ this.editor.emit("progress", {
44315
+ type: "解压文件",
44316
+ value: a / o * 100 | 0
44317
+ });
44313
44318
  }
44314
44319
  this.editor.emit("historyChanged", this.undos[this.undos.length - 1]);
44315
44320
  }
44316
44321
  }
44317
44322
  executeUndos() {
44318
44323
  return bt(this, null, function* () {
44319
- for (const t of this.undos) {
44320
- t.fromJSON(t.json);
44324
+ let t = 0;
44325
+ for (const e of this.undos) {
44326
+ e.fromJSON(e.json);
44321
44327
  try {
44322
- (!t.json.objectUuid || t.object) && (yield t.execute());
44323
- } catch (e) {
44324
- console.error(e, t);
44328
+ (!e.json.objectUuid || e.object) && (yield e.execute(), yield new Promise((s) => {
44329
+ requestAnimationFrame(() => {
44330
+ s();
44331
+ });
44332
+ }));
44333
+ } catch (s) {
44334
+ console.error(s, e);
44325
44335
  }
44336
+ t += 1;
44337
+ const n = this.undos.length;
44338
+ this.editor.emit("progress", {
44339
+ type: "还原场景",
44340
+ value: t / n * 100 | 0
44341
+ });
44326
44342
  }
44327
44343
  });
44328
44344
  }
@@ -44367,22 +44383,27 @@ class Kz {
44367
44383
  }
44368
44384
  setVis(n) {
44369
44385
  return bt(this, arguments, function* (t, e = {}) {
44370
- var l, a;
44386
+ var a, o;
44371
44387
  if (!this.options.visFactories && (this.editor.setViewportVis(t), !this.options.visFactories)) {
44372
44388
  console.error("visFactories is not defined");
44373
44389
  return;
44374
44390
  }
44375
44391
  if (this.vis = this.options.visFactories, this.vis.visName !== t)
44376
44392
  throw new Error(`visName is not match, import {${t}}`);
44377
- this.vis.setOptions(Jt(Jt({}, e), this.extendsOptions)), this.delLoadObj && (this.vis.delLoadArr = this.delLoadObj), this.vis.playing = this.editor.playing, this.vis.on("progress", (o, c, d) => {
44378
- d === 1 && this.editor.emit("loaderProgress", o / c * 100 | 0);
44393
+ this.vis.setOptions(Jt(Jt({}, e), this.extendsOptions)), this.delLoadObj && (this.vis.delLoadArr = this.delLoadObj), this.vis.playing = this.editor.playing;
44394
+ let s = 1;
44395
+ this.vis.on("loaderProgress", (c, d) => {
44396
+ s === 1 && (this.editor.emit("progress", {
44397
+ type: "下载资源",
44398
+ value: c / d * 100 | 0
44399
+ }), c === d && (s = 0));
44379
44400
  }), this.vis.on("show", () => {
44380
44401
  this.editor.emit("visShow");
44381
44402
  }), yield this.vis.init();
44382
- const { pencil: s } = this.vis;
44383
- s.userData.EditorEnv = !this.editor.playing, this.editor.pencil = s, this.editor.changeSelectOption(), this.editor.playing || (this.initEvent(), this.editor.emit("visChanged", this.vis)), (l = this.vis) == null || l.pencil.event.on("materialListChange", () => {
44403
+ const { pencil: l } = this.vis;
44404
+ l.userData.EditorEnv = !this.editor.playing, this.editor.pencil = l, this.editor.changeSelectOption(), this.editor.playing || (this.initEvent(), this.editor.emit("visChanged", this.vis)), (a = this.vis) == null || a.pencil.event.on("materialListChange", () => {
44384
44405
  this.editor.changeSelectOption();
44385
- }), (a = this.vis) == null || a.pencil.event.on("object3dListChange", () => {
44406
+ }), (o = this.vis) == null || o.pencil.event.on("object3dListChange", () => {
44386
44407
  this.editor.changeSelectOption();
44387
44408
  });
44388
44409
  });
@@ -44551,17 +44572,18 @@ const aa = (i, t) => {
44551
44572
  n === 35e4 && (i.h.u[0].visOptions.drillDownHideParent = !0);
44552
44573
  }
44553
44574
  return aa(i.c.version, "0.18.1") === -1 && i.h.u[0] && i.h.u[0].visType === "earth3" && (i.h.u[0].visType = "earth", i.h.u[0].visOptions.style = "countryPlate"), i;
44554
- }, g2 = (i) => {
44555
- const t = R2(!0);
44556
- return fetch(i).then((e) => {
44557
- if (e.ok)
44558
- return e.json();
44575
+ }, g2 = (i, t) => {
44576
+ const e = R2(!0);
44577
+ return fetch(i).then((n) => {
44578
+ let s = n;
44579
+ if (s.ok)
44580
+ return s.json();
44559
44581
  throw new Error("Network response was not ok.");
44560
- }).then((e) => {
44561
- t.resolve(e);
44562
- }).catch((e) => {
44563
- t.reject(e);
44564
- }), t.promise;
44582
+ }).then((n) => {
44583
+ e.resolve(n);
44584
+ }).catch((n) => {
44585
+ e.reject(n);
44586
+ }), e.promise;
44565
44587
  };
44566
44588
  class zz {
44567
44589
  constructor(t) {
@@ -44702,7 +44724,7 @@ class zz {
44702
44724
  "json:" + a.c.version,
44703
44725
  "sdk:" + this.sdkVersion
44704
44726
  ), this.setConfig(a.c), this.history.fromJSON(a.h, e), this.viewport.fromJSON(a.v), yield this.history.executeUndos(), (n = a.v.bg) != null && n.texture && this.viewport.vis) {
44705
- const o = W2(a.bg.texture);
44727
+ const o = W2(a.v.bg.texture);
44706
44728
  o.colorSpace = ye, this.viewport.vis.pencil.scene.background = o;
44707
44729
  }
44708
44730
  return (s = this.viewport.vis) == null || s.show(), (l = this.pencil.cameraControls) == null || l.saveState(), this.select(null), a;
@@ -44907,7 +44929,7 @@ class sd extends Rz {
44907
44929
  dbName: this.visName,
44908
44930
  cacheVersion: yf
44909
44931
  }), this.delLoadArr && (this.loader.delLoadArr = this.delLoadArr), this.loader.on("progress", (...e) => {
44910
- this.emit("progress", ...e);
44932
+ this.emit("loaderProgress", ...e);
44911
44933
  });
44912
44934
  }
44913
44935
  addCSS3DRenderer() {
@@ -1,2 +1,7 @@
1
- declare const _default: (url: string) => Promise<any>;
1
+ type DownloadProgress = {
2
+ percent: number;
3
+ transferredBytes: number;
4
+ totalBytes: number;
5
+ };
6
+ declare const _default: (url: string, onDownloadProgress?: (progress: DownloadProgress) => void) => Promise<any>;
2
7
  export default _default;
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "0.18.4";
1
+ declare const _default: "0.18.6";
2
2
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vis-core",
3
- "version": "0.18.4",
3
+ "version": "0.18.6",
4
4
  "scripts": {
5
5
  "start": "npm run version && PORT=5173 bundler-dev",
6
6
  "build:site": "npm run version &&PUBLIC_EXCLUDE=public/city bundler",