vis-core 0.28.23 → 0.28.25
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.
- package/dist/editor/command/AddMaterial.d.ts +3 -3
- package/dist/editor/viewport.d.ts +8 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.module.js +84 -32
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.module.js
CHANGED
|
@@ -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.
|
|
91
|
+
}, version = "0.28.25";
|
|
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
|
|
59758
|
-
|
|
59759
|
-
|
|
59760
|
-
|
|
59761
|
-
|
|
59762
|
-
|
|
59763
|
-
|
|
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(`
|
|
59766
|
-
} else
|
|
59767
|
-
|
|
59768
|
-
|
|
59769
|
-
|
|
59770
|
-
|
|
59771
|
-
|
|
59772
|
-
|
|
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) {
|
|
@@ -60311,8 +60330,8 @@ class Viewport {
|
|
|
60311
60330
|
}
|
|
60312
60331
|
if (this.vis = this.options.visFactories, this.vis.visName !== t)
|
|
60313
60332
|
throw new Error(`visName is not match, import {${t}}`);
|
|
60314
|
-
let v = q0(
|
|
60315
|
-
v = this.editor.hooks.events.beforeSetVisOptions.length ? this.editor.hooks.dispatch("beforeSetVisOptions", v) : v, this.vis.setOptions(v), this.vis.cameraState = q0({}, this.cameraState), this.delLoadObj && (this.vis.delLoadArr = this.delLoadObj), this.vis.playing = this.editor.playing, this.vis._baseObjectByUuid = this.editor.baseObjectByUuid.bind(this.editor), this.vis._objectByUuid = this.editor.objectByUuid.bind(this.editor), this.vis.on("loaderProgress", (_, w) => {
|
|
60333
|
+
let v = q0({}, r);
|
|
60334
|
+
v = this.editor.hooks.events.beforeSetVisOptions.length ? this.editor.hooks.dispatch("beforeSetVisOptions", v) : v, this.vis.setOptions(q0(q0({}, v), this.extendsOptions)), this.vis.cameraState = q0({}, this.cameraState), this.delLoadObj && (this.vis.delLoadArr = this.delLoadObj), this.vis.playing = this.editor.playing, this.vis._baseObjectByUuid = this.editor.baseObjectByUuid.bind(this.editor), this.vis._objectByUuid = this.editor.objectByUuid.bind(this.editor), this.vis.on("loaderProgress", (_, w) => {
|
|
60316
60335
|
this.editor.emit("progress", {
|
|
60317
60336
|
type: "下载资源",
|
|
60318
60337
|
value: _ / w * 100 | 0
|
|
@@ -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.
|
|
60379
|
-
|
|
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:
|
|
60385
|
-
if (!
|
|
60421
|
+
const { vis: t } = this;
|
|
60422
|
+
if (!t || !this.copyObjKey)
|
|
60386
60423
|
return;
|
|
60387
|
-
const
|
|
60388
|
-
this.editor.execute(new CopyObject(this.editor,
|
|
60424
|
+
const r = this.editor.baseObjectByUuid(this.copyObjKey);
|
|
60425
|
+
this.editor.execute(new CopyObject(this.editor, r));
|
|
60389
60426
|
});
|
|
60390
60427
|
}
|
|
60391
|
-
|
|
60428
|
+
copyMListMaterial(t) {
|
|
60392
60429
|
return B0(this, null, function* () {
|
|
60393
60430
|
const { vis: r } = this;
|
|
60394
|
-
r && this.
|
|
60431
|
+
r && (this.copyMListMaterialKey = t, t && del("crossCopyMaterial"));
|
|
60395
60432
|
});
|
|
60396
60433
|
}
|
|
60397
|
-
|
|
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
|
|
60452
|
+
r && this.editor.execute(new AddMaterial(this.editor, t));
|
|
60401
60453
|
});
|
|
60402
60454
|
}
|
|
60403
|
-
|
|
60455
|
+
removeMListMaterial(t) {
|
|
60404
60456
|
return B0(this, null, function* () {
|
|
60405
60457
|
const { vis: r } = this;
|
|
60406
|
-
r && this.editor.execute(new
|
|
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;
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "0.28.
|
|
1
|
+
declare const _default: "0.28.25";
|
|
2
2
|
export default _default;
|