web3dlink 2.1.9 → 2.1.10

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/web3dlink.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region \0rolldown/runtime.js
2
- var __commonJSMin = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), name = "web3dlink", version$1 = "2.1.9", description = "LarkSR / ZS 推流 GameAPI SDK", type = "module", main = "./dist/web3dlink.js", module$1 = "./dist/web3dlink.js", exports$1 = { ".": {
2
+ var __commonJSMin = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), name = "web3dlink", version$1 = "2.1.10", description = "LarkSR / ZS 推流 GameAPI SDK", type = "module", main = "./dist/web3dlink.js", module$1 = "./dist/web3dlink.js", exports$1 = { ".": {
3
3
  import: "./dist/web3dlink.js",
4
4
  default: "./dist/web3dlink.js"
5
5
  } }, files = ["dist"], scripts = {
@@ -769,7 +769,7 @@ function verifyEnumerationValue(e) {
769
769
  }
770
770
  //#endregion
771
771
  //#region ../api/camera/validate.js
772
- function validateOptionalBoolean(e, t, n, r, i) {
772
+ function validateOptionalBoolean$1(e, t, n, r, i) {
773
773
  if (n == null || n === "") {
774
774
  e[t] = i;
775
775
  return;
@@ -1026,7 +1026,7 @@ function aroundMode(e = {}) {
1026
1026
  value: e.y_AnimSpeed,
1027
1027
  defaultValue: 5,
1028
1028
  min: 0
1029
- })), validateOptionalBoolean(n, "isCheckCollision", e.isCheckCollision, t, !1), validateOptionalBoolean(n, "isIgnoreAttachedActors", e.isIgnoreAttachedActors, t, !0), t.push(...validateOptionalNumber({
1029
+ })), validateOptionalBoolean$1(n, "isCheckCollision", e.isCheckCollision, t, !1), validateOptionalBoolean$1(n, "isIgnoreAttachedActors", e.isIgnoreAttachedActors, t, !0), t.push(...validateOptionalNumber({
1030
1030
  normalized: n,
1031
1031
  field: "collisionOffset",
1032
1032
  value: e.collisionOffset,
@@ -1071,14 +1071,14 @@ function firstPersonMode(e = {}) {
1071
1071
  value: e.speed,
1072
1072
  defaultValue: 2,
1073
1073
  min: 0
1074
- })), validateOptionalBoolean(n, "collision", e.collision, t, !0), {
1074
+ })), validateOptionalBoolean$1(n, "collision", e.collision, t, !0), {
1075
1075
  errors: t,
1076
1076
  normalized: n
1077
1077
  };
1078
1078
  }
1079
1079
  function viewLock(e = {}) {
1080
1080
  let t = [], n = { ...e };
1081
- return validateOptionalBoolean(n, "state", e.state, t, !1), {
1081
+ return validateOptionalBoolean$1(n, "state", e.state, t, !1), {
1082
1082
  errors: t,
1083
1083
  normalized: n
1084
1084
  };
@@ -3432,6 +3432,157 @@ function offMouseClick(e = {}) {
3432
3432
  normalized: n
3433
3433
  };
3434
3434
  }
3435
+ function validateOptionalBoolean(e, t, n, r, i) {
3436
+ let a = e[t];
3437
+ if (a == null || a === "") {
3438
+ i[t] = n;
3439
+ return;
3440
+ }
3441
+ if (typeof a != "boolean") {
3442
+ r.push(`[${t}]必须是布尔类型`);
3443
+ return;
3444
+ }
3445
+ i[t] = a;
3446
+ }
3447
+ function validateOptionalCoordinates(e, t, n) {
3448
+ let r = e.coordinates;
3449
+ if (r == null || r === "" || Array.isArray(r) && r.length === 0) {
3450
+ n.coordinates = [];
3451
+ return;
3452
+ }
3453
+ t.push(...validateCoordinatesRequired(r)), Array.isArray(r) && r.length >= 3 && (n.coordinates = r.slice(0, 3).map(Number));
3454
+ }
3455
+ function playSequence(e = {}) {
3456
+ let t = [], n = { ...e };
3457
+ t.push(...validateRequiredString({
3458
+ normalized: n,
3459
+ field: "id",
3460
+ value: e.id
3461
+ })), t.push(...validateRequiredString({
3462
+ normalized: n,
3463
+ field: "fieldName",
3464
+ value: e.fieldName
3465
+ })), t.push(...validateOptionalString({
3466
+ normalized: n,
3467
+ field: "sequenceDirectory",
3468
+ value: e.sequenceDirectory,
3469
+ defaultValue: ""
3470
+ })), t.push(...validateOptionalArray({
3471
+ normalized: n,
3472
+ field: "sequenceFiles",
3473
+ value: e.sequenceFiles,
3474
+ defaultValue: []
3475
+ })), Array.isArray(n.sequenceFiles) && (n.sequenceFiles = n.sequenceFiles.map((e) => String(e ?? "").trim()).filter(Boolean));
3476
+ let r = typeof n.sequenceDirectory == "string" && n.sequenceDirectory.trim() !== "", i = Array.isArray(n.sequenceFiles) && n.sequenceFiles.length > 0;
3477
+ return i && r ? t.push("[sequenceFiles]与[sequenceDirectory]二选一,不能同时填写(设置 sequenceDirectory 时 sequenceFiles 必须为空)") : i ? n.sequenceDirectory = "" : r ? (n.sequenceDirectory = n.sequenceDirectory.trim(), n.sequenceFiles = []) : t.push("[sequenceFiles]与[sequenceDirectory]二选一,必须填写其中一个(设置 sequenceDirectory 时 sequenceFiles 必须为空)"), t.push(...validateOptionalNumber({
3478
+ normalized: n,
3479
+ field: "frameIndex",
3480
+ value: e.frameIndex,
3481
+ defaultValue: 0,
3482
+ min: 0
3483
+ })), t.push(...validateOptionalNumber({
3484
+ normalized: n,
3485
+ field: "playbackSpeed",
3486
+ value: e.playbackSpeed,
3487
+ defaultValue: 1,
3488
+ min: 0
3489
+ })), typeof n.playbackSpeed == "number" && n.playbackSpeed <= 0 && t.push("[playbackSpeed]取值必须大于0"), validateOptionalCoordinates(e, t, n), t.push(...validateOptionalVector3Array({
3490
+ normalized: n,
3491
+ field: "rotation",
3492
+ value: e.rotation,
3493
+ defaultValue: [
3494
+ 0,
3495
+ 0,
3496
+ 0
3497
+ ]
3498
+ })), t.push(...validateOptionalVector3Array({
3499
+ normalized: n,
3500
+ field: "scale",
3501
+ value: e.scale,
3502
+ defaultValue: [
3503
+ 1,
3504
+ 1,
3505
+ 1
3506
+ ]
3507
+ })), {
3508
+ errors: t,
3509
+ normalized: n
3510
+ };
3511
+ }
3512
+ function pauseSequence(e = {}) {
3513
+ let t = [], n = { ...e };
3514
+ return t.push(...validateRequiredString({
3515
+ normalized: n,
3516
+ field: "id",
3517
+ value: e.id
3518
+ })), {
3519
+ errors: t,
3520
+ normalized: n
3521
+ };
3522
+ }
3523
+ function stopSequence(e = {}) {
3524
+ let t = [], n = { ...e };
3525
+ return t.push(...validateRequiredString({
3526
+ normalized: n,
3527
+ field: "id",
3528
+ value: e.id
3529
+ })), {
3530
+ errors: t,
3531
+ normalized: n
3532
+ };
3533
+ }
3534
+ function setFrame(e = {}) {
3535
+ let t = [], n = { ...e };
3536
+ return t.push(...validateRequiredString({
3537
+ normalized: n,
3538
+ field: "id",
3539
+ value: e.id
3540
+ })), t.push(...validateOptionalNumber({
3541
+ normalized: n,
3542
+ field: "frameIndex",
3543
+ value: e.frameIndex,
3544
+ defaultValue: 0,
3545
+ min: 0
3546
+ })), {
3547
+ errors: t,
3548
+ normalized: n
3549
+ };
3550
+ }
3551
+ function setPlaybackSpeed(e = {}) {
3552
+ let t = [], n = { ...e };
3553
+ return t.push(...validateRequiredString({
3554
+ normalized: n,
3555
+ field: "id",
3556
+ value: e.id
3557
+ })), t.push(...validateOptionalNumber({
3558
+ normalized: n,
3559
+ field: "playbackSpeed",
3560
+ value: e.playbackSpeed,
3561
+ defaultValue: 4,
3562
+ min: 0
3563
+ })), typeof n.playbackSpeed == "number" && n.playbackSpeed <= 0 && t.push("[playbackSpeed]取值必须大于0"), {
3564
+ errors: t,
3565
+ normalized: n
3566
+ };
3567
+ }
3568
+ function clearSequence(e = {}) {
3569
+ let t = [], n = { ...e };
3570
+ return t.push(...validateRequiredString({
3571
+ normalized: n,
3572
+ field: "id",
3573
+ value: e.id
3574
+ })), validateOptionalBoolean(e, "isClearCache", !0, t, n), {
3575
+ errors: t,
3576
+ normalized: n
3577
+ };
3578
+ }
3579
+ function clearAllSequence(e = {}) {
3580
+ let t = [], n = { ...e };
3581
+ return validateOptionalBoolean(e, "isClearCache", !0, t, n), {
3582
+ errors: t,
3583
+ normalized: n
3584
+ };
3585
+ }
3435
3586
  //#endregion
3436
3587
  //#region ../api/vtk/vtkApi.js
3437
3588
  var validator = {
@@ -3447,7 +3598,14 @@ var validator = {
3447
3598
  setDisplacementScale,
3448
3599
  closeDisplacementScale,
3449
3600
  onMouseClick,
3450
- offMouseClick
3601
+ offMouseClick,
3602
+ playSequence,
3603
+ pauseSequence,
3604
+ stopSequence,
3605
+ setFrame,
3606
+ setPlaybackSpeed,
3607
+ clearSequence,
3608
+ clearAllSequence
3451
3609
  }, VtkApi = class {
3452
3610
  constructor(e) {
3453
3611
  this.commandManager = e;