@epicgames-ps/lib-pixelstreamingfrontend-ue5.5 0.1.4 → 0.2.1
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/.eslintrc.js +1 -1
- package/.prettierrc.json +1 -0
- package/dist/lib-pixelstreamingfrontend.esm.js +1 -1
- package/dist/lib-pixelstreamingfrontend.js +1 -1
- package/package.json +6 -5
- package/src/AFK/AFKController.ts +10 -32
- package/src/Config/Config.ts +179 -201
- package/src/Config/SettingBase.ts +61 -2
- package/src/Config/SettingFlag.ts +10 -48
- package/src/Config/SettingNumber.ts +10 -28
- package/src/Config/SettingOption.ts +13 -46
- package/src/Config/SettingText.ts +9 -37
- package/src/DataChannel/DataChannelController.ts +6 -26
- package/src/DataChannel/DataChannelLatencyTestController.ts +38 -33
- package/src/DataChannel/DataChannelLatencyTestResults.ts +8 -10
- package/src/DataChannel/DataChannelSender.ts +5 -15
- package/src/DataChannel/LatencyTestResults.ts +5 -15
- package/src/FreezeFrame/FreezeFrame.ts +7 -19
- package/src/FreezeFrame/FreezeFrameController.ts +3 -14
- package/src/Inputs/GamepadController.ts +123 -221
- package/src/Inputs/GamepadTypes.ts +23 -0
- package/src/Inputs/IInputController.ts +17 -0
- package/src/Inputs/InputClassesFactory.ts +38 -45
- package/src/Inputs/KeyCodes.ts +114 -0
- package/src/Inputs/KeyboardController.ts +49 -232
- package/src/Inputs/MouseController.ts +71 -297
- package/src/Inputs/MouseControllerHovering.ts +118 -0
- package/src/Inputs/MouseControllerLocked.ts +194 -0
- package/src/Inputs/TouchController.ts +49 -105
- package/src/Inputs/TouchControllerFake.ts +132 -0
- package/src/Inputs/XRGamepadController.ts +35 -44
- package/src/PeerConnectionController/AggregatedStats.ts +26 -54
- package/src/PeerConnectionController/CandidatePairStats.ts +1 -1
- package/src/PeerConnectionController/CandidateStat.ts +1 -1
- package/src/PeerConnectionController/PeerConnectionController.ts +177 -162
- package/src/PixelStreaming/PixelStreaming.ts +174 -226
- package/src/UI/OnScreenKeyboard.ts +14 -9
- package/src/UeInstanceMessage/ResponseController.ts +6 -15
- package/src/UeInstanceMessage/SendMessageController.ts +16 -18
- package/src/UeInstanceMessage/StreamMessageController.ts +3 -12
- package/src/UeInstanceMessage/ToStreamerMessagesController.ts +3 -9
- package/src/Util/EventEmitter.ts +17 -22
- package/src/Util/FileUtil.ts +11 -34
- package/src/Util/IURLSearchParams.ts +25 -0
- package/src/Util/InputCoordTranslator.ts +73 -0
- package/src/Util/RTCUtils.ts +23 -15
- package/src/VideoPlayer/StreamController.ts +6 -23
- package/src/VideoPlayer/VideoPlayer.ts +9 -30
- package/src/WebRtcPlayer/WebRtcPlayerController.ts +328 -690
- package/src/WebXR/WebXRController.ts +82 -94
- package/src/pixelstreamingfrontend.ts +6 -10
- package/types/AFK/AFKController.d.ts +0 -1
- package/types/Config/Config.d.ts +6 -5
- package/types/Config/SettingBase.d.ts +13 -0
- package/types/Config/SettingFlag.d.ts +1 -10
- package/types/Config/SettingNumber.d.ts +1 -5
- package/types/Config/SettingOption.d.ts +1 -10
- package/types/Config/SettingText.d.ts +1 -9
- package/types/DataChannel/DataChannelLatencyTestController.d.ts +1 -1
- package/types/Inputs/GamepadController.d.ts +22 -46
- package/types/Inputs/GamepadTypes.d.ts +7 -0
- package/types/Inputs/IInputController.d.ts +16 -0
- package/types/Inputs/InputClassesFactory.d.ts +7 -8
- package/types/Inputs/KeyCodes.d.ts +5 -0
- package/types/Inputs/KeyboardController.d.ts +17 -45
- package/types/Inputs/MouseController.d.ts +33 -68
- package/types/Inputs/MouseControllerHovering.d.ts +26 -0
- package/types/Inputs/MouseControllerLocked.d.ts +31 -0
- package/types/Inputs/TouchController.d.ts +19 -44
- package/types/Inputs/TouchControllerFake.d.ts +29 -0
- package/types/Inputs/XRGamepadController.d.ts +0 -7
- package/types/PeerConnectionController/PeerConnectionController.d.ts +4 -1
- package/types/PixelStreaming/PixelStreaming.d.ts +14 -2
- package/types/UI/OnScreenKeyboard.d.ts +2 -2
- package/types/Util/EventEmitter.d.ts +1 -1
- package/types/Util/IURLSearchParams.d.ts +9 -0
- package/types/Util/InputCoordTranslator.d.ts +29 -0
- package/types/VideoPlayer/StreamController.d.ts +0 -2
- package/types/WebRtcPlayer/WebRtcPlayerController.d.ts +19 -17
- package/types/pixelstreamingfrontend.d.ts +1 -1
- package/src/Inputs/FakeTouchController.ts +0 -199
- package/src/Inputs/HoveringMouseEvents.ts +0 -192
- package/src/Inputs/IMouseEvents.ts +0 -64
- package/src/Inputs/ITouchController.ts +0 -29
- package/src/Inputs/LockedMouseEvents.ts +0 -287
- package/src/Util/CoordinateConverter.ts +0 -290
- package/src/Util/EventListenerTracker.ts +0 -29
- package/types/Inputs/FakeTouchController.d.ts +0 -61
- package/types/Inputs/HoveringMouseEvents.d.ts +0 -56
- package/types/Inputs/IMouseEvents.d.ts +0 -53
- package/types/Inputs/ITouchController.d.ts +0 -24
- package/types/Inputs/LockedMouseEvents.d.ts +0 -80
- package/types/Util/CoordinateConverter.d.ts +0 -100
- package/types/Util/EventListenerTracker.d.ts +0 -14
|
@@ -11,7 +11,7 @@ export { AFKController as AfkLogic } from './AFK/AFKController';
|
|
|
11
11
|
export { LatencyTestResults } from './DataChannel/LatencyTestResults';
|
|
12
12
|
export { EncoderSettings, InitialSettings, WebRTCSettings } from './DataChannel/InitialSettings';
|
|
13
13
|
export { AggregatedStats } from './PeerConnectionController/AggregatedStats';
|
|
14
|
-
export {
|
|
14
|
+
export { InputCoordTranslator, UntranslatedCoordUnsigned as UnquantizedAndDenormalizeUnsigned } from './Util/InputCoordTranslator';
|
|
15
15
|
export { MessageDirection } from './UeInstanceMessage/StreamMessageController';
|
|
16
16
|
export { CandidatePairStats } from './PeerConnectionController/CandidatePairStats';
|
|
17
17
|
export { CandidateStat } from './PeerConnectionController/CandidateStat';
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
2
|
-
|
|
3
|
-
import { CoordinateConverter } from '../Util/CoordinateConverter';
|
|
4
|
-
import { StreamMessageController } from '../UeInstanceMessage/StreamMessageController';
|
|
5
|
-
import { VideoPlayer } from '../VideoPlayer/VideoPlayer';
|
|
6
|
-
import { ITouchController } from './ITouchController';
|
|
7
|
-
import { MouseButton } from './MouseButtons';
|
|
8
|
-
import { EventListenerTracker } from '../Util/EventListenerTracker';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Allows for the usage of fake touch events and implements ITouchController
|
|
12
|
-
* @param dataChannelController - The controller for the Data channel
|
|
13
|
-
* @param videoElementParent - The video player DOM element
|
|
14
|
-
*/
|
|
15
|
-
export class FakeTouchController implements ITouchController {
|
|
16
|
-
fakeTouchFinger: FakeTouchFinger;
|
|
17
|
-
toStreamerMessagesProvider: StreamMessageController;
|
|
18
|
-
videoElementProvider: VideoPlayer;
|
|
19
|
-
coordinateConverter: CoordinateConverter;
|
|
20
|
-
videoElementParentClientRect: DOMRect;
|
|
21
|
-
|
|
22
|
-
// Utility for keeping track of event handlers and to unregister them.
|
|
23
|
-
private touchEventListenerTracker = new EventListenerTracker();
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* @param toStreamerMessagesProvider - Stream message instance
|
|
27
|
-
* @param videoElementProvider - Video element instance
|
|
28
|
-
* @param coordinateConverter - A coordinate converter instance
|
|
29
|
-
*/
|
|
30
|
-
constructor(
|
|
31
|
-
toStreamerMessagesProvider: StreamMessageController,
|
|
32
|
-
videoElementProvider: VideoPlayer,
|
|
33
|
-
coordinateConverter: CoordinateConverter
|
|
34
|
-
) {
|
|
35
|
-
this.toStreamerMessagesProvider = toStreamerMessagesProvider;
|
|
36
|
-
this.videoElementProvider = videoElementProvider;
|
|
37
|
-
this.coordinateConverter = coordinateConverter;
|
|
38
|
-
const ontouchstart = (ev: TouchEvent) => this.onTouchStart(ev);
|
|
39
|
-
const ontouchend = (ev: TouchEvent) => this.onTouchEnd(ev);
|
|
40
|
-
const ontouchmove = (ev: TouchEvent) => this.onTouchMove(ev);
|
|
41
|
-
document.addEventListener('touchstart', ontouchstart, { passive: false });
|
|
42
|
-
document.addEventListener('touchend', ontouchend, { passive: false });
|
|
43
|
-
document.addEventListener('touchmove', ontouchmove, { passive: false });
|
|
44
|
-
this.touchEventListenerTracker.addUnregisterCallback(
|
|
45
|
-
() => document.removeEventListener('touchstart', ontouchstart)
|
|
46
|
-
);
|
|
47
|
-
this.touchEventListenerTracker.addUnregisterCallback(
|
|
48
|
-
() => document.removeEventListener('touchend', ontouchend)
|
|
49
|
-
);
|
|
50
|
-
this.touchEventListenerTracker.addUnregisterCallback(
|
|
51
|
-
() => document.removeEventListener('touchmove', ontouchmove)
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Unregister all touch events
|
|
57
|
-
*/
|
|
58
|
-
unregisterTouchEvents() {
|
|
59
|
-
this.touchEventListenerTracker.unregisterAll();
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Sets the video Element Parent Client Rect numbers for this class
|
|
64
|
-
* @param videoElementParentClientRect - a html ElementParentClientRect object
|
|
65
|
-
*/
|
|
66
|
-
setVideoElementParentClientRect(videoElementParentClientRect: DOMRect) {
|
|
67
|
-
this.videoElementParentClientRect = videoElementParentClientRect;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* When a touch event begins
|
|
72
|
-
* @param touch - the activating touch event
|
|
73
|
-
*/
|
|
74
|
-
onTouchStart(touch: TouchEvent): void {
|
|
75
|
-
if (!this.videoElementProvider.isVideoReady() || touch.target !== this.videoElementProvider.getVideoElement()) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
if (this.fakeTouchFinger == null) {
|
|
79
|
-
const first_touch = touch.changedTouches[0];
|
|
80
|
-
this.fakeTouchFinger = new FakeTouchFinger(
|
|
81
|
-
first_touch.identifier,
|
|
82
|
-
first_touch.clientX - this.videoElementParentClientRect.left,
|
|
83
|
-
first_touch.clientY - this.videoElementParentClientRect.top
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
const videoElementParent =
|
|
87
|
-
this.videoElementProvider.getVideoParentElement() as HTMLDivElement;
|
|
88
|
-
const mouseEvent = new MouseEvent('mouseenter', first_touch);
|
|
89
|
-
videoElementParent.dispatchEvent(mouseEvent);
|
|
90
|
-
|
|
91
|
-
const coord = this.coordinateConverter.normalizeAndQuantizeUnsigned(
|
|
92
|
-
this.fakeTouchFinger.x,
|
|
93
|
-
this.fakeTouchFinger.y
|
|
94
|
-
);
|
|
95
|
-
const toStreamerHandlers =
|
|
96
|
-
this.toStreamerMessagesProvider.toStreamerHandlers;
|
|
97
|
-
toStreamerHandlers.get('MouseDown')([
|
|
98
|
-
MouseButton.mainButton,
|
|
99
|
-
coord.x,
|
|
100
|
-
coord.y
|
|
101
|
-
]);
|
|
102
|
-
}
|
|
103
|
-
touch.preventDefault();
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* When a touch event ends
|
|
108
|
-
* @param touchEvent - the activating touch event
|
|
109
|
-
*/
|
|
110
|
-
onTouchEnd(touchEvent: TouchEvent): void {
|
|
111
|
-
if (!this.videoElementProvider.isVideoReady() || this.fakeTouchFinger == null) {
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
const videoElementParent =
|
|
115
|
-
this.videoElementProvider.getVideoParentElement();
|
|
116
|
-
const toStreamerHandlers =
|
|
117
|
-
this.toStreamerMessagesProvider.toStreamerHandlers;
|
|
118
|
-
|
|
119
|
-
for (let t = 0; t < touchEvent.changedTouches.length; t++) {
|
|
120
|
-
const touch = touchEvent.changedTouches[t];
|
|
121
|
-
if (touch.identifier === this.fakeTouchFinger.id) {
|
|
122
|
-
const x =
|
|
123
|
-
touch.clientX - this.videoElementParentClientRect.left;
|
|
124
|
-
const y = touch.clientY - this.videoElementParentClientRect.top;
|
|
125
|
-
const coord =
|
|
126
|
-
this.coordinateConverter.normalizeAndQuantizeUnsigned(x, y);
|
|
127
|
-
toStreamerHandlers.get('MouseUp')([
|
|
128
|
-
MouseButton.mainButton,
|
|
129
|
-
coord.x,
|
|
130
|
-
coord.y
|
|
131
|
-
]);
|
|
132
|
-
|
|
133
|
-
const mouseEvent = new MouseEvent('mouseleave', touch);
|
|
134
|
-
videoElementParent.dispatchEvent(mouseEvent);
|
|
135
|
-
this.fakeTouchFinger = null;
|
|
136
|
-
break;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
touchEvent.preventDefault();
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* On a Move touch event
|
|
144
|
-
* @param touchEvent - the activating touch event
|
|
145
|
-
*/
|
|
146
|
-
onTouchMove(touchEvent: TouchEvent): void {
|
|
147
|
-
if (!this.videoElementProvider.isVideoReady() || this.fakeTouchFinger == null) {
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
const toStreamerHandlers =
|
|
151
|
-
this.toStreamerMessagesProvider.toStreamerHandlers;
|
|
152
|
-
|
|
153
|
-
for (let t = 0; t < touchEvent.touches.length; t++) {
|
|
154
|
-
const touch = touchEvent.touches[t];
|
|
155
|
-
if (touch.identifier === this.fakeTouchFinger.id) {
|
|
156
|
-
const x =
|
|
157
|
-
touch.clientX - this.videoElementParentClientRect.left;
|
|
158
|
-
const y = touch.clientY - this.videoElementParentClientRect.top;
|
|
159
|
-
const coord =
|
|
160
|
-
this.coordinateConverter.normalizeAndQuantizeUnsigned(x, y);
|
|
161
|
-
const delta =
|
|
162
|
-
this.coordinateConverter.normalizeAndQuantizeSigned(
|
|
163
|
-
x - this.fakeTouchFinger.x,
|
|
164
|
-
y - this.fakeTouchFinger.y
|
|
165
|
-
);
|
|
166
|
-
toStreamerHandlers.get('MouseMove')([
|
|
167
|
-
coord.x,
|
|
168
|
-
coord.y,
|
|
169
|
-
delta.x,
|
|
170
|
-
delta.y
|
|
171
|
-
]);
|
|
172
|
-
this.fakeTouchFinger.x = x;
|
|
173
|
-
this.fakeTouchFinger.y = y;
|
|
174
|
-
break;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
touchEvent.preventDefault();
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* The interface for finger position mapping
|
|
183
|
-
*/
|
|
184
|
-
export class FakeTouchFinger {
|
|
185
|
-
id: number;
|
|
186
|
-
x: number;
|
|
187
|
-
y: number;
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* @param id - the button id
|
|
191
|
-
* @param x - the x axis value
|
|
192
|
-
* @param y - the y axis value
|
|
193
|
-
*/
|
|
194
|
-
constructor(id: number, x: number, y: number) {
|
|
195
|
-
this.id = id;
|
|
196
|
-
this.x = x;
|
|
197
|
-
this.y = y;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
2
|
-
|
|
3
|
-
import { MouseController } from './MouseController';
|
|
4
|
-
import { Logger } from '@epicgames-ps/lib-pixelstreamingcommon-ue5.5';
|
|
5
|
-
import { IMouseEvents } from './IMouseEvents';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Video Player mouse Hover handler
|
|
9
|
-
*/
|
|
10
|
-
export class HoveringMouseEvents implements IMouseEvents {
|
|
11
|
-
mouseController: MouseController;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @param mouseController - Mouse Controller instance
|
|
15
|
-
*/
|
|
16
|
-
constructor(mouseController: MouseController) {
|
|
17
|
-
this.mouseController = mouseController;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Unregister event handlers
|
|
22
|
-
*/
|
|
23
|
-
unregisterMouseEvents(): void {
|
|
24
|
-
// empty for HoveringMouseEvents implementation
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Handle the mouse move event, sends the mouse data to the UE Instance
|
|
29
|
-
* @param mouseEvent - Mouse Event
|
|
30
|
-
*/
|
|
31
|
-
updateMouseMovePosition(mouseEvent: MouseEvent) {
|
|
32
|
-
if (!this.mouseController.videoElementProvider.isVideoReady()) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
Logger.Log(Logger.GetStackTrace(), 'MouseMove', 6);
|
|
36
|
-
const coord =
|
|
37
|
-
this.mouseController.coordinateConverter.normalizeAndQuantizeUnsigned(
|
|
38
|
-
mouseEvent.offsetX,
|
|
39
|
-
mouseEvent.offsetY
|
|
40
|
-
);
|
|
41
|
-
const delta =
|
|
42
|
-
this.mouseController.coordinateConverter.normalizeAndQuantizeSigned(
|
|
43
|
-
mouseEvent.movementX,
|
|
44
|
-
mouseEvent.movementY
|
|
45
|
-
);
|
|
46
|
-
const toStreamerHandlers =
|
|
47
|
-
this.mouseController.toStreamerMessagesProvider.toStreamerHandlers;
|
|
48
|
-
toStreamerHandlers.get('MouseMove')([
|
|
49
|
-
coord.x,
|
|
50
|
-
coord.y,
|
|
51
|
-
delta.x,
|
|
52
|
-
delta.y
|
|
53
|
-
]);
|
|
54
|
-
mouseEvent.preventDefault();
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Handle the mouse Down event, sends the mouse data to the UE Instance
|
|
59
|
-
* @param mouseEvent - Mouse Event
|
|
60
|
-
*/
|
|
61
|
-
handleMouseDown(mouseEvent: MouseEvent) {
|
|
62
|
-
if (!this.mouseController.videoElementProvider.isVideoReady()) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
Logger.Log(Logger.GetStackTrace(), 'onMouse Down', 6);
|
|
66
|
-
const coord =
|
|
67
|
-
this.mouseController.coordinateConverter.normalizeAndQuantizeUnsigned(
|
|
68
|
-
mouseEvent.offsetX,
|
|
69
|
-
mouseEvent.offsetY
|
|
70
|
-
);
|
|
71
|
-
const toStreamerHandlers =
|
|
72
|
-
this.mouseController.toStreamerMessagesProvider.toStreamerHandlers;
|
|
73
|
-
toStreamerHandlers.get('MouseDown')([
|
|
74
|
-
mouseEvent.button,
|
|
75
|
-
coord.x,
|
|
76
|
-
coord.y
|
|
77
|
-
]);
|
|
78
|
-
mouseEvent.preventDefault();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Handle the mouse Up event, sends the mouse data to the UE Instance
|
|
83
|
-
* @param mouseEvent - Mouse Event
|
|
84
|
-
*/
|
|
85
|
-
handleMouseUp(mouseEvent: MouseEvent) {
|
|
86
|
-
if (!this.mouseController.videoElementProvider.isVideoReady()) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
Logger.Log(Logger.GetStackTrace(), 'onMouse Up', 6);
|
|
90
|
-
const coord =
|
|
91
|
-
this.mouseController.coordinateConverter.normalizeAndQuantizeUnsigned(
|
|
92
|
-
mouseEvent.offsetX,
|
|
93
|
-
mouseEvent.offsetY
|
|
94
|
-
);
|
|
95
|
-
const toStreamerHandlers =
|
|
96
|
-
this.mouseController.toStreamerMessagesProvider.toStreamerHandlers;
|
|
97
|
-
toStreamerHandlers.get('MouseUp')([
|
|
98
|
-
mouseEvent.button,
|
|
99
|
-
coord.x,
|
|
100
|
-
coord.y
|
|
101
|
-
]);
|
|
102
|
-
mouseEvent.preventDefault();
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Consumes the mouse context event. The UE instance has no equivalent and doesn't need to be informed.
|
|
107
|
-
* @param mouseEvent - Mouse Event
|
|
108
|
-
*/
|
|
109
|
-
handleContextMenu(mouseEvent: MouseEvent) {
|
|
110
|
-
if (!this.mouseController.videoElementProvider.isVideoReady()) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
mouseEvent.preventDefault();
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Handle the mouse wheel event, sends the mouse wheel data to the UE Instance
|
|
118
|
-
* @param wheelEvent - Mouse Event
|
|
119
|
-
*/
|
|
120
|
-
handleMouseWheel(wheelEvent: WheelEvent) {
|
|
121
|
-
if (!this.mouseController.videoElementProvider.isVideoReady()) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
const coord =
|
|
125
|
-
this.mouseController.coordinateConverter.normalizeAndQuantizeUnsigned(
|
|
126
|
-
wheelEvent.offsetX,
|
|
127
|
-
wheelEvent.offsetY
|
|
128
|
-
);
|
|
129
|
-
const toStreamerHandlers =
|
|
130
|
-
this.mouseController.toStreamerMessagesProvider.toStreamerHandlers;
|
|
131
|
-
toStreamerHandlers.get('MouseWheel')([
|
|
132
|
-
wheelEvent.wheelDelta,
|
|
133
|
-
coord.x,
|
|
134
|
-
coord.y
|
|
135
|
-
]);
|
|
136
|
-
wheelEvent.preventDefault();
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Handle the mouse double click event, sends the mouse data to the UE Instance
|
|
141
|
-
* @param mouseEvent - Mouse Event
|
|
142
|
-
*/
|
|
143
|
-
handleMouseDouble(mouseEvent: MouseEvent) {
|
|
144
|
-
if (!this.mouseController.videoElementProvider.isVideoReady()) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
const coord =
|
|
148
|
-
this.mouseController.coordinateConverter.normalizeAndQuantizeUnsigned(
|
|
149
|
-
mouseEvent.offsetX,
|
|
150
|
-
mouseEvent.offsetY
|
|
151
|
-
);
|
|
152
|
-
const toStreamerHandlers =
|
|
153
|
-
this.mouseController.toStreamerMessagesProvider.toStreamerHandlers;
|
|
154
|
-
toStreamerHandlers.get('MouseDouble')([
|
|
155
|
-
mouseEvent.button,
|
|
156
|
-
coord.x,
|
|
157
|
-
coord.y
|
|
158
|
-
]);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Handle the press mouse buttons event, sends the mouse data to the UE Instance
|
|
163
|
-
* @param mouseEvent - Mouse Event
|
|
164
|
-
*/
|
|
165
|
-
handlePressMouseButtons(mouseEvent: MouseEvent) {
|
|
166
|
-
if (!this.mouseController.videoElementProvider.isVideoReady()) {
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
Logger.Log(Logger.GetStackTrace(), 'onMouse press', 6);
|
|
170
|
-
this.mouseController.pressMouseButtons(
|
|
171
|
-
mouseEvent.buttons,
|
|
172
|
-
mouseEvent.offsetX,
|
|
173
|
-
mouseEvent.offsetY
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Handle the release mouse buttons event, sends the mouse data to the UE Instance
|
|
179
|
-
* @param mouseEvent - Mouse Event
|
|
180
|
-
*/
|
|
181
|
-
handleReleaseMouseButtons(mouseEvent: MouseEvent) {
|
|
182
|
-
if (!this.mouseController.videoElementProvider.isVideoReady()) {
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
Logger.Log(Logger.GetStackTrace(), 'onMouse release', 6);
|
|
186
|
-
this.mouseController.releaseMouseButtons(
|
|
187
|
-
mouseEvent.buttons,
|
|
188
|
-
mouseEvent.offsetX,
|
|
189
|
-
mouseEvent.offsetY
|
|
190
|
-
);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Interface for Mouse Events
|
|
5
|
-
*/
|
|
6
|
-
export interface IMouseEvents {
|
|
7
|
-
/**
|
|
8
|
-
* Handle when the locked state Changed
|
|
9
|
-
*/
|
|
10
|
-
lockStateChange?(): void;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Handle when the mouse move
|
|
14
|
-
* @param mouseEvent - Mouse Event
|
|
15
|
-
*/
|
|
16
|
-
updateMouseMovePosition?(mouseEvent: MouseEvent): void;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Handle when the Button Down
|
|
20
|
-
* @param mouseEvent - Mouse Event
|
|
21
|
-
*/
|
|
22
|
-
handleMouseDown(mouseEvent: MouseEvent): void;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Handle when the button up
|
|
26
|
-
* @param mouseEvent - Mouse Event
|
|
27
|
-
*/
|
|
28
|
-
handleMouseUp(mouseEvent: MouseEvent): void;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Handle when the mouse wheel
|
|
32
|
-
* @param wheelEvent - Mouse wheel
|
|
33
|
-
*/
|
|
34
|
-
handleMouseWheel(wheelEvent: WheelEvent): void;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Handle when the button double click
|
|
38
|
-
* @param mouseEvent - Mouse Event
|
|
39
|
-
*/
|
|
40
|
-
handleMouseDouble(mouseEvent: MouseEvent): void;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Handle the press mouse buttons event, sends the mouse data to the UE Instance
|
|
44
|
-
* @param mouseEvent - Mouse Event
|
|
45
|
-
*/
|
|
46
|
-
handlePressMouseButtons(mouseEvent: MouseEvent): void;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Handle the release mouse buttons event, sends the mouse data to the UE Instance
|
|
50
|
-
* @param mouseEvent - Mouse Event
|
|
51
|
-
*/
|
|
52
|
-
handleReleaseMouseButtons(mouseEvent: MouseEvent): void;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Handle the mouse context menu
|
|
56
|
-
* @param mouseEvent - mouse event
|
|
57
|
-
*/
|
|
58
|
-
handleContextMenu?(mouseEvent: MouseEvent): void;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Unregister any registered mouse event handlers
|
|
62
|
-
*/
|
|
63
|
-
unregisterMouseEvents(): void;
|
|
64
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Interface for Touch Events
|
|
5
|
-
*/
|
|
6
|
-
export interface ITouchController {
|
|
7
|
-
/**
|
|
8
|
-
* Fire when a touch event starts
|
|
9
|
-
* @param touchEvent - Touch Event Data
|
|
10
|
-
*/
|
|
11
|
-
onTouchStart(touchEvent: TouchEvent): void;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Fire when a touch event ends
|
|
15
|
-
* @param touchEvent - Touch Event Data
|
|
16
|
-
*/
|
|
17
|
-
onTouchEnd(touchEvent: TouchEvent): void;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Fire when touch moves
|
|
21
|
-
* @param touchEvent - Touch Event Data
|
|
22
|
-
*/
|
|
23
|
-
onTouchMove(touchEvent: TouchEvent): void;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Unregister all touch event handlers.
|
|
27
|
-
*/
|
|
28
|
-
unregisterTouchEvents(): void;
|
|
29
|
-
}
|