@kelnishi/satmouse-client 0.9.15 → 0.10.0
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/chunk-JTG5GEIB.cjs +65 -0
- package/dist/chunk-JTG5GEIB.cjs.map +1 -0
- package/dist/chunk-RNM322RZ.js +60 -0
- package/dist/chunk-RNM322RZ.js.map +1 -0
- package/dist/{connection-5KQFvHoJ.d.cts → connection-DQxI5qib.d.cts} +6 -0
- package/dist/{connection-5KQFvHoJ.d.ts → connection-DQxI5qib.d.ts} +6 -0
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/elements/index.cjs +84 -67
- package/dist/elements/index.cjs.map +1 -1
- package/dist/elements/index.d.cts +4 -1
- package/dist/elements/index.d.ts +4 -1
- package/dist/elements/index.js +84 -67
- package/dist/elements/index.js.map +1 -1
- package/dist/react/index.cjs +130 -236
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +35 -95
- package/dist/react/index.d.ts +35 -95
- package/dist/react/index.js +130 -236
- package/dist/react/index.js.map +1 -1
- package/dist/utils/index.cjs +102 -173
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +42 -115
- package/dist/utils/index.d.ts +42 -115
- package/dist/utils/index.js +96 -161
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-I47ZOX3M.js +0 -64
- package/dist/chunk-I47ZOX3M.js.map +0 -1
- package/dist/chunk-LDSDVYCV.cjs +0 -69
- package/dist/chunk-LDSDVYCV.cjs.map +0 -1
package/dist/chunk-LDSDVYCV.cjs
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// src/utils/action-map.ts
|
|
4
|
-
var DEFAULT_ACTION_MAP = {
|
|
5
|
-
tx: { source: "tx" },
|
|
6
|
-
ty: { source: "ty" },
|
|
7
|
-
tz: { source: "tz" },
|
|
8
|
-
rx: { source: "rx" },
|
|
9
|
-
ry: { source: "ry" },
|
|
10
|
-
rz: { source: "rz" }
|
|
11
|
-
};
|
|
12
|
-
function readAxis(data, axis) {
|
|
13
|
-
switch (axis) {
|
|
14
|
-
case "tx":
|
|
15
|
-
return data.translation.x;
|
|
16
|
-
case "ty":
|
|
17
|
-
return data.translation.y;
|
|
18
|
-
case "tz":
|
|
19
|
-
return data.translation.z;
|
|
20
|
-
case "rx":
|
|
21
|
-
return data.rotation.x;
|
|
22
|
-
case "ry":
|
|
23
|
-
return data.rotation.y;
|
|
24
|
-
case "rz":
|
|
25
|
-
return data.rotation.z;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
function applyActionMap(data, map) {
|
|
29
|
-
const result = {};
|
|
30
|
-
for (const [action, binding] of Object.entries(map)) {
|
|
31
|
-
let value = readAxis(data, binding.source);
|
|
32
|
-
if (binding.invert) value = -value;
|
|
33
|
-
value *= binding.scale ?? 1;
|
|
34
|
-
result[action] = value;
|
|
35
|
-
}
|
|
36
|
-
return result;
|
|
37
|
-
}
|
|
38
|
-
function actionValuesToSpatialData(values, timestamp) {
|
|
39
|
-
return {
|
|
40
|
-
translation: {
|
|
41
|
-
x: values.tx ?? 0,
|
|
42
|
-
y: values.ty ?? 0,
|
|
43
|
-
z: values.tz ?? 0
|
|
44
|
-
},
|
|
45
|
-
rotation: {
|
|
46
|
-
x: values.rx ?? 0,
|
|
47
|
-
y: values.ry ?? 0,
|
|
48
|
-
z: values.rz ?? 0
|
|
49
|
-
},
|
|
50
|
-
timestamp
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
function swapActions(map, actionA, actionB) {
|
|
54
|
-
const result = { ...map };
|
|
55
|
-
const a = result[actionA];
|
|
56
|
-
const b = result[actionB];
|
|
57
|
-
if (a && b) {
|
|
58
|
-
result[actionA] = b;
|
|
59
|
-
result[actionB] = a;
|
|
60
|
-
}
|
|
61
|
-
return result;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
exports.DEFAULT_ACTION_MAP = DEFAULT_ACTION_MAP;
|
|
65
|
-
exports.actionValuesToSpatialData = actionValuesToSpatialData;
|
|
66
|
-
exports.applyActionMap = applyActionMap;
|
|
67
|
-
exports.swapActions = swapActions;
|
|
68
|
-
//# sourceMappingURL=chunk-LDSDVYCV.cjs.map
|
|
69
|
-
//# sourceMappingURL=chunk-LDSDVYCV.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/action-map.ts"],"names":[],"mappings":";;;AA0BO,IAAM,kBAAA,GAAgC;AAAA,EAC3C,EAAA,EAAI,EAAE,MAAA,EAAQ,IAAA,EAAK;AAAA,EACnB,EAAA,EAAI,EAAE,MAAA,EAAQ,IAAA,EAAK;AAAA,EACnB,EAAA,EAAI,EAAE,MAAA,EAAQ,IAAA,EAAK;AAAA,EACnB,EAAA,EAAI,EAAE,MAAA,EAAQ,IAAA,EAAK;AAAA,EACnB,EAAA,EAAI,EAAE,MAAA,EAAQ,IAAA,EAAK;AAAA,EACnB,EAAA,EAAI,EAAE,MAAA,EAAQ,IAAA;AAChB;AAMA,SAAS,QAAA,CAAS,MAAmB,IAAA,EAAyB;AAC5D,EAAA,QAAQ,IAAA;AAAM,IACZ,KAAK,IAAA;AAAM,MAAA,OAAO,KAAK,WAAA,CAAY,CAAA;AAAA,IACnC,KAAK,IAAA;AAAM,MAAA,OAAO,KAAK,WAAA,CAAY,CAAA;AAAA,IACnC,KAAK,IAAA;AAAM,MAAA,OAAO,KAAK,WAAA,CAAY,CAAA;AAAA,IACnC,KAAK,IAAA;AAAM,MAAA,OAAO,KAAK,QAAA,CAAS,CAAA;AAAA,IAChC,KAAK,IAAA;AAAM,MAAA,OAAO,KAAK,QAAA,CAAS,CAAA;AAAA,IAChC,KAAK,IAAA;AAAM,MAAA,OAAO,KAAK,QAAA,CAAS,CAAA;AAAA;AAEpC;AAGO,SAAS,cAAA,CAAe,MAAmB,GAAA,EAA8B;AAC9E,EAA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","file":"chunk-LDSDVYCV.cjs","sourcesContent":["import type { SpatialData } from \"../core/types.js\";\n\n/** Input axis identifier */\nexport type InputAxis = \"tx\" | \"ty\" | \"tz\" | \"rx\" | \"ry\" | \"rz\";\n\n/** A single action binding — maps one input axis to a named output */\nexport interface ActionBinding {\n /** Which input axis drives this action */\n source: InputAxis;\n /** Scale multiplier (default: 1) */\n scale?: number;\n /** Invert the value (default: false) */\n invert?: boolean;\n}\n\n/**\n * ActionMap defines how raw 6DOF axes map to named output actions.\n *\n * Client apps declare the actions they support and how device axes\n * feed into them. Users can reassign axes via the settings UI.\n *\n * Default: 6 actions matching the 6 input axes (passthrough).\n */\nexport type ActionMap = Record<string, ActionBinding>;\n\n/** Default passthrough — each axis maps to itself */\nexport const DEFAULT_ACTION_MAP: ActionMap = {\n tx: { source: \"tx\" },\n ty: { source: \"ty\" },\n tz: { source: \"tz\" },\n rx: { source: \"rx\" },\n ry: { source: \"ry\" },\n rz: { source: \"rz\" },\n};\n\n/** Result of applying an ActionMap to spatial data */\nexport type ActionValues = Record<string, number>;\n\n/** Read a raw axis value from SpatialData */\nfunction readAxis(data: SpatialData, axis: InputAxis): number {\n switch (axis) {\n case \"tx\": return data.translation.x;\n case \"ty\": return data.translation.y;\n case \"tz\": return data.translation.z;\n case \"rx\": return data.rotation.x;\n case \"ry\": return data.rotation.y;\n case \"rz\": return data.rotation.z;\n }\n}\n\n/** Apply an ActionMap to SpatialData, producing named action values */\nexport function applyActionMap(data: SpatialData, map: ActionMap): ActionValues {\n const result: ActionValues = {};\n for (const [action, binding] of Object.entries(map)) {\n let value = readAxis(data, binding.source);\n if (binding.invert) value = -value;\n value *= binding.scale ?? 1;\n result[action] = value;\n }\n return result;\n}\n\n/**\n * Convert ActionValues back to SpatialData.\n * Only populates tx/ty/tz/rx/ry/rz keys if they exist as actions.\n */\nexport function actionValuesToSpatialData(values: ActionValues, timestamp: number): SpatialData {\n return {\n translation: {\n x: values.tx ?? 0,\n y: values.ty ?? 0,\n z: values.tz ?? 0,\n },\n rotation: {\n x: values.rx ?? 0,\n y: values.ry ?? 0,\n z: values.rz ?? 0,\n },\n timestamp,\n };\n}\n\n/** Swap two action bindings */\nexport function swapActions(map: ActionMap, actionA: string, actionB: string): ActionMap {\n const result = { ...map };\n const a = result[actionA];\n const b = result[actionB];\n if (a && b) {\n result[actionA] = b;\n result[actionB] = a;\n }\n return result;\n}\n"]}
|