@onerjs/core 8.51.3 → 8.51.4
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/Animations/animationGroup.d.ts +2 -1
- package/Animations/animationGroup.js +3 -2
- package/Animations/animationGroup.js.map +1 -1
- package/Engines/WebGPU/webgpuSnapshotRendering.js +7 -3
- package/Engines/WebGPU/webgpuSnapshotRendering.js.map +1 -1
- package/Events/deviceInputEvents.d.ts +5 -0
- package/Events/deviceInputEvents.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.d.ts +65 -0
- package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.js +74 -0
- package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.js.map +1 -0
- package/FlowGraph/Blocks/Data/index.d.ts +1 -0
- package/FlowGraph/Blocks/Data/index.js +1 -0
- package/FlowGraph/Blocks/Data/index.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.d.ts +39 -0
- package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.js +42 -0
- package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.js.map +1 -0
- package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.d.ts +19 -0
- package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.js +25 -0
- package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.js.map +1 -0
- package/FlowGraph/Blocks/Event/flowGraphKeyboardEventBlock.d.ts +64 -0
- package/FlowGraph/Blocks/Event/flowGraphKeyboardEventBlock.js +50 -0
- package/FlowGraph/Blocks/Event/flowGraphKeyboardEventBlock.js.map +1 -0
- package/FlowGraph/Blocks/Event/index.d.ts +3 -0
- package/FlowGraph/Blocks/Event/index.js +3 -0
- package/FlowGraph/Blocks/Event/index.js.map +1 -1
- package/FlowGraph/Blocks/flowGraphBlockFactory.js +7 -0
- package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
- package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +3 -0
- package/FlowGraph/Blocks/flowGraphBlockNames.js +3 -0
- package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -1
- package/FlowGraph/flowGraph.d.ts +6 -0
- package/FlowGraph/flowGraph.js +10 -1
- package/FlowGraph/flowGraph.js.map +1 -1
- package/FlowGraph/flowGraphContext.d.ts +8 -0
- package/FlowGraph/flowGraphContext.js.map +1 -1
- package/FlowGraph/flowGraphEventType.d.ts +2 -0
- package/FlowGraph/flowGraphEventType.js +2 -0
- package/FlowGraph/flowGraphEventType.js.map +1 -1
- package/FlowGraph/flowGraphSceneEventCoordinator.d.ts +14 -0
- package/FlowGraph/flowGraphSceneEventCoordinator.js +56 -0
- package/FlowGraph/flowGraphSceneEventCoordinator.js.map +1 -1
- package/FlowGraph/utils.d.ts +7 -0
- package/FlowGraph/utils.js +8 -0
- package/FlowGraph/utils.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +6 -0
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js +30 -8
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js.map +1 -1
- package/Misc/snapshotRenderingHelper.d.ts +4 -2
- package/Misc/snapshotRenderingHelper.js +33 -22
- package/Misc/snapshotRenderingHelper.js.map +1 -1
- package/Particles/thinParticleSystem.d.ts +6 -1
- package/Particles/thinParticleSystem.js +23 -6
- package/Particles/thinParticleSystem.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { FlowGraphBlock } from "../../flowGraphBlock.js";
|
|
2
|
+
import { RegisterClass } from "../../../Misc/typeStore.js";
|
|
3
|
+
import { RichTypeBoolean, RichTypeString } from "../../flowGraphRichTypes.js";
|
|
4
|
+
/**
|
|
5
|
+
* A data block that outputs whether a specific keyboard key is currently pressed,
|
|
6
|
+
* optionally requiring one or more modifier keys to also be held.
|
|
7
|
+
*
|
|
8
|
+
* This block queries the scene event coordinator's `pressedKeys` set,
|
|
9
|
+
* which is updated in real-time by the keyboard observers. It is designed
|
|
10
|
+
* to be polled every frame (e.g. from a Scene Tick event chain) but can
|
|
11
|
+
* also be read on demand from any execution context.
|
|
12
|
+
*
|
|
13
|
+
* The `key` input uses `KeyboardEvent.code` values (e.g. "KeyA", "Space",
|
|
14
|
+
* "ShiftLeft", "ControlLeft", "AltLeft", "MetaLeft" for Mac Cmd).
|
|
15
|
+
*
|
|
16
|
+
* Modifier inputs (`withShift`, `withCtrl`, `withAlt`, `withMeta`,
|
|
17
|
+
* `withCommandOrCtrl`) default to false. Set any to true to require that
|
|
18
|
+
* modifier to also be held for `isPressed` to be true.
|
|
19
|
+
* For example, key = "KeyA" + withCommandOrCtrl = true checks for
|
|
20
|
+
* Cmd+A on macOS or Ctrl+A on Windows/Linux.
|
|
21
|
+
*/
|
|
22
|
+
export class FlowGraphIsKeyPressedBlock extends FlowGraphBlock {
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new FlowGraphIsKeyPressedBlock.
|
|
25
|
+
* @param config optional configuration
|
|
26
|
+
*/
|
|
27
|
+
constructor(config) {
|
|
28
|
+
super(config);
|
|
29
|
+
this.key = this.registerDataInput("key", RichTypeString);
|
|
30
|
+
this.withShift = this.registerDataInput("withShift", RichTypeBoolean);
|
|
31
|
+
this.withCtrl = this.registerDataInput("withCtrl", RichTypeBoolean);
|
|
32
|
+
this.withAlt = this.registerDataInput("withAlt", RichTypeBoolean);
|
|
33
|
+
this.withMeta = this.registerDataInput("withMeta", RichTypeBoolean);
|
|
34
|
+
this.withCommandOrCtrl = this.registerDataInput("withCommandOrCtrl", RichTypeBoolean);
|
|
35
|
+
this.isPressed = this.registerDataOutput("isPressed", RichTypeBoolean);
|
|
36
|
+
}
|
|
37
|
+
/** @internal */
|
|
38
|
+
_updateOutputs(context) {
|
|
39
|
+
const coordinator = context.configuration.sceneEventCoordinator;
|
|
40
|
+
if (!coordinator) {
|
|
41
|
+
this.isPressed.setValue(false, context);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const keys = coordinator.pressedKeys;
|
|
45
|
+
const keyCode = this.key.getValue(context);
|
|
46
|
+
// Primary key must be held (unless empty, in which case only modifiers are checked)
|
|
47
|
+
let pressed = keyCode ? keys.has(keyCode) : true;
|
|
48
|
+
// Check required modifiers
|
|
49
|
+
if (pressed && this.withShift.getValue(context)) {
|
|
50
|
+
pressed = keys.has("ShiftLeft") || keys.has("ShiftRight");
|
|
51
|
+
}
|
|
52
|
+
if (pressed && this.withCtrl.getValue(context)) {
|
|
53
|
+
pressed = keys.has("ControlLeft") || keys.has("ControlRight");
|
|
54
|
+
}
|
|
55
|
+
if (pressed && this.withAlt.getValue(context)) {
|
|
56
|
+
pressed = keys.has("AltLeft") || keys.has("AltRight");
|
|
57
|
+
}
|
|
58
|
+
if (pressed && this.withMeta.getValue(context)) {
|
|
59
|
+
pressed = keys.has("MetaLeft") || keys.has("MetaRight");
|
|
60
|
+
}
|
|
61
|
+
if (pressed && this.withCommandOrCtrl.getValue(context)) {
|
|
62
|
+
pressed = keys.has("CommandOrControl");
|
|
63
|
+
}
|
|
64
|
+
this.isPressed.setValue(pressed, context);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* @returns class name of the block.
|
|
68
|
+
*/
|
|
69
|
+
getClassName() {
|
|
70
|
+
return "FlowGraphIsKeyPressedBlock" /* FlowGraphBlockNames.IsKeyPressed */;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
RegisterClass("FlowGraphIsKeyPressedBlock" /* FlowGraphBlockNames.IsKeyPressed */, FlowGraphIsKeyPressedBlock);
|
|
74
|
+
//# sourceMappingURL=flowGraphIsKeyPressedBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowGraphIsKeyPressedBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Data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,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED;;OAEG;IACa,YAAY;QACxB,2EAAwC;IAC5C,CAAC;CACJ;AACD,aAAa,sEAAmC,0BAA0B,CAAC,CAAC","sourcesContent":["import { FlowGraphBlock, type IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport { type FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\nimport { FlowGraphBlockNames } from \"../flowGraphBlockNames\";\nimport { type FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection\";\nimport { RichTypeBoolean, RichTypeString } from \"core/FlowGraph/flowGraphRichTypes\";\n\n/**\n * A data block that outputs whether a specific keyboard key is currently pressed,\n * optionally requiring one or more modifier keys to also be held.\n *\n * This block queries the scene event coordinator's `pressedKeys` set,\n * which is updated in real-time by the keyboard observers. It is designed\n * to be polled every frame (e.g. from a Scene Tick event chain) but can\n * also be read on demand from any execution context.\n *\n * The `key` input uses `KeyboardEvent.code` values (e.g. \"KeyA\", \"Space\",\n * \"ShiftLeft\", \"ControlLeft\", \"AltLeft\", \"MetaLeft\" for Mac Cmd).\n *\n * Modifier inputs (`withShift`, `withCtrl`, `withAlt`, `withMeta`,\n * `withCommandOrCtrl`) default to false. Set any to true to require that\n * modifier to also be held for `isPressed` to be true.\n * For example, key = \"KeyA\" + withCommandOrCtrl = true checks for\n * Cmd+A on macOS or Ctrl+A on Windows/Linux.\n */\nexport class FlowGraphIsKeyPressedBlock extends FlowGraphBlock {\n /**\n * Input connection: the `KeyboardEvent.code` of the key to check\n * (e.g. \"KeyA\", \"Space\", \"ShiftLeft\").\n */\n public readonly key: FlowGraphDataConnection<string>;\n\n /**\n * Input connection: when true, Shift must also be held.\n */\n public readonly withShift: FlowGraphDataConnection<boolean>;\n\n /**\n * Input connection: when true, Ctrl must also be held.\n */\n public readonly withCtrl: FlowGraphDataConnection<boolean>;\n\n /**\n * Input connection: when true, Alt (Option on macOS) must also be held.\n */\n public readonly withAlt: FlowGraphDataConnection<boolean>;\n\n /**\n * Input connection: when true, Meta (Win key / Cmd) must also be held.\n */\n public readonly withMeta: FlowGraphDataConnection<boolean>;\n\n /**\n * Input connection: when true, the platform-appropriate \"command\" modifier\n * must also be held (Cmd on macOS, Ctrl on Windows/Linux).\n * This uses the virtual \"CommandOrControl\" key tracked by the coordinator.\n */\n public readonly withCommandOrCtrl: FlowGraphDataConnection<boolean>;\n\n /**\n * Output connection: true if the key (and all required modifiers) are currently held down.\n */\n public readonly isPressed: FlowGraphDataConnection<boolean>;\n\n /**\n * Creates a new FlowGraphIsKeyPressedBlock.\n * @param config optional configuration\n */\n public constructor(config?: IFlowGraphBlockConfiguration) {\n super(config);\n this.key = this.registerDataInput(\"key\", RichTypeString);\n this.withShift = this.registerDataInput(\"withShift\", RichTypeBoolean);\n this.withCtrl = this.registerDataInput(\"withCtrl\", RichTypeBoolean);\n this.withAlt = this.registerDataInput(\"withAlt\", RichTypeBoolean);\n this.withMeta = this.registerDataInput(\"withMeta\", RichTypeBoolean);\n this.withCommandOrCtrl = this.registerDataInput(\"withCommandOrCtrl\", RichTypeBoolean);\n this.isPressed = this.registerDataOutput(\"isPressed\", RichTypeBoolean);\n }\n\n /** @internal */\n public override _updateOutputs(context: FlowGraphContext): void {\n const coordinator = context.configuration.sceneEventCoordinator;\n if (!coordinator) {\n this.isPressed.setValue(false, context);\n return;\n }\n const keys = coordinator.pressedKeys;\n const keyCode = this.key.getValue(context);\n\n // Primary key must be held (unless empty, in which case only modifiers are checked)\n let pressed = keyCode ? keys.has(keyCode) : true;\n\n // Check required modifiers\n if (pressed && this.withShift.getValue(context)) {\n pressed = keys.has(\"ShiftLeft\") || keys.has(\"ShiftRight\");\n }\n if (pressed && this.withCtrl.getValue(context)) {\n pressed = keys.has(\"ControlLeft\") || keys.has(\"ControlRight\");\n }\n if (pressed && this.withAlt.getValue(context)) {\n pressed = keys.has(\"AltLeft\") || keys.has(\"AltRight\");\n }\n if (pressed && this.withMeta.getValue(context)) {\n pressed = keys.has(\"MetaLeft\") || keys.has(\"MetaRight\");\n }\n if (pressed && this.withCommandOrCtrl.getValue(context)) {\n pressed = keys.has(\"CommandOrControl\");\n }\n\n this.isPressed.setValue(pressed, context);\n }\n\n /**\n * @returns class name of the block.\n */\n public override getClassName(): string {\n return FlowGraphBlockNames.IsKeyPressed;\n }\n}\nRegisterClass(FlowGraphBlockNames.IsKeyPressed, FlowGraphIsKeyPressedBlock);\n"]}
|
|
@@ -7,6 +7,7 @@ export * from "../Execution/flowGraphSetPropertyBlock.js";
|
|
|
7
7
|
export * from "./flowGraphConstantBlock.js";
|
|
8
8
|
export * from "./flowGraphGetAssetBlock.js";
|
|
9
9
|
export * from "./flowGraphDataSwitchBlock.js";
|
|
10
|
+
export * from "./flowGraphIsKeyPressedBlock.js";
|
|
10
11
|
export * from "./Math/index.js";
|
|
11
12
|
export * from "./Transformers/index.js";
|
|
12
13
|
export * from "./Utils/index.js";
|
|
@@ -7,6 +7,7 @@ export * from "../Execution/flowGraphSetPropertyBlock.js";
|
|
|
7
7
|
export * from "./flowGraphConstantBlock.js";
|
|
8
8
|
export * from "./flowGraphGetAssetBlock.js";
|
|
9
9
|
export * from "./flowGraphDataSwitchBlock.js";
|
|
10
|
+
export * from "./flowGraphIsKeyPressedBlock.js";
|
|
10
11
|
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
11
12
|
export * from "./Math/index.js";
|
|
12
13
|
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Data/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wCAAwC,CAAC;AACvD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wCAAwC,CAAC;AACvD,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,oEAAoE;AACpE,cAAc,cAAc,CAAC;AAC7B,oEAAoE;AACpE,cAAc,sBAAsB,CAAC;AACrC,oEAAoE;AACpE,cAAc,eAAe,CAAC;AAC9B,oEAAoE;AACpE,cAAc,iBAAiB,CAAC;AAChC,oEAAoE;AACpE,cAAc,eAAe,CAAC","sourcesContent":["export * from \"./flowGraphConditionalDataBlock\";\r\nexport * from \"./flowGraphGetVariableBlock\";\r\nexport * from \"../Execution/flowGraphSetVariableBlock\";\r\nexport * from \"./flowGraphTransformCoordinatesSystemBlock\";\r\nexport * from \"./flowGraphGetPropertyBlock\";\r\nexport * from \"../Execution/flowGraphSetPropertyBlock\";\r\nexport * from \"./flowGraphConstantBlock\";\r\nexport * from \"./flowGraphGetAssetBlock\";\r\nexport * from \"./flowGraphDataSwitchBlock\";\r\n// eslint-disable-next-line @typescript-eslint/no-restricted-imports\r\nexport * from \"./Math/index\";\r\n// eslint-disable-next-line @typescript-eslint/no-restricted-imports\r\nexport * from \"./Transformers/index\";\r\n// eslint-disable-next-line @typescript-eslint/no-restricted-imports\r\nexport * from \"./Utils/index\";\r\n// eslint-disable-next-line @typescript-eslint/no-restricted-imports\r\nexport * from \"./Physics/index\";\r\n// eslint-disable-next-line @typescript-eslint/no-restricted-imports\r\nexport * from \"./Audio/index\";\r\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Data/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wCAAwC,CAAC;AACvD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wCAAwC,CAAC;AACvD,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,oEAAoE;AACpE,cAAc,cAAc,CAAC;AAC7B,oEAAoE;AACpE,cAAc,sBAAsB,CAAC;AACrC,oEAAoE;AACpE,cAAc,eAAe,CAAC;AAC9B,oEAAoE;AACpE,cAAc,iBAAiB,CAAC;AAChC,oEAAoE;AACpE,cAAc,eAAe,CAAC","sourcesContent":["export * from \"./flowGraphConditionalDataBlock\";\r\nexport * from \"./flowGraphGetVariableBlock\";\r\nexport * from \"../Execution/flowGraphSetVariableBlock\";\r\nexport * from \"./flowGraphTransformCoordinatesSystemBlock\";\r\nexport * from \"./flowGraphGetPropertyBlock\";\r\nexport * from \"../Execution/flowGraphSetPropertyBlock\";\r\nexport * from \"./flowGraphConstantBlock\";\r\nexport * from \"./flowGraphGetAssetBlock\";\r\nexport * from \"./flowGraphDataSwitchBlock\";\r\nexport * from \"./flowGraphIsKeyPressedBlock\";\r\n// eslint-disable-next-line @typescript-eslint/no-restricted-imports\r\nexport * from \"./Math/index\";\r\n// eslint-disable-next-line @typescript-eslint/no-restricted-imports\r\nexport * from \"./Transformers/index\";\r\n// eslint-disable-next-line @typescript-eslint/no-restricted-imports\r\nexport * from \"./Utils/index\";\r\n// eslint-disable-next-line @typescript-eslint/no-restricted-imports\r\nexport * from \"./Physics/index\";\r\n// eslint-disable-next-line @typescript-eslint/no-restricted-imports\r\nexport * from \"./Audio/index\";\r\n"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type KeyboardInfo } from "../../../Events/keyboardEvents.js";
|
|
2
|
+
import { type FlowGraphContext } from "../../flowGraphContext.js";
|
|
3
|
+
import { type FlowGraphDataConnection } from "../../flowGraphDataConnection.js";
|
|
4
|
+
import { FlowGraphEventType } from "../../flowGraphEventType.js";
|
|
5
|
+
import { FlowGraphKeyboardEventBlock, type IFlowGraphKeyboardEventBlockConfiguration } from "./flowGraphKeyboardEventBlock.js";
|
|
6
|
+
/**
|
|
7
|
+
* Configuration for the key down event block.
|
|
8
|
+
*/
|
|
9
|
+
export interface IFlowGraphKeyDownEventBlockConfiguration extends IFlowGraphKeyboardEventBlockConfiguration {
|
|
10
|
+
/**
|
|
11
|
+
* When true, auto-repeat key-down events (the user holding a key) are
|
|
12
|
+
* ignored and only the initial press fires the block. Defaults to false.
|
|
13
|
+
*/
|
|
14
|
+
ignoreRepeat?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A keyboard event block that fires when a key is pressed down.
|
|
18
|
+
* Extends {@link FlowGraphKeyboardEventBlock} with an `isRepeat` output
|
|
19
|
+
* and an `ignoreRepeat` configuration option.
|
|
20
|
+
*/
|
|
21
|
+
export declare class FlowGraphKeyDownEventBlock extends FlowGraphKeyboardEventBlock {
|
|
22
|
+
/**
|
|
23
|
+
* Output connection: whether this is an auto-repeat event (key held down).
|
|
24
|
+
*/
|
|
25
|
+
readonly isRepeat: FlowGraphDataConnection<boolean>;
|
|
26
|
+
/** @internal */
|
|
27
|
+
readonly type: FlowGraphEventType;
|
|
28
|
+
/**
|
|
29
|
+
* Creates a new FlowGraphKeyDownEventBlock.
|
|
30
|
+
* @param config optional configuration
|
|
31
|
+
*/
|
|
32
|
+
constructor(config?: IFlowGraphKeyDownEventBlockConfiguration);
|
|
33
|
+
/** @internal */
|
|
34
|
+
_executeEvent(context: FlowGraphContext, keyboardInfo: KeyboardInfo): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* @returns class name of the block.
|
|
37
|
+
*/
|
|
38
|
+
getClassName(): string;
|
|
39
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { RegisterClass } from "../../../Misc/typeStore.js";
|
|
2
|
+
import { RichTypeBoolean } from "../../flowGraphRichTypes.js";
|
|
3
|
+
import { FlowGraphKeyboardEventBlock } from "./flowGraphKeyboardEventBlock.js";
|
|
4
|
+
/**
|
|
5
|
+
* A keyboard event block that fires when a key is pressed down.
|
|
6
|
+
* Extends {@link FlowGraphKeyboardEventBlock} with an `isRepeat` output
|
|
7
|
+
* and an `ignoreRepeat` configuration option.
|
|
8
|
+
*/
|
|
9
|
+
export class FlowGraphKeyDownEventBlock extends FlowGraphKeyboardEventBlock {
|
|
10
|
+
/**
|
|
11
|
+
* Creates a new FlowGraphKeyDownEventBlock.
|
|
12
|
+
* @param config optional configuration
|
|
13
|
+
*/
|
|
14
|
+
constructor(config) {
|
|
15
|
+
super(config);
|
|
16
|
+
/** @internal */
|
|
17
|
+
this.type = "KeyDown" /* FlowGraphEventType.KeyDown */;
|
|
18
|
+
this.isRepeat = this.registerDataOutput("isRepeat", RichTypeBoolean);
|
|
19
|
+
}
|
|
20
|
+
/** @internal */
|
|
21
|
+
_executeEvent(context, keyboardInfo) {
|
|
22
|
+
const repeat = keyboardInfo.event.repeat ?? false;
|
|
23
|
+
// Skip auto-repeat events when configured to do so.
|
|
24
|
+
if (repeat && this.config?.ignoreRepeat) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
// Set the repeat output before delegating to the base class,
|
|
28
|
+
// which calls _execute() and fires signals — downstream blocks
|
|
29
|
+
// must see the correct value during that execution chain.
|
|
30
|
+
this.isRepeat.setValue(repeat, context);
|
|
31
|
+
// Delegate to the base class for key filtering, output population, and execution.
|
|
32
|
+
return super._executeEvent(context, keyboardInfo);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @returns class name of the block.
|
|
36
|
+
*/
|
|
37
|
+
getClassName() {
|
|
38
|
+
return "FlowGraphKeyDownEventBlock" /* FlowGraphBlockNames.KeyDownEvent */;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
RegisterClass("FlowGraphKeyDownEventBlock" /* FlowGraphBlockNames.KeyDownEvent */, FlowGraphKeyDownEventBlock);
|
|
42
|
+
//# sourceMappingURL=flowGraphKeyDownEventBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowGraphKeyDownEventBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEpE,OAAO,EAAE,2BAA2B,EAAkD,MAAM,+BAA+B,CAAC;AAa5H;;;;GAIG;AACH,MAAM,OAAO,0BAA2B,SAAQ,2BAA2B;IASvE;;;OAGG;IACH,YAAmB,MAAiD;QAChE,KAAK,CAAC,MAAM,CAAC,CAAC;QARlB,gBAAgB;QACS,SAAI,8CAAkD;QAQ3E,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,kBAAkB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;IACzE,CAAC;IAED,gBAAgB;IACA,aAAa,CAAC,OAAyB,EAAE,YAA0B;QAC/E,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC;QAElD,oDAAoD;QACpD,IAAI,MAAM,IAAK,IAAI,CAAC,MAAmD,EAAE,YAAY,EAAE,CAAC;YACpF,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,6DAA6D;QAC7D,+DAA+D;QAC/D,0DAA0D;QAC1D,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAExC,kFAAkF;QAClF,OAAO,KAAK,CAAC,aAAa,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACtD,CAAC;IAED;;OAEG;IACa,YAAY;QACxB,2EAAwC;IAC5C,CAAC;CACJ;AACD,aAAa,sEAAmC,0BAA0B,CAAC,CAAC","sourcesContent":["import { type KeyboardInfo } from \"core/Events/keyboardEvents\";\nimport { type FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\nimport { FlowGraphBlockNames } from \"../flowGraphBlockNames\";\nimport { type FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection\";\nimport { RichTypeBoolean } from \"core/FlowGraph/flowGraphRichTypes\";\nimport { FlowGraphEventType } from \"core/FlowGraph/flowGraphEventType\";\nimport { FlowGraphKeyboardEventBlock, type IFlowGraphKeyboardEventBlockConfiguration } from \"./flowGraphKeyboardEventBlock\";\n\n/**\n * Configuration for the key down event block.\n */\nexport interface IFlowGraphKeyDownEventBlockConfiguration extends IFlowGraphKeyboardEventBlockConfiguration {\n /**\n * When true, auto-repeat key-down events (the user holding a key) are\n * ignored and only the initial press fires the block. Defaults to false.\n */\n ignoreRepeat?: boolean;\n}\n\n/**\n * A keyboard event block that fires when a key is pressed down.\n * Extends {@link FlowGraphKeyboardEventBlock} with an `isRepeat` output\n * and an `ignoreRepeat` configuration option.\n */\nexport class FlowGraphKeyDownEventBlock extends FlowGraphKeyboardEventBlock {\n /**\n * Output connection: whether this is an auto-repeat event (key held down).\n */\n public readonly isRepeat: FlowGraphDataConnection<boolean>;\n\n /** @internal */\n public override readonly type: FlowGraphEventType = FlowGraphEventType.KeyDown;\n\n /**\n * Creates a new FlowGraphKeyDownEventBlock.\n * @param config optional configuration\n */\n public constructor(config?: IFlowGraphKeyDownEventBlockConfiguration) {\n super(config);\n this.isRepeat = this.registerDataOutput(\"isRepeat\", RichTypeBoolean);\n }\n\n /** @internal */\n public override _executeEvent(context: FlowGraphContext, keyboardInfo: KeyboardInfo): boolean {\n const repeat = keyboardInfo.event.repeat ?? false;\n\n // Skip auto-repeat events when configured to do so.\n if (repeat && (this.config as IFlowGraphKeyDownEventBlockConfiguration)?.ignoreRepeat) {\n return true;\n }\n\n // Set the repeat output before delegating to the base class,\n // which calls _execute() and fires signals — downstream blocks\n // must see the correct value during that execution chain.\n this.isRepeat.setValue(repeat, context);\n\n // Delegate to the base class for key filtering, output population, and execution.\n return super._executeEvent(context, keyboardInfo);\n }\n\n /**\n * @returns class name of the block.\n */\n public override getClassName(): string {\n return FlowGraphBlockNames.KeyDownEvent;\n }\n}\nRegisterClass(FlowGraphBlockNames.KeyDownEvent, FlowGraphKeyDownEventBlock);\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FlowGraphEventType } from "../../flowGraphEventType.js";
|
|
2
|
+
import { FlowGraphKeyboardEventBlock, type IFlowGraphKeyboardEventBlockConfiguration } from "./flowGraphKeyboardEventBlock.js";
|
|
3
|
+
/**
|
|
4
|
+
* A keyboard event block that fires when a key is released.
|
|
5
|
+
* Inherits all inputs/outputs from {@link FlowGraphKeyboardEventBlock}.
|
|
6
|
+
*/
|
|
7
|
+
export declare class FlowGraphKeyUpEventBlock extends FlowGraphKeyboardEventBlock {
|
|
8
|
+
/** @internal */
|
|
9
|
+
readonly type: FlowGraphEventType;
|
|
10
|
+
/**
|
|
11
|
+
* Creates a new FlowGraphKeyUpEventBlock.
|
|
12
|
+
* @param config optional configuration
|
|
13
|
+
*/
|
|
14
|
+
constructor(config?: IFlowGraphKeyboardEventBlockConfiguration);
|
|
15
|
+
/**
|
|
16
|
+
* @returns class name of the block.
|
|
17
|
+
*/
|
|
18
|
+
getClassName(): string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { RegisterClass } from "../../../Misc/typeStore.js";
|
|
2
|
+
import { FlowGraphKeyboardEventBlock } from "./flowGraphKeyboardEventBlock.js";
|
|
3
|
+
/**
|
|
4
|
+
* A keyboard event block that fires when a key is released.
|
|
5
|
+
* Inherits all inputs/outputs from {@link FlowGraphKeyboardEventBlock}.
|
|
6
|
+
*/
|
|
7
|
+
export class FlowGraphKeyUpEventBlock extends FlowGraphKeyboardEventBlock {
|
|
8
|
+
/**
|
|
9
|
+
* Creates a new FlowGraphKeyUpEventBlock.
|
|
10
|
+
* @param config optional configuration
|
|
11
|
+
*/
|
|
12
|
+
constructor(config) {
|
|
13
|
+
super(config);
|
|
14
|
+
/** @internal */
|
|
15
|
+
this.type = "KeyUp" /* FlowGraphEventType.KeyUp */;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @returns class name of the block.
|
|
19
|
+
*/
|
|
20
|
+
getClassName() {
|
|
21
|
+
return "FlowGraphKeyUpEventBlock" /* FlowGraphBlockNames.KeyUpEvent */;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
RegisterClass("FlowGraphKeyUpEventBlock" /* FlowGraphBlockNames.KeyUpEvent */, FlowGraphKeyUpEventBlock);
|
|
25
|
+
//# sourceMappingURL=flowGraphKeyUpEventBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowGraphKeyUpEventBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,EAAE,2BAA2B,EAAkD,MAAM,+BAA+B,CAAC;AAE5H;;;GAGG;AACH,MAAM,OAAO,wBAAyB,SAAQ,2BAA2B;IAIrE;;;OAGG;IACH,YAAmB,MAAkD;QACjE,KAAK,CAAC,MAAM,CAAC,CAAC;QARlB,gBAAgB;QACS,SAAI,0CAAgD;IAQ7E,CAAC;IAED;;OAEG;IACa,YAAY;QACxB,uEAAsC;IAC1C,CAAC;CACJ;AACD,aAAa,kEAAiC,wBAAwB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"core/Misc/typeStore\";\nimport { FlowGraphBlockNames } from \"../flowGraphBlockNames\";\nimport { FlowGraphEventType } from \"core/FlowGraph/flowGraphEventType\";\nimport { FlowGraphKeyboardEventBlock, type IFlowGraphKeyboardEventBlockConfiguration } from \"./flowGraphKeyboardEventBlock\";\n\n/**\n * A keyboard event block that fires when a key is released.\n * Inherits all inputs/outputs from {@link FlowGraphKeyboardEventBlock}.\n */\nexport class FlowGraphKeyUpEventBlock extends FlowGraphKeyboardEventBlock {\n /** @internal */\n public override readonly type: FlowGraphEventType = FlowGraphEventType.KeyUp;\n\n /**\n * Creates a new FlowGraphKeyUpEventBlock.\n * @param config optional configuration\n */\n public constructor(config?: IFlowGraphKeyboardEventBlockConfiguration) {\n super(config);\n }\n\n /**\n * @returns class name of the block.\n */\n public override getClassName(): string {\n return FlowGraphBlockNames.KeyUpEvent;\n }\n}\nRegisterClass(FlowGraphBlockNames.KeyUpEvent, FlowGraphKeyUpEventBlock);\n"]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { FlowGraphEventBlock } from "../../flowGraphEventBlock.js";
|
|
2
|
+
import { type KeyboardInfo } from "../../../Events/keyboardEvents.js";
|
|
3
|
+
import { type FlowGraphContext } from "../../flowGraphContext.js";
|
|
4
|
+
import { type IFlowGraphBlockConfiguration } from "../../flowGraphBlock.js";
|
|
5
|
+
import { type FlowGraphDataConnection } from "../../flowGraphDataConnection.js";
|
|
6
|
+
/**
|
|
7
|
+
* Configuration for keyboard event blocks.
|
|
8
|
+
*/
|
|
9
|
+
export interface IFlowGraphKeyboardEventBlockConfiguration extends IFlowGraphBlockConfiguration {
|
|
10
|
+
/**
|
|
11
|
+
* When true, prevent the event from propagating to other listeners.
|
|
12
|
+
*/
|
|
13
|
+
stopPropagation?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Shared base class for keyboard event blocks (KeyDown / KeyUp).
|
|
17
|
+
*
|
|
18
|
+
* Provides a `key` input filter, output data connections for the key code,
|
|
19
|
+
* key string, modifier states, and a platform-aware `commandOrCtrl` flag.
|
|
20
|
+
* Subclasses only need to set their event type and class name.
|
|
21
|
+
*/
|
|
22
|
+
export declare abstract class FlowGraphKeyboardEventBlock extends FlowGraphEventBlock {
|
|
23
|
+
/**
|
|
24
|
+
* Input connection: optional key code to filter on (e.g. "KeyA", "Space", "ShiftLeft").
|
|
25
|
+
* Uses `KeyboardEvent.code` values. Leave empty / disconnected to fire on any key event.
|
|
26
|
+
*/
|
|
27
|
+
readonly key: FlowGraphDataConnection<string>;
|
|
28
|
+
/**
|
|
29
|
+
* Output connection: the `KeyboardEvent.code` of the key.
|
|
30
|
+
*/
|
|
31
|
+
readonly keyCode: FlowGraphDataConnection<string>;
|
|
32
|
+
/**
|
|
33
|
+
* Output connection: the `KeyboardEvent.key` string (printable character or key name).
|
|
34
|
+
*/
|
|
35
|
+
readonly keyValue: FlowGraphDataConnection<string>;
|
|
36
|
+
/**
|
|
37
|
+
* Output connection: whether the Shift key was held.
|
|
38
|
+
*/
|
|
39
|
+
readonly shiftKey: FlowGraphDataConnection<boolean>;
|
|
40
|
+
/**
|
|
41
|
+
* Output connection: whether the Ctrl key was held.
|
|
42
|
+
*/
|
|
43
|
+
readonly ctrlKey: FlowGraphDataConnection<boolean>;
|
|
44
|
+
/**
|
|
45
|
+
* Output connection: whether the Alt key (Option on macOS) was held.
|
|
46
|
+
*/
|
|
47
|
+
readonly altKey: FlowGraphDataConnection<boolean>;
|
|
48
|
+
/**
|
|
49
|
+
* Output connection: whether the Meta key (Windows / Cmd) was held.
|
|
50
|
+
*/
|
|
51
|
+
readonly metaKey: FlowGraphDataConnection<boolean>;
|
|
52
|
+
/**
|
|
53
|
+
* Output connection: platform-aware "command or control" modifier.
|
|
54
|
+
* True when Meta (Cmd) is held on macOS, or Ctrl is held on Windows/Linux.
|
|
55
|
+
*/
|
|
56
|
+
readonly commandOrCtrl: FlowGraphDataConnection<boolean>;
|
|
57
|
+
protected constructor(config?: IFlowGraphKeyboardEventBlockConfiguration);
|
|
58
|
+
/** @internal */
|
|
59
|
+
_executeEvent(context: FlowGraphContext, keyboardInfo: KeyboardInfo): boolean;
|
|
60
|
+
/** @internal */
|
|
61
|
+
_preparePendingTasks(_context: FlowGraphContext): void;
|
|
62
|
+
/** @internal */
|
|
63
|
+
_cancelPendingTasks(_context: FlowGraphContext): void;
|
|
64
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { FlowGraphEventBlock } from "../../flowGraphEventBlock.js";
|
|
2
|
+
import { RichTypeBoolean, RichTypeString } from "../../flowGraphRichTypes.js";
|
|
3
|
+
import { _IsMacPlatform } from "../../utils.js";
|
|
4
|
+
/**
|
|
5
|
+
* Shared base class for keyboard event blocks (KeyDown / KeyUp).
|
|
6
|
+
*
|
|
7
|
+
* Provides a `key` input filter, output data connections for the key code,
|
|
8
|
+
* key string, modifier states, and a platform-aware `commandOrCtrl` flag.
|
|
9
|
+
* Subclasses only need to set their event type and class name.
|
|
10
|
+
*/
|
|
11
|
+
export class FlowGraphKeyboardEventBlock extends FlowGraphEventBlock {
|
|
12
|
+
constructor(config) {
|
|
13
|
+
super(config);
|
|
14
|
+
this.key = this.registerDataInput("key", RichTypeString);
|
|
15
|
+
this.keyCode = this.registerDataOutput("keyCode", RichTypeString);
|
|
16
|
+
this.keyValue = this.registerDataOutput("keyValue", RichTypeString);
|
|
17
|
+
this.shiftKey = this.registerDataOutput("shiftKey", RichTypeBoolean);
|
|
18
|
+
this.ctrlKey = this.registerDataOutput("ctrlKey", RichTypeBoolean);
|
|
19
|
+
this.altKey = this.registerDataOutput("altKey", RichTypeBoolean);
|
|
20
|
+
this.metaKey = this.registerDataOutput("metaKey", RichTypeBoolean);
|
|
21
|
+
this.commandOrCtrl = this.registerDataOutput("commandOrCtrl", RichTypeBoolean);
|
|
22
|
+
}
|
|
23
|
+
/** @internal */
|
|
24
|
+
_executeEvent(context, keyboardInfo) {
|
|
25
|
+
const evt = keyboardInfo.event;
|
|
26
|
+
const filterKey = this.key.getValue(context);
|
|
27
|
+
// If a key filter is set, only fire when it matches.
|
|
28
|
+
if (filterKey && filterKey !== evt.code) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
this.keyCode.setValue(evt.code, context);
|
|
32
|
+
this.keyValue.setValue(evt.key, context);
|
|
33
|
+
this.shiftKey.setValue(evt.shiftKey, context);
|
|
34
|
+
this.ctrlKey.setValue(evt.ctrlKey, context);
|
|
35
|
+
this.altKey.setValue(evt.altKey, context);
|
|
36
|
+
this.metaKey.setValue(evt.metaKey, context);
|
|
37
|
+
this.commandOrCtrl.setValue(_IsMacPlatform ? evt.metaKey : evt.ctrlKey, context);
|
|
38
|
+
this._execute(context);
|
|
39
|
+
return !this.config?.stopPropagation;
|
|
40
|
+
}
|
|
41
|
+
/** @internal */
|
|
42
|
+
_preparePendingTasks(_context) {
|
|
43
|
+
// no-op
|
|
44
|
+
}
|
|
45
|
+
/** @internal */
|
|
46
|
+
_cancelPendingTasks(_context) {
|
|
47
|
+
// no-op
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=flowGraphKeyboardEventBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowGraphKeyboardEventBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Event/flowGraphKeyboardEventBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAKzE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAYtD;;;;;;GAMG;AACH,MAAM,OAAgB,2BAA4B,SAAQ,mBAAmB;IA2CzE,YAAsB,MAAkD;QACpE,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;QACzD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;QAClE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,kBAAkB,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QACpE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,kBAAkB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;QACrE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC,SAAS,EAAE,eAAe,CA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O,CAAC,CAAC;QAEjF,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACvB,OAAO,CAAE,IAAI,CAAC,MAAoD,EAAE,eAAe,CAAC;IACxF,CAAC;IAED,gBAAgB;IACA,oBAAoB,CAAC,QAA0B;QAC3D,QAAQ;IACZ,CAAC;IAED,gBAAgB;IACA,mBAAmB,CAAC,QAA0B;QAC1D,QAAQ;IACZ,CAAC;CACJ","sourcesContent":["import { FlowGraphEventBlock } from \"core/FlowGraph/flowGraphEventBlock\";\nimport { type KeyboardInfo } from \"core/Events/keyboardEvents\";\nimport { type FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport { type IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport { type FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection\";\nimport { RichTypeBoolean, RichTypeString } from \"core/FlowGraph/flowGraphRichTypes\";\nimport { _IsMacPlatform } from \"core/FlowGraph/utils\";\n\n/**\n * Configuration for keyboard event blocks.\n */\nexport interface IFlowGraphKeyboardEventBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * When true, prevent the event from propagating to other listeners.\n */\n stopPropagation?: boolean;\n}\n\n/**\n * Shared base class for keyboard event blocks (KeyDown / KeyUp).\n *\n * Provides a `key` input filter, output data connections for the key code,\n * key string, modifier states, and a platform-aware `commandOrCtrl` flag.\n * Subclasses only need to set their event type and class name.\n */\nexport abstract class FlowGraphKeyboardEventBlock extends FlowGraphEventBlock {\n /**\n * Input connection: optional key code to filter on (e.g. \"KeyA\", \"Space\", \"ShiftLeft\").\n * Uses `KeyboardEvent.code` values. Leave empty / disconnected to fire on any key event.\n */\n public readonly key: FlowGraphDataConnection<string>;\n\n /**\n * Output connection: the `KeyboardEvent.code` of the key.\n */\n public readonly keyCode: FlowGraphDataConnection<string>;\n\n /**\n * Output connection: the `KeyboardEvent.key` string (printable character or key name).\n */\n public readonly keyValue: FlowGraphDataConnection<string>;\n\n /**\n * Output connection: whether the Shift key was held.\n */\n public readonly shiftKey: FlowGraphDataConnection<boolean>;\n\n /**\n * Output connection: whether the Ctrl key was held.\n */\n public readonly ctrlKey: FlowGraphDataConnection<boolean>;\n\n /**\n * Output connection: whether the Alt key (Option on macOS) was held.\n */\n public readonly altKey: FlowGraphDataConnection<boolean>;\n\n /**\n * Output connection: whether the Meta key (Windows / Cmd) was held.\n */\n public readonly metaKey: FlowGraphDataConnection<boolean>;\n\n /**\n * Output connection: platform-aware \"command or control\" modifier.\n * True when Meta (Cmd) is held on macOS, or Ctrl is held on Windows/Linux.\n */\n public readonly commandOrCtrl: FlowGraphDataConnection<boolean>;\n\n protected constructor(config?: IFlowGraphKeyboardEventBlockConfiguration) {\n super(config);\n this.key = this.registerDataInput(\"key\", RichTypeString);\n this.keyCode = this.registerDataOutput(\"keyCode\", RichTypeString);\n this.keyValue = this.registerDataOutput(\"keyValue\", RichTypeString);\n this.shiftKey = this.registerDataOutput(\"shiftKey\", RichTypeBoolean);\n this.ctrlKey = this.registerDataOutput(\"ctrlKey\", RichTypeBoolean);\n this.altKey = this.registerDataOutput(\"altKey\", RichTypeBoolean);\n this.metaKey = this.registerDataOutput(\"metaKey\", RichTypeBoolean);\n this.commandOrCtrl = this.registerDataOutput(\"commandOrCtrl\", RichTypeBoolean);\n }\n\n /** @internal */\n public override _executeEvent(context: FlowGraphContext, keyboardInfo: KeyboardInfo): boolean {\n const evt = keyboardInfo.event;\n const filterKey = this.key.getValue(context);\n\n // If a key filter is set, only fire when it matches.\n if (filterKey && filterKey !== evt.code) {\n return true;\n }\n\n this.keyCode.setValue(evt.code, context);\n this.keyValue.setValue(evt.key, context);\n this.shiftKey.setValue(evt.shiftKey, context);\n this.ctrlKey.setValue(evt.ctrlKey, context);\n this.altKey.setValue(evt.altKey, context);\n this.metaKey.setValue(evt.metaKey, context);\n this.commandOrCtrl.setValue(_IsMacPlatform ? evt.metaKey : evt.ctrlKey, context);\n\n this._execute(context);\n return !(this.config as IFlowGraphKeyboardEventBlockConfiguration)?.stopPropagation;\n }\n\n /** @internal */\n public override _preparePendingTasks(_context: FlowGraphContext): void {\n // no-op\n }\n\n /** @internal */\n public override _cancelPendingTasks(_context: FlowGraphContext): void {\n // no-op\n }\n}\n"]}
|
|
@@ -7,3 +7,6 @@ export * from "./flowGraphPointerOutEventBlock.js";
|
|
|
7
7
|
export * from "./flowGraphPointerOverEventBlock.js";
|
|
8
8
|
export * from "./flowGraphPhysicsCollisionEventBlock.js";
|
|
9
9
|
export * from "./flowGraphSoundEndedEventBlock.js";
|
|
10
|
+
export * from "./flowGraphKeyboardEventBlock.js";
|
|
11
|
+
export * from "./flowGraphKeyDownEventBlock.js";
|
|
12
|
+
export * from "./flowGraphKeyUpEventBlock.js";
|
|
@@ -7,4 +7,7 @@ export * from "./flowGraphPointerOutEventBlock.js";
|
|
|
7
7
|
export * from "./flowGraphPointerOverEventBlock.js";
|
|
8
8
|
export * from "./flowGraphPhysicsCollisionEventBlock.js";
|
|
9
9
|
export * from "./flowGraphSoundEndedEventBlock.js";
|
|
10
|
+
export * from "./flowGraphKeyboardEventBlock.js";
|
|
11
|
+
export * from "./flowGraphKeyDownEventBlock.js";
|
|
12
|
+
export * from "./flowGraphKeyUpEventBlock.js";
|
|
10
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Event/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC;AACtD,cAAc,iCAAiC,CAAC","sourcesContent":["export * from \"./flowGraphMeshPickEventBlock\";\r\nexport * from \"./flowGraphSceneReadyEventBlock\";\r\nexport * from \"./flowGraphReceiveCustomEventBlock\";\r\nexport * from \"./flowGraphSendCustomEventBlock\";\r\nexport * from \"./flowGraphSceneTickEventBlock\";\r\nexport * from \"./flowGraphPointerOutEventBlock\";\r\nexport * from \"./flowGraphPointerOverEventBlock\";\r\nexport * from \"./flowGraphPhysicsCollisionEventBlock\";\r\nexport * from \"./flowGraphSoundEndedEventBlock\";\r\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Event/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC;AACtD,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC","sourcesContent":["export * from \"./flowGraphMeshPickEventBlock\";\r\nexport * from \"./flowGraphSceneReadyEventBlock\";\r\nexport * from \"./flowGraphReceiveCustomEventBlock\";\r\nexport * from \"./flowGraphSendCustomEventBlock\";\r\nexport * from \"./flowGraphSceneTickEventBlock\";\r\nexport * from \"./flowGraphPointerOutEventBlock\";\r\nexport * from \"./flowGraphPointerOverEventBlock\";\r\nexport * from \"./flowGraphPhysicsCollisionEventBlock\";\r\nexport * from \"./flowGraphSoundEndedEventBlock\";\r\nexport * from \"./flowGraphKeyboardEventBlock\";\r\nexport * from \"./flowGraphKeyDownEventBlock\";\r\nexport * from \"./flowGraphKeyUpEventBlock\";\r\n"]}
|
|
@@ -303,6 +303,13 @@ export function blockFactory(blockName) {
|
|
|
303
303
|
return async () => (await import("./Event/flowGraphPointerUpEventBlock.js")).FlowGraphPointerUpEventBlock;
|
|
304
304
|
case "FlowGraphPointerMoveEventBlock" /* FlowGraphBlockNames.PointerMoveEvent */:
|
|
305
305
|
return async () => (await import("./Event/flowGraphPointerMoveEventBlock.js")).FlowGraphPointerMoveEventBlock;
|
|
306
|
+
// Keyboard
|
|
307
|
+
case "FlowGraphKeyDownEventBlock" /* FlowGraphBlockNames.KeyDownEvent */:
|
|
308
|
+
return async () => (await import("./Event/flowGraphKeyDownEventBlock.js")).FlowGraphKeyDownEventBlock;
|
|
309
|
+
case "FlowGraphKeyUpEventBlock" /* FlowGraphBlockNames.KeyUpEvent */:
|
|
310
|
+
return async () => (await import("./Event/flowGraphKeyUpEventBlock.js")).FlowGraphKeyUpEventBlock;
|
|
311
|
+
case "FlowGraphIsKeyPressedBlock" /* FlowGraphBlockNames.IsKeyPressed */:
|
|
312
|
+
return async () => (await import("./Data/flowGraphIsKeyPressedBlock.js")).FlowGraphIsKeyPressedBlock;
|
|
306
313
|
case "FlowGraphContextBlock" /* FlowGraphBlockNames.Context */:
|
|
307
314
|
return async () => (await import("./Data/Utils/flowGraphContextBlock.js")).FlowGraphContextBlock;
|
|
308
315
|
case "FlowGraphArrayIndexBlock" /* FlowGraphBlockNames.ArrayIndex */:
|