vis-core 0.28.22 → 0.28.24

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.
@@ -88,7 +88,7 @@ const publicKeyPEM = "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRz
88
88
  ).toString(CryptoJS.enc.Utf8), Fe = JSON.parse(Ne), Ae = Date.now();
89
89
  return !Fe.s || Fe.s > Ae ? (this.token = void 0, "") : Fe.e && Fe.e < Ae ? (this.token = void 0, "") : (Fe.isValid = O, Fe);
90
90
  }
91
- }, version = "0.28.22";
91
+ }, version = "0.28.24";
92
92
  /**
93
93
  * @license
94
94
  * Copyright 2010-2025 Three.js Authors
@@ -58125,6 +58125,9 @@ function get(g, t = defaultGetStore()) {
58125
58125
  function setMany(g, t = defaultGetStore()) {
58126
58126
  return t("readwrite", (r) => (g.forEach((m) => r.put(m[1], m[0])), promisifyRequest(r.transaction)));
58127
58127
  }
58128
+ function del(g, t = defaultGetStore()) {
58129
+ return t("readwrite", (r) => (r.delete(g), promisifyRequest(r.transaction)));
58130
+ }
58128
58131
  var H = Object.defineProperty, y = Object.getOwnPropertySymbols, a = Object.prototype.hasOwnProperty, x = Object.prototype.propertyIsEnumerable, s = (g, t, r) => t in g ? H(g, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : g[t] = r, W = (g, t) => {
58129
58132
  for (var r in t || (t = {}))
58130
58133
  a.call(t, r) && s(g, r, t[r]);
@@ -59754,22 +59757,36 @@ class AddMaterial extends Command {
59754
59757
  this.addObjectUuid = `material_${this.id}`;
59755
59758
  const r = this.editor.pencil.mList;
59756
59759
  let m;
59757
- if (this.materialType.startsWith("k:")) {
59758
- const v = this.materialType.match(/k:([^|]+)\|s:([^|]+)/);
59759
- if (v) {
59760
- const C = v[1], _ = v[2], w = this.editor.pencil.lead.getObject(C);
59761
- if (w) {
59762
- const I = w.object3d;
59763
- m = Array.isArray(I.material) ? I.material[+_] : I.material, this.flag = !0;
59760
+ if (typeof this.materialType == "string")
59761
+ if (this.materialType.startsWith("k:")) {
59762
+ const v = this.materialType.match(/k:([^|]+)\|s:([^|]+)/);
59763
+ if (v) {
59764
+ const C = v[1], _ = v[2], w = this.editor.pencil.lead.getObject(C);
59765
+ if (w) {
59766
+ const I = w.object3d;
59767
+ m = Array.isArray(I.material) ? I.material[+_] : I.material, this.flag = !0;
59768
+ } else
59769
+ console.warn(`Base object with key ${C} not found.`), m = new MeshBasicMaterial();
59764
59770
  } else
59765
- console.warn(`Base object with key ${C} not found.`), m = new MeshBasicMaterial();
59766
- } else
59767
- console.warn(`Material type ${this.materialType} is not valid.`), m = new MeshBasicMaterial();
59768
- } else this.materialType === "MeshLineMaterial" ? m = new We$1({
59769
- color: new Color$1(16777215),
59770
- lineWidth: 1,
59771
- sizeAttenuation: 0
59772
- }) : m = new THREE[this.materialType]();
59771
+ console.warn(`Material type ${this.materialType} is not valid.`), m = new MeshBasicMaterial();
59772
+ } else if (this.materialType.startsWith("t:")) {
59773
+ const v = this.materialType.match(/t:([^|]+)\|s:([^|]+)/);
59774
+ if (v) {
59775
+ const C = v[1], _ = v[2], w = this.editor.pencil.lead.getObject(C);
59776
+ if (w) {
59777
+ const I = w.object3d;
59778
+ m = Array.isArray(I.material) ? I.material[+_] : I.material, this.flag = !0;
59779
+ } else
59780
+ console.warn(`Base object with key ${C} not found.`), m = new MeshBasicMaterial();
59781
+ } else
59782
+ console.warn(`Material type ${this.materialType} is not valid.`), m = new MeshBasicMaterial();
59783
+ } else this.materialType === "MeshLineMaterial" ? m = new We$1({
59784
+ color: new Color$1(16777215),
59785
+ lineWidth: 1,
59786
+ sizeAttenuation: 0
59787
+ }) : m = new THREE[this.materialType]();
59788
+ else
59789
+ m = parseMaterial(this.materialType);
59773
59790
  m.name = `材质_${this.id}`, r.add(this.addObjectUuid, m), this.flag && this.editor.emit("materialChanged");
59774
59791
  });
59775
59792
  }
@@ -60285,6 +60302,8 @@ class Viewport {
60285
60302
  C0(this, "cameraState", {});
60286
60303
  C0(this, "delLoadObj");
60287
60304
  C0(this, "options");
60305
+ C0(this, "copyObjKey");
60306
+ C0(this, "copyMListMaterialKey");
60288
60307
  this.options = r, this.editor = t;
60289
60308
  }
60290
60309
  setSaveCamera(t) {
@@ -60373,37 +60392,70 @@ class Viewport {
60373
60392
  removeObj(t) {
60374
60393
  return B0(this, null, function* () {
60375
60394
  const { vis: r } = this;
60376
- if (!r)
60395
+ if (!r || !t)
60377
60396
  return;
60378
- const m = this.editor.baseObjectByUuid(t);
60379
- this.editor.execute(new RemoveObject(this.editor, m));
60397
+ const m = this.editor.findSelectItem(
60398
+ this.editor.selectOption,
60399
+ "key",
60400
+ t
60401
+ );
60402
+ if (m && !m.disabledR) {
60403
+ const v = this.editor.baseObjectByUuid(t);
60404
+ this.editor.execute(new RemoveObject(this.editor, v));
60405
+ } else
60406
+ console.warn(m ? "Object is disabled for removal" : "Object not found for removal");
60380
60407
  });
60381
60408
  }
60382
60409
  copyObj(t) {
60410
+ if (this.vis && (this.copyObjKey = void 0, t)) {
60411
+ const r = this.editor.findSelectItem(
60412
+ this.editor.selectOption,
60413
+ "key",
60414
+ t
60415
+ );
60416
+ r && !r.disabledC && (this.copyObjKey = t);
60417
+ }
60418
+ }
60419
+ pasteObj() {
60383
60420
  return B0(this, null, function* () {
60384
- const { vis: r } = this;
60385
- if (!r)
60421
+ const { vis: t } = this;
60422
+ if (!t || !this.copyObjKey)
60386
60423
  return;
60387
- const m = this.editor.baseObjectByUuid(t);
60388
- this.editor.execute(new CopyObject(this.editor, m));
60424
+ const r = this.editor.baseObjectByUuid(this.copyObjKey);
60425
+ this.editor.execute(new CopyObject(this.editor, r));
60389
60426
  });
60390
60427
  }
60391
- addMListMaterial(t = "MeshBasicMaterial") {
60428
+ copyMListMaterial(t) {
60392
60429
  return B0(this, null, function* () {
60393
60430
  const { vis: r } = this;
60394
- r && this.editor.execute(new AddMaterial(this.editor, t));
60431
+ r && (this.copyMListMaterialKey = t, t && del("crossCopyMaterial"));
60395
60432
  });
60396
60433
  }
60397
- removeMListMaterial(t) {
60434
+ pasteMListMaterial() {
60435
+ return B0(this, null, function* () {
60436
+ const { vis: t } = this;
60437
+ if (t) {
60438
+ if (!this.copyMListMaterialKey) {
60439
+ const r = yield get("crossCopyMaterial");
60440
+ r && this.editor.execute(new AddMaterial(this.editor, r));
60441
+ return;
60442
+ }
60443
+ this.editor.execute(
60444
+ new CopyMaterial(this.editor, this.copyMListMaterialKey)
60445
+ );
60446
+ }
60447
+ });
60448
+ }
60449
+ addMListMaterial(t = "MeshBasicMaterial") {
60398
60450
  return B0(this, null, function* () {
60399
60451
  const { vis: r } = this;
60400
- r && this.editor.execute(new RemoveMaterial(this.editor, t));
60452
+ r && this.editor.execute(new AddMaterial(this.editor, t));
60401
60453
  });
60402
60454
  }
60403
- copyMListMaterial(t) {
60455
+ removeMListMaterial(t) {
60404
60456
  return B0(this, null, function* () {
60405
60457
  const { vis: r } = this;
60406
- r && this.editor.execute(new CopyMaterial(this.editor, t));
60458
+ r && this.editor.execute(new RemoveMaterial(this.editor, t));
60407
60459
  });
60408
60460
  }
60409
60461
  setExtendsOptions(t, r) {
@@ -60430,7 +60482,7 @@ class Viewport {
60430
60482
  setTransformControlsModal(t) {
60431
60483
  var m;
60432
60484
  const { pencil: r } = this.vis;
60433
- (m = r.transformController) == null || m.controls.setMode(t);
60485
+ (m = r.transformController) == null || m.controls.setMode(t), this.editor.emit("transformControlsModalChanged", t);
60434
60486
  }
60435
60487
  dispose() {
60436
60488
  var t;
@@ -143239,7 +143291,9 @@ const objs = Ji(q0({}, objs$3), {
143239
143291
  C0(Rn, "VisName", "earth");
143240
143292
  let index = Rn;
143241
143293
  const png2webp = (g, t = 2048) => new Promise((r, m) => {
143242
- const v = document.createElement("img"), C = () => {
143294
+ const v = document.createElement("img");
143295
+ v.crossOrigin = "anonymous";
143296
+ const C = () => {
143243
143297
  v.removeEventListener("load", C, !1), v.removeEventListener("error", _, !1);
143244
143298
  const w = document.createElement("canvas");
143245
143299
  if (w.width = v.naturalWidth, w.height = v.naturalHeight, w.width > t || w.height > t) {
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "0.28.22";
1
+ declare const _default: "0.28.24";
2
2
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vis-core",
3
- "version": "0.28.22",
3
+ "version": "0.28.24",
4
4
  "scripts": {
5
5
  "start": "npm run version && PORT=5173 bundler-dev",
6
6
  "build:site": "npm run version && PUBLIC_EXCLUDE=true bundler",