@3dsource/angular-unreal-module 0.0.135 → 0.0.136
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.
|
@@ -4534,6 +4534,15 @@ const RESIZE_DEBOUNCE_MS = 300;
|
|
|
4534
4534
|
const FUNCTION_KEY_MIN = 112;
|
|
4535
4535
|
const FUNCTION_KEY_MAX = 123;
|
|
4536
4536
|
const TAB_KEY_CODE = 9;
|
|
4537
|
+
// Browser-destructive / navigation keys (Backspace can navigate back, Enter and
|
|
4538
|
+
// Delete leak into the stream). These are ignored in the viewport regardless of
|
|
4539
|
+
// dev mode — unless an HTML input is focused — to match non-dev-mode behavior.
|
|
4540
|
+
const BROWSER_DESTRUCTIVE_CODES = new Set([
|
|
4541
|
+
'Backspace',
|
|
4542
|
+
'Delete',
|
|
4543
|
+
'Enter',
|
|
4544
|
+
'NumpadEnter',
|
|
4545
|
+
]);
|
|
4537
4546
|
class InputService extends SubService {
|
|
4538
4547
|
constructor() {
|
|
4539
4548
|
super();
|
|
@@ -4959,12 +4968,22 @@ class InputService extends SubService {
|
|
|
4959
4968
|
};
|
|
4960
4969
|
this.startListenKeys(keyBlock);
|
|
4961
4970
|
}
|
|
4971
|
+
/**
|
|
4972
|
+
* Keys that must never reach the Unreal stream from the viewport — Backspace
|
|
4973
|
+
* (browser back navigation), Enter and Delete — regardless of dev mode. An
|
|
4974
|
+
* HTML input keeps them so text entry still works; only the viewport ignores
|
|
4975
|
+
* them. Applied independently of the configurable key filter.
|
|
4976
|
+
*/
|
|
4977
|
+
isIgnoredViewportKey(event) {
|
|
4978
|
+
const isInputFieldFocused = event.target?.localName === 'input';
|
|
4979
|
+
return !isInputFieldFocused && BROWSER_DESTRUCTIVE_CODES.has(event.code);
|
|
4980
|
+
}
|
|
4962
4981
|
startListenKeys(_filter) {
|
|
4963
4982
|
const filter = _filter ?? (() => false);
|
|
4964
4983
|
fromEvent(document, 'keydown')
|
|
4965
4984
|
.pipe(takeUntil$1(this.deactivatedVideoTrigger$))
|
|
4966
4985
|
.subscribe((e) => {
|
|
4967
|
-
if (filter(e)) {
|
|
4986
|
+
if (this.isIgnoredViewportKey(e) || filter(e)) {
|
|
4968
4987
|
return;
|
|
4969
4988
|
}
|
|
4970
4989
|
const isCtrlOrCommand = e.ctrlKey || e.metaKey;
|
|
@@ -4978,14 +4997,6 @@ class InputService extends SubService {
|
|
|
4978
4997
|
keyDown[1] = this.getKeyCode(e);
|
|
4979
4998
|
keyDown[2] = Number(e.repeat);
|
|
4980
4999
|
this.sendInputData(keyDown.buffer);
|
|
4981
|
-
// Backspace isn't a keypress in JS, but UE4 text-entry fields need it
|
|
4982
|
-
// to delete characters.
|
|
4983
|
-
if (e.keyCode === SpecialKeyCodes.BackSpace) {
|
|
4984
|
-
const data = this.keyPressView;
|
|
4985
|
-
data.setUint8(0, MessageType.KeyPress);
|
|
4986
|
-
data.setUint16(1, SpecialKeyCodes.BackSpace, true);
|
|
4987
|
-
this.sendInputData(data.buffer);
|
|
4988
|
-
}
|
|
4989
5000
|
if (this.options.suppressBrowserKeys &&
|
|
4990
5001
|
this.isKeyCodeBrowserKey(e.keyCode)) {
|
|
4991
5002
|
e.preventDefault();
|
|
@@ -4994,7 +5005,7 @@ class InputService extends SubService {
|
|
|
4994
5005
|
fromEvent(document, 'keyup')
|
|
4995
5006
|
.pipe(takeUntil$1(this.deactivatedVideoTrigger$))
|
|
4996
5007
|
.subscribe((e) => {
|
|
4997
|
-
if (filter(e)) {
|
|
5008
|
+
if (this.isIgnoredViewportKey(e) || filter(e)) {
|
|
4998
5009
|
return;
|
|
4999
5010
|
}
|
|
5000
5011
|
const keyUp = this.keyUpBytes;
|
|
@@ -5009,7 +5020,7 @@ class InputService extends SubService {
|
|
|
5009
5020
|
fromEvent(document, 'keypress')
|
|
5010
5021
|
.pipe(takeUntil$1(this.deactivatedVideoTrigger$))
|
|
5011
5022
|
.subscribe((e) => {
|
|
5012
|
-
if (filter(e)) {
|
|
5023
|
+
if (this.isIgnoredViewportKey(e) || filter(e)) {
|
|
5013
5024
|
return;
|
|
5014
5025
|
}
|
|
5015
5026
|
const data = this.keyPressView;
|