@lumikmz/kmz-file 0.6.2 → 0.6.3

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.
Files changed (2) hide show
  1. package/dist/index.mjs +34 -2
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -85,6 +85,15 @@ function parseLensList(s) {
85
85
  const formatLensList = (xs) => xs.join(",");
86
86
  //#endregion
87
87
  //#region src/codec/encode-action.ts
88
+ function encodeSmartObliquePoint(p) {
89
+ return {
90
+ "wpml:smartObliqueRunningTime": String(p.smartObliqueRunningTime),
91
+ "wpml:smartObliqueStayTime": String(p.smartObliqueStayTime),
92
+ "wpml:smartObliqueEulerPitch": String(p.smartObliqueEulerPitch),
93
+ "wpml:smartObliqueEulerRoll": String(p.smartObliqueEulerRoll),
94
+ "wpml:smartObliqueEulerYaw": String(p.smartObliqueEulerYaw)
95
+ };
96
+ }
88
97
  /**
89
98
  * Encode an Action's `actionActuatorFuncParam` block. Each branch lays out the
90
99
  * params with `wpml:` prefixes per the spec; optional fields are omitted when
@@ -284,7 +293,16 @@ function encodeActionParams(action) {
284
293
  "wpml:searchlightBrightness": String(p.searchlightBrightness)
285
294
  };
286
295
  }
287
- case "startSmartOblique":
296
+ case "startSmartOblique": {
297
+ const p = a.actionActuatorFuncParam;
298
+ const points = p.smartObliquePoint?.map(encodeSmartObliquePoint) ?? [];
299
+ const encoded = {
300
+ ...p.smartObliqueCycleMode !== void 0 ? { "wpml:smartObliqueCycleMode": p.smartObliqueCycleMode } : {},
301
+ "wpml:payloadPositionIndex": String(p.payloadPositionIndex)
302
+ };
303
+ if (points.length > 0) encoded["wpml:smartObliquePoint"] = fromArray(points);
304
+ return encoded;
305
+ }
288
306
  case "stopSmartOblique": {
289
307
  const p = a.actionActuatorFuncParam;
290
308
  return { "wpml:payloadPositionIndex": String(p.payloadPositionIndex) };
@@ -639,8 +657,18 @@ function need(v, field) {
639
657
  if (v === void 0) throw new KmzError(`Missing required field "${field}"`);
640
658
  return v;
641
659
  }
660
+ function decodeSmartObliquePoint(raw) {
661
+ return {
662
+ smartObliqueRunningTime: parseNum(raw["wpml:smartObliqueRunningTime"], "smartObliqueRunningTime"),
663
+ smartObliqueStayTime: parseNum(raw["wpml:smartObliqueStayTime"], "smartObliqueStayTime"),
664
+ smartObliqueEulerPitch: degrees(parseNum(raw["wpml:smartObliqueEulerPitch"], "smartObliqueEulerPitch")),
665
+ smartObliqueEulerRoll: degrees(parseNum(raw["wpml:smartObliqueEulerRoll"], "smartObliqueEulerRoll")),
666
+ smartObliqueEulerYaw: degrees(parseNum(raw["wpml:smartObliqueEulerYaw"], "smartObliqueEulerYaw"))
667
+ };
668
+ }
642
669
  function decodeAction(raw) {
643
670
  const p = raw["wpml:actionActuatorFuncParam"] ?? {};
671
+ const smartObliquePoint = p["wpml:smartObliquePoint"];
644
672
  const id = parseNum(raw["wpml:actionId"], "actionId");
645
673
  const func = raw["wpml:actionActuatorFunc"];
646
674
  switch (func) {
@@ -859,7 +887,11 @@ function decodeAction(raw) {
859
887
  case "startSmartOblique": return {
860
888
  actionId: id,
861
889
  actionActuatorFunc: "startSmartOblique",
862
- actionActuatorFuncParam: { payloadPositionIndex: parseNum(p["wpml:payloadPositionIndex"], "payloadPositionIndex") }
890
+ actionActuatorFuncParam: {
891
+ ...p["wpml:smartObliqueCycleMode"] !== void 0 ? { smartObliqueCycleMode: p["wpml:smartObliqueCycleMode"] } : {},
892
+ payloadPositionIndex: parseNum(p["wpml:payloadPositionIndex"], "payloadPositionIndex"),
893
+ ...smartObliquePoint !== void 0 ? { smartObliquePoint: toArray(smartObliquePoint).map(decodeSmartObliquePoint) } : {}
894
+ }
863
895
  };
864
896
  case "stopSmartOblique": return {
865
897
  actionId: id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumikmz/kmz-file",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "DJI KMZ file pack/unpack — Rust WASM + spec-aligned TypeScript codec",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -24,7 +24,7 @@
24
24
  "./package.json": "./package.json"
25
25
  },
26
26
  "dependencies": {
27
- "@lumikmz/kmz": "0.6.2"
27
+ "@lumikmz/kmz": "0.6.3"
28
28
  },
29
29
  "devDependencies": {
30
30
  "vite-plus": "latest",