vis-core 0.18.4 → 0.18.5

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.5";
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
  });
@@ -44907,7 +44928,7 @@ class sd extends Rz {
44907
44928
  dbName: this.visName,
44908
44929
  cacheVersion: yf
44909
44930
  }), this.delLoadArr && (this.loader.delLoadArr = this.delLoadArr), this.loader.on("progress", (...e) => {
44910
- this.emit("progress", ...e);
44931
+ this.emit("loaderProgress", ...e);
44911
44932
  });
44912
44933
  }
44913
44934
  addCSS3DRenderer() {
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "0.18.4";
1
+ declare const _default: "0.18.5";
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.5",
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",