@limrun/ui 0.4.2 → 0.5.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/core/constants.d.ts +1 -0
- package/dist/core/webrtc-messages.d.ts +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +771 -456
- package/package.json +1 -1
- package/src/components/remote-control.css +18 -0
- package/src/components/remote-control.tsx +669 -117
- package/src/core/constants.ts +2 -0
- package/src/core/webrtc-messages.ts +49 -1
package/src/core/constants.ts
CHANGED
|
@@ -2,6 +2,8 @@ export const CONTROL_MSG_TYPE = {
|
|
|
2
2
|
INJECT_KEYCODE: 0,
|
|
3
3
|
INJECT_TEXT: 1,
|
|
4
4
|
INJECT_TOUCH_EVENT: 2,
|
|
5
|
+
// iOS-specific: send two touch points in one message (Option/Alt+drag pinch)
|
|
6
|
+
INJECT_TWO_FINGER_TOUCH_EVENT: 18,
|
|
5
7
|
INJECT_SCROLL_EVENT: 3,
|
|
6
8
|
BACK_OR_SCREEN_ON: 4,
|
|
7
9
|
EXPAND_NOTIFICATION_PANEL: 5,
|
|
@@ -21,7 +21,7 @@ export function createTouchControlMessage(
|
|
|
21
21
|
view.setUint8(offset, action);
|
|
22
22
|
offset += 1;
|
|
23
23
|
|
|
24
|
-
view.setBigInt64(offset, BigInt(pointerId));
|
|
24
|
+
view.setBigInt64(offset, BigInt(pointerId), true);
|
|
25
25
|
offset += 8;
|
|
26
26
|
|
|
27
27
|
view.setInt32(offset, Math.round(x), true);
|
|
@@ -43,6 +43,54 @@ export function createTouchControlMessage(
|
|
|
43
43
|
return buffer;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
// iOS-specific two-finger touch control message (fixed size = 24 bytes)
|
|
47
|
+
// Layout (little-endian):
|
|
48
|
+
// 1 byte: type
|
|
49
|
+
// 1 byte: action
|
|
50
|
+
// 4 bytes: x0 (Int32)
|
|
51
|
+
// 4 bytes: y0 (Int32)
|
|
52
|
+
// 4 bytes: x1 (Int32)
|
|
53
|
+
// 4 bytes: y1 (Int32)
|
|
54
|
+
// 2 bytes: videoWidth (UInt16)
|
|
55
|
+
// 2 bytes: videoHeight (UInt16)
|
|
56
|
+
// 2 bytes: reserved (UInt16, currently 0)
|
|
57
|
+
export function createTwoFingerTouchControlMessage(
|
|
58
|
+
action: number,
|
|
59
|
+
videoWidth: number,
|
|
60
|
+
videoHeight: number,
|
|
61
|
+
x0: number,
|
|
62
|
+
y0: number,
|
|
63
|
+
x1: number,
|
|
64
|
+
y1: number,
|
|
65
|
+
): ArrayBuffer {
|
|
66
|
+
const buffer = new ArrayBuffer(24);
|
|
67
|
+
const view = new DataView(buffer);
|
|
68
|
+
let offset = 0;
|
|
69
|
+
|
|
70
|
+
view.setUint8(offset, CONTROL_MSG_TYPE.INJECT_TWO_FINGER_TOUCH_EVENT);
|
|
71
|
+
offset += 1;
|
|
72
|
+
|
|
73
|
+
view.setUint8(offset, action);
|
|
74
|
+
offset += 1;
|
|
75
|
+
|
|
76
|
+
view.setInt32(offset, Math.round(x0), true);
|
|
77
|
+
offset += 4;
|
|
78
|
+
view.setInt32(offset, Math.round(y0), true);
|
|
79
|
+
offset += 4;
|
|
80
|
+
view.setInt32(offset, Math.round(x1), true);
|
|
81
|
+
offset += 4;
|
|
82
|
+
view.setInt32(offset, Math.round(y1), true);
|
|
83
|
+
offset += 4;
|
|
84
|
+
|
|
85
|
+
view.setUint16(offset, videoWidth, true);
|
|
86
|
+
offset += 2;
|
|
87
|
+
view.setUint16(offset, videoHeight, true);
|
|
88
|
+
offset += 2;
|
|
89
|
+
|
|
90
|
+
view.setUint16(offset, 0, true);
|
|
91
|
+
return buffer;
|
|
92
|
+
}
|
|
93
|
+
|
|
46
94
|
export function createSetClipboardMessage(text: string, paste = true): ArrayBuffer {
|
|
47
95
|
const encoder = new TextEncoder();
|
|
48
96
|
const textBytes = encoder.encode(text);
|