vis-core 0.27.10 → 0.27.11

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), at = Date.now();
89
89
  return !Fe.s || Fe.s > at ? (this.token = void 0, "") : Fe.e && Fe.e < at ? (this.token = void 0, "") : (Fe.isValid = Le, Fe);
90
90
  }
91
- }, version = "0.27.10";
91
+ }, version = "0.27.11";
92
92
  /**
93
93
  * @license
94
94
  * Copyright 2010-2025 Three.js Authors
@@ -36442,7 +36442,7 @@ var At$1 = Object.defineProperty, jt = Object.defineProperties, St$1 = Object.ge
36442
36442
  });
36443
36443
  class O {
36444
36444
  constructor() {
36445
- this.resources = /* @__PURE__ */ new Set(), this.disposeWithMaterial = !0, this.materialList = {}, this.disposeTrack = !0;
36445
+ this.resources = /* @__PURE__ */ new Set(), this.disposeWithMaterial = !0, this.disposeVideo = !0, this.materialList = {}, this.disposeTrack = !0;
36446
36446
  }
36447
36447
  track(t) {
36448
36448
  if (!t || this.disposeTrack === !1)
@@ -36467,13 +36467,13 @@ class O {
36467
36467
  (v instanceof Texture || Array.isArray(v)) && this.track(v);
36468
36468
  }
36469
36469
  }
36470
- } else t instanceof VideoTexture && t.source.data && this.resources.add(t.source.data);
36470
+ } else this.disposeVideo && t instanceof VideoTexture && t.source.data && this.resources.add(t.source.data);
36471
36471
  return t;
36472
36472
  }
36473
36473
  dispose() {
36474
36474
  const t = [];
36475
36475
  for (const r of this.resources)
36476
- r instanceof Object3D ? t.push(r) : r instanceof HTMLVideoElement && (r.pause(), r.src = "", r.remove()), Reflect.has(r, "dispose") && r.dispose();
36476
+ r instanceof Object3D ? t.push(r) : r instanceof HTMLVideoElement && r.pause(), Reflect.has(r, "dispose") && r.dispose();
36477
36477
  t.forEach((r) => {
36478
36478
  r.removeFromParent();
36479
36479
  }), t.length = 0, this.resources.clear();
@@ -58136,11 +58136,7 @@ class SetMaterial extends Command {
58136
58136
  super(t), this.type = "SetMaterial", this.name = "New Material", this.object = r, this.materialSlot = v, this.oldMaterial = this.editor.getObjectMaterial(r, v), this.newMaterial = d, (C = this.oldMaterial) != null && C.name && (this.newMaterial.name = this.oldMaterial.name);
58137
58137
  }
58138
58138
  execute() {
58139
- var t;
58140
- this.oldMaterial = this.editor.getObjectMaterial(
58141
- this.object,
58142
- this.materialSlot
58143
- ), (t = this.oldMaterial) != null && t.onBeforeCompile && (this.newMaterial.onBeforeCompile = this.oldMaterial.onBeforeCompile), this.editor.setObjectMaterial(
58139
+ this.editor.setObjectMaterial(
58144
58140
  this.object,
58145
58141
  this.materialSlot,
58146
58142
  this.newMaterial
@@ -58155,11 +58151,18 @@ class SetMaterial extends Command {
58155
58151
  }
58156
58152
  toJSON() {
58157
58153
  const t = super.toJSON(this);
58158
- return t.objectUuid = this.editor.uuidByObject(this.object), t.materialSlot = this.materialSlot, t.oldMaterial = this.oldMaterial.toJSON(), t.newMaterial = this.newMaterial.toJSON(), t;
58154
+ return t.objectUuid = this.editor.uuidByObject(this.object), t.materialSlot = this.materialSlot, t.newMaterial = this.newMaterial.toJSON(), t;
58159
58155
  }
58160
58156
  fromJSON(t) {
58161
58157
  var r;
58162
- super.fromJSON(t), this.object = this.editor.objectByUuid(t.objectUuid), this.materialSlot = t.materialSlot, this.oldMaterial = parseMaterial(t.oldMaterial), this.newMaterial = parseMaterial(t.newMaterial), ((r = this.newMaterial.envMap) == null ? void 0 : r.name) === "PMREM.cubeUv" && (this.newMaterial.envMap = this.editor.viewport.vis.getRoomEnvMap());
58158
+ super.fromJSON(t), this.object = this.editor.objectByUuid(t.objectUuid), this.materialSlot = t.materialSlot, this.materialSlot = t.materialSlot, this.oldMaterial = this.editor.getObjectMaterial(
58159
+ this.object,
58160
+ this.materialSlot
58161
+ ), this.newMaterial = parseMaterial(t.newMaterial), ((r = this.newMaterial.envMap) == null ? void 0 : r.name) === "PMREM.cubeUv" && (this.newMaterial.envMap = this.editor.viewport.vis.getRoomEnvMap());
58162
+ }
58163
+ fixJSON() {
58164
+ const t = this.json;
58165
+ t && t.oldMaterial && delete t.oldMaterial;
58163
58166
  }
58164
58167
  }
58165
58168
  function parseMaterial(g) {
@@ -58192,32 +58195,33 @@ class SetMaterialMap extends Command {
58192
58195
  }
58193
58196
  execute() {
58194
58197
  if (this.oldMap) {
58195
- if (this.editor.playing) {
58196
- const t = new O();
58197
- t.track(this.oldMap), t.dispose();
58198
- } else if (this.oldMap.dispose(), this.oldMap instanceof VideoTexture) {
58199
- const t = this.oldMap.source.data;
58200
- t && t.pause();
58201
- }
58198
+ const t = new O();
58199
+ t.track(this.oldMap), t.dispose();
58202
58200
  }
58203
- this.newMap && (this.newMap.anisotropy = this.editor.viewport.vis.tier0 ? 1 : this.editor.pencil.maxAnisotropy), this.material[this.mapName] = this.newMap, this.material instanceof Ie$2 && (this.material.useMap = !!this.newMap, this.newMap && this.newMap.wrapS !== RepeatWrapping && (this.newMap.wrapS = RepeatWrapping, this.newMap.wrapT = RepeatWrapping, this.newMap.needsUpdate = !0)), (!this.oldMap && this.newMap || this.oldMap && !this.newMap) && (this.material.needsUpdate = !0), this.editor.emit("materialChanged", this.material);
58201
+ this.newMap && (this.newMap.anisotropy = this.editor.viewport.vis.tier0 ? 1 : this.editor.pencil.maxAnisotropy), this.material[this.mapName] = this.newMap, this.playVideo(this.newMap), this.material instanceof Ie$2 && (this.material.useMap = !!this.newMap, this.newMap && this.newMap.wrapS !== RepeatWrapping && (this.newMap.wrapS = RepeatWrapping, this.newMap.wrapT = RepeatWrapping, this.newMap.needsUpdate = !0)), (!this.oldMap && this.newMap || this.oldMap && !this.newMap) && (this.material.needsUpdate = !0), this.editor.emit("materialChanged", this.material);
58204
58202
  }
58205
58203
  undo() {
58206
- if (this.oldMap && this.oldMap instanceof VideoTexture) {
58207
- const t = this.oldMap.source.data;
58208
- t && t.play();
58204
+ this.material[this.mapName] = this.oldMap, this.playVideo(this.oldMap), this.material instanceof Ie$2 && (this.material.useMap = !!this.newMap), (!this.oldMap && this.newMap || this.oldMap && !this.newMap) && (this.material.needsUpdate = !0), this.editor.emit("materialChanged", this.material);
58205
+ }
58206
+ playVideo(t) {
58207
+ if (t && t instanceof VideoTexture) {
58208
+ const r = t.source.data;
58209
+ r && r.play();
58209
58210
  }
58210
- this.material[this.mapName] = this.oldMap, this.material instanceof Ie$2 && (this.material.useMap = !!this.newMap), (!this.oldMap && this.newMap || this.oldMap && !this.newMap) && (this.material.needsUpdate = !0), this.editor.emit("materialChanged", this.material);
58211
58211
  }
58212
58212
  toJSON() {
58213
58213
  const t = super.toJSON(this);
58214
- return t.objectUuid = this.editor.uuidByObject(this.object), t.materialSlot = this.materialSlot, t.mapName = this.mapName, t.newMap = serializeMap(this.newMap), t.oldMap = serializeMap(this.oldMap), t;
58214
+ return t.objectUuid = this.editor.uuidByObject(this.object), t.materialSlot = this.materialSlot, t.mapName = this.mapName, t.newMap = serializeMap(this.newMap), t;
58215
58215
  }
58216
58216
  fromJSON(t) {
58217
58217
  super.fromJSON(t), this.object = this.editor.objectByUuid(t.objectUuid), this.materialSlot = t.materialSlot, this.material = this.editor.getObjectMaterial(
58218
58218
  this.object,
58219
58219
  this.materialSlot
58220
- ), this.mapName = t.mapName, this.oldMap = parseTexture(t.oldMap), this.newMap = parseTexture(t.newMap);
58220
+ ), this.mapName = t.mapName, this.oldMap = this.object !== void 0 ? this.material[this.mapName] : void 0, this.newMap = parseTexture(t.newMap);
58221
+ }
58222
+ fixJSON() {
58223
+ const t = this.json;
58224
+ t && t.oldMap && delete t.oldMap;
58221
58225
  }
58222
58226
  }
58223
58227
  function parseTexture(g) {
@@ -58226,7 +58230,7 @@ function parseTexture(g) {
58226
58230
  const r = new ObjectLoader();
58227
58231
  if (g.isVideoTexture) {
58228
58232
  const d = document.createElement("video");
58229
- d.src = g.images[0].url, d.muted = !0, d.autoplay = !0, d.loop = !0, d.preload = "auto", d.play();
58233
+ d.src = g.images[0].url, d.muted = !0, d.loop = !0, d.preload = "auto";
58230
58234
  const v = {
58231
58235
  [g.images[0].uuid]: new VideoTexture(d)
58232
58236
  };
@@ -58771,7 +58775,7 @@ class History {
58771
58775
  } catch (w) {
58772
58776
  console.error(w, t);
58773
58777
  }
58774
- this.editor.playing || (t.json = t.toJSON()), this.lastCmdTime = Date.now(), this.redos = [], this.editor.emit("historyChanged", t);
58778
+ t.json = t.toJSON(), this.lastCmdTime = Date.now(), this.redos = [], this.editor.emit("historyChanged", t);
58775
58779
  });
58776
58780
  }
58777
58781
  undo() {
@@ -59422,6 +59426,7 @@ class Editor {
59422
59426
  const v = this.viewport.vis;
59423
59427
  let C = t.material;
59424
59428
  if (Array.isArray(t.material) && r !== void 0 ? (C = t.material[r], t.material[r] = d) : t.material = d, C) {
59429
+ C.onBeforeCompile && (d.onBeforeCompile = C.onBeforeCompile);
59425
59430
  const w = new O();
59426
59431
  if (w.track(C), w.dispose(), t.userData.fixBufferGeometry) {
59427
59432
  const E = v.pencil.lead, ye = (Le) => {
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "0.27.10";
1
+ declare const _default: "0.27.11";
2
2
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vis-core",
3
- "version": "0.27.10",
3
+ "version": "0.27.11",
4
4
  "scripts": {
5
5
  "start": "npm run version && PORT=5173 bundler-dev",
6
6
  "build:site": "npm run version && bundler",
@@ -69,7 +69,7 @@
69
69
  "esus-lite": "^0.2.8",
70
70
  "events": "^3.3.0",
71
71
  "geojson-cn": "^0.2.5",
72
- "gl-draw": "0.14.38",
72
+ "gl-draw": "0.14.39",
73
73
  "jsrsasign": "^11.1.0",
74
74
  "lodash-es": "^4.17.21"
75
75
  },