@onerjs/core 8.51.2 → 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.
Files changed (95) hide show
  1. package/Animations/animationGroup.d.ts +2 -1
  2. package/Animations/animationGroup.js +3 -2
  3. package/Animations/animationGroup.js.map +1 -1
  4. package/Engines/WebGPU/webgpuSnapshotRendering.js +7 -3
  5. package/Engines/WebGPU/webgpuSnapshotRendering.js.map +1 -1
  6. package/Engines/abstractEngine.js +2 -2
  7. package/Engines/abstractEngine.js.map +1 -1
  8. package/Events/deviceInputEvents.d.ts +5 -0
  9. package/Events/deviceInputEvents.js.map +1 -1
  10. package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.d.ts +65 -0
  11. package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.js +74 -0
  12. package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.js.map +1 -0
  13. package/FlowGraph/Blocks/Data/index.d.ts +1 -0
  14. package/FlowGraph/Blocks/Data/index.js +1 -0
  15. package/FlowGraph/Blocks/Data/index.js.map +1 -1
  16. package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.d.ts +39 -0
  17. package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.js +42 -0
  18. package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.js.map +1 -0
  19. package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.d.ts +19 -0
  20. package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.js +25 -0
  21. package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.js.map +1 -0
  22. package/FlowGraph/Blocks/Event/flowGraphKeyboardEventBlock.d.ts +64 -0
  23. package/FlowGraph/Blocks/Event/flowGraphKeyboardEventBlock.js +50 -0
  24. package/FlowGraph/Blocks/Event/flowGraphKeyboardEventBlock.js.map +1 -0
  25. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
  26. package/FlowGraph/Blocks/Event/flowGraphPointerDownEventBlock.js.map +1 -1
  27. package/FlowGraph/Blocks/Event/flowGraphPointerMoveEventBlock.js.map +1 -1
  28. package/FlowGraph/Blocks/Event/flowGraphPointerUpEventBlock.js.map +1 -1
  29. package/FlowGraph/Blocks/Event/index.d.ts +3 -0
  30. package/FlowGraph/Blocks/Event/index.js +3 -0
  31. package/FlowGraph/Blocks/Event/index.js.map +1 -1
  32. package/FlowGraph/Blocks/flowGraphBlockFactory.js +7 -0
  33. package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
  34. package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +3 -0
  35. package/FlowGraph/Blocks/flowGraphBlockNames.js +3 -0
  36. package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -1
  37. package/FlowGraph/flowGraph.d.ts +6 -0
  38. package/FlowGraph/flowGraph.js +10 -1
  39. package/FlowGraph/flowGraph.js.map +1 -1
  40. package/FlowGraph/flowGraphContext.d.ts +8 -0
  41. package/FlowGraph/flowGraphContext.js.map +1 -1
  42. package/FlowGraph/flowGraphCoordinator.d.ts +1 -1
  43. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  44. package/FlowGraph/flowGraphEventType.d.ts +2 -0
  45. package/FlowGraph/flowGraphEventType.js +2 -0
  46. package/FlowGraph/flowGraphEventType.js.map +1 -1
  47. package/FlowGraph/flowGraphParser.d.ts +15 -0
  48. package/FlowGraph/flowGraphParser.js +101 -14
  49. package/FlowGraph/flowGraphParser.js.map +1 -1
  50. package/FlowGraph/flowGraphSceneEventCoordinator.d.ts +14 -0
  51. package/FlowGraph/flowGraphSceneEventCoordinator.js +56 -0
  52. package/FlowGraph/flowGraphSceneEventCoordinator.js.map +1 -1
  53. package/FlowGraph/serialization.js +16 -18
  54. package/FlowGraph/serialization.js.map +1 -1
  55. package/FlowGraph/utils.d.ts +7 -0
  56. package/FlowGraph/utils.js +8 -0
  57. package/FlowGraph/utils.js.map +1 -1
  58. package/Lights/Clustered/clusteredLightContainer.js +1 -1
  59. package/Lights/Clustered/clusteredLightContainer.js.map +1 -1
  60. package/Materials/Background/backgroundMaterial.js +1 -0
  61. package/Materials/Background/backgroundMaterial.js.map +1 -1
  62. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +6 -0
  63. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  64. package/Materials/Node/Blocks/Dual/imageSourceBlock.d.ts +2 -0
  65. package/Materials/Node/Blocks/Dual/imageSourceBlock.js +14 -0
  66. package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
  67. package/Materials/Node/Blocks/Dual/lightBlock.js +1 -1
  68. package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
  69. package/Materials/Node/Blocks/Dual/textureBlock.d.ts +2 -0
  70. package/Materials/Node/Blocks/Dual/textureBlock.js +19 -4
  71. package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
  72. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +11 -6
  73. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  74. package/Materials/Node/nodeMaterial.js +9 -0
  75. package/Materials/Node/nodeMaterial.js.map +1 -1
  76. package/Materials/PBR/openpbrMaterial.js +1 -0
  77. package/Materials/PBR/openpbrMaterial.js.map +1 -1
  78. package/Materials/PBR/pbrBaseMaterial.js +1 -0
  79. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  80. package/Materials/materialHelper.functions.d.ts +2 -1
  81. package/Materials/materialHelper.functions.js +8 -3
  82. package/Materials/materialHelper.functions.js.map +1 -1
  83. package/Materials/standardMaterial.js +1 -0
  84. package/Materials/standardMaterial.js.map +1 -1
  85. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js +30 -8
  86. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js.map +1 -1
  87. package/Misc/snapshotRenderingHelper.d.ts +4 -2
  88. package/Misc/snapshotRenderingHelper.js +33 -22
  89. package/Misc/snapshotRenderingHelper.js.map +1 -1
  90. package/Misc/tools.js +1 -1
  91. package/Misc/tools.js.map +1 -1
  92. package/Particles/thinParticleSystem.d.ts +6 -1
  93. package/Particles/thinParticleSystem.js +23 -6
  94. package/Particles/thinParticleSystem.js.map +1 -1
  95. package/package.json +1 -1
@@ -78,6 +78,11 @@ export interface IKeyboardEvent extends IUIEvent {
78
78
  * Status of Shift key being pressed
79
79
  */
80
80
  shiftKey: boolean;
81
+ /**
82
+ * Whether this key event was generated by an auto-repeat
83
+ * (the user is holding the key down).
84
+ */
85
+ repeat?: boolean;
81
86
  }
82
87
  /**
83
88
  * Native friendly interface for MouseEvent Object
@@ -1 +1 @@
1
- {"version":3,"file":"deviceInputEvents.js","sourceRoot":"","sources":["../../../../dev/core/src/Events/deviceInputEvents.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAN,IAAkB,oBAQjB;AARD,WAAkB,oBAAoB;IAClC,WAAW;IACX,kBAAkB;IAClB,6EAAW,CAAA;IACX,kBAAkB;IAClB,6EAAW,CAAA;IACX,gBAAgB;IAChB,yEAAS,CAAA;AACb,CAAC,EARiB,oBAAoB,KAApB,oBAAoB,QAQrC;AA+QD;;GAEG;AACH,MAAM,OAAO,cAAc;;AACvB;;GAEG;AACW,8BAAe,GAAG,IAAI,CAAC;AAErC;;GAEG;AACW,6BAAc,GAAG,IAAI,CAAC;AAEpC;;GAEG;AACW,6BAAc,GAAG,IAAI,CAAC","sourcesContent":["import { type PointerInput } from \"../DeviceInput/InputDevices/deviceEnums\";\r\n\r\n/**\r\n * Event Types\r\n */\r\nexport const enum DeviceInputEventType {\r\n // Pointers\r\n /** PointerMove */\r\n PointerMove,\r\n /** PointerDown */\r\n PointerDown,\r\n /** PointerUp */\r\n PointerUp,\r\n}\r\n\r\n/**\r\n * Native friendly interface for Event Object\r\n */\r\nexport interface IUIEvent {\r\n /**\r\n * Input array index\r\n */\r\n inputIndex: number;\r\n\r\n /**\r\n * Current target for an event\r\n */\r\n currentTarget?: any;\r\n\r\n /**\r\n * Alias for target\r\n * @deprecated Use target instead\r\n */\r\n srcElement?: any;\r\n\r\n /**\r\n * Type of event\r\n */\r\n type: string;\r\n\r\n /**\r\n * Reference to object where object was dispatched\r\n */\r\n target: any;\r\n\r\n /**\r\n * Tells user agent what to do when not explicitly handled\r\n */\r\n preventDefault: () => void;\r\n}\r\n\r\n/**\r\n * Native friendly interface for KeyboardEvent Object\r\n */\r\nexport interface IKeyboardEvent extends IUIEvent {\r\n /**\r\n * Status of Alt key being pressed\r\n */\r\n altKey: boolean;\r\n\r\n /**\r\n * Unicode value of character pressed\r\n * @deprecated Required for event, use keyCode instead.\r\n */\r\n charCode?: number;\r\n\r\n /**\r\n * Code for key based on layout\r\n */\r\n code: string;\r\n\r\n /**\r\n * Status of Ctrl key being pressed\r\n */\r\n ctrlKey: boolean;\r\n\r\n /**\r\n * String representation of key\r\n */\r\n key: string;\r\n /**\r\n * ASCII value of key\r\n * @deprecated Used with DeviceSourceManager\r\n */\r\n keyCode: number;\r\n\r\n /**\r\n * Status of Meta key (eg. Windows key) being pressed\r\n */\r\n metaKey: boolean;\r\n\r\n /**\r\n * Status of Shift key being pressed\r\n */\r\n shiftKey: boolean;\r\n}\r\n\r\n/**\r\n * Native friendly interface for MouseEvent Object\r\n */\r\nexport interface IMouseEvent extends IUIEvent {\r\n /**\r\n * Subset of possible PointerInput values for events, excluding ones that CANNOT be in events organically\r\n */\r\n inputIndex: Exclude<PointerInput, PointerInput.Horizontal | PointerInput.Vertical>;\r\n\r\n /**\r\n * Status of Alt key being pressed\r\n */\r\n altKey: boolean;\r\n\r\n /**\r\n * Value of single mouse button pressed\r\n */\r\n button: number;\r\n\r\n /**\r\n * Value of all mouse buttons pressed\r\n */\r\n buttons: number;\r\n\r\n /**\r\n * Current X coordinate\r\n */\r\n clientX: number;\r\n\r\n /**\r\n * Current Y coordinate\r\n */\r\n clientY: number;\r\n\r\n /**\r\n * Status of Ctrl key being pressed\r\n */\r\n ctrlKey: boolean;\r\n\r\n /**\r\n * Provides current click count\r\n */\r\n detail?: number;\r\n\r\n /**\r\n * Status of Meta key (eg. Windows key) being pressed\r\n */\r\n metaKey: boolean;\r\n\r\n /**\r\n * Delta of movement on X axis\r\n */\r\n movementX: number;\r\n\r\n /**\r\n * Delta of movement on Y axis\r\n */\r\n movementY: number;\r\n\r\n /**\r\n * Delta of movement on X axis\r\n * @deprecated Use 'movementX' instead\r\n */\r\n mozMovementX?: number;\r\n\r\n /**\r\n * Delta of movement on Y axis\r\n * @deprecated Use 'movementY' instead\r\n */\r\n mozMovementY?: number;\r\n\r\n /**\r\n * Delta of movement on X axis\r\n * @deprecated Use 'movementX' instead\r\n */\r\n msMovementX?: number;\r\n\r\n /**\r\n * Delta of movement on Y axis\r\n * @deprecated Use 'movementY' instead\r\n */\r\n msMovementY?: number;\r\n\r\n /**\r\n * Current coordinate of X within container\r\n */\r\n offsetX: number;\r\n\r\n /**\r\n * Current coordinate of Y within container\r\n */\r\n offsetY: number;\r\n\r\n /**\r\n * Horizontal coordinate of event\r\n */\r\n pageX: number;\r\n\r\n /**\r\n * Vertical coordinate of event\r\n */\r\n pageY: number;\r\n\r\n /**\r\n * Status of Shift key being pressed\r\n */\r\n shiftKey: boolean;\r\n\r\n /**\r\n * Delta of movement on X axis\r\n * @deprecated Use 'movementX' instead\r\n */\r\n webkitMovementX?: number;\r\n\r\n /**\r\n * Delta of movement on Y axis\r\n * @deprecated Use 'movementY' instead\r\n */\r\n webkitMovementY?: number;\r\n\r\n /**\r\n * Alias of clientX\r\n */\r\n x: number;\r\n\r\n /**\r\n * Alias of clientY\r\n */\r\n y: number;\r\n}\r\n\r\n/**\r\n * Native friendly interface for PointerEvent Object\r\n */\r\nexport interface IPointerEvent extends IMouseEvent {\r\n /**\r\n * Subset of possible PointerInput values for events, excluding ones that CANNOT be in events organically and mouse wheel values\r\n */\r\n inputIndex: Exclude<PointerInput, PointerInput.Horizontal | PointerInput.Vertical | PointerInput.MouseWheelX | PointerInput.MouseWheelY | PointerInput.MouseWheelZ>;\r\n\r\n /**\r\n * Pointer Event ID\r\n */\r\n pointerId: number;\r\n\r\n /**\r\n * Type of pointer\r\n */\r\n pointerType: string;\r\n}\r\n\r\n/**\r\n * Native friendly interface for WheelEvent Object\r\n */\r\nexport interface IWheelEvent extends IMouseEvent {\r\n /**\r\n * Subset of possible PointerInput values for events that can only be used with mouse wheel\r\n */\r\n inputIndex: PointerInput.MouseWheelX | PointerInput.MouseWheelY | PointerInput.MouseWheelZ;\r\n\r\n /**\r\n * Units for delta value\r\n */\r\n deltaMode: number;\r\n\r\n /**\r\n * Horizontal scroll delta\r\n */\r\n deltaX: number;\r\n\r\n /**\r\n * Vertical scroll delta\r\n */\r\n deltaY: number;\r\n\r\n /**\r\n * Z-Axis scroll delta\r\n */\r\n deltaZ: number;\r\n\r\n /**\r\n * WheelDelta (From MouseWheel Event)\r\n * @deprecated\r\n */\r\n wheelDelta?: number;\r\n}\r\n\r\n/**\r\n * Constants used for Events\r\n */\r\nexport class EventConstants {\r\n /**\r\n * Pixel delta for Wheel Events (Default)\r\n */\r\n public static DOM_DELTA_PIXEL = 0x00;\r\n\r\n /**\r\n * Line delta for Wheel Events\r\n */\r\n public static DOM_DELTA_LINE = 0x01;\r\n\r\n /**\r\n * Page delta for Wheel Events\r\n */\r\n public static DOM_DELTA_PAGE = 0x02;\r\n}\r\n"]}
1
+ {"version":3,"file":"deviceInputEvents.js","sourceRoot":"","sources":["../../../../dev/core/src/Events/deviceInputEvents.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAN,IAAkB,oBAQjB;AARD,WAAkB,oBAAoB;IAClC,WAAW;IACX,kBAAkB;IAClB,6EAAW,CAAA;IACX,kBAAkB;IAClB,6EAAW,CAAA;IACX,gBAAgB;IAChB,yEAAS,CAAA;AACb,CAAC,EARiB,oBAAoB,KAApB,oBAAoB,QAQrC;AAqRD;;GAEG;AACH,MAAM,OAAO,cAAc;;AACvB;;GAEG;AACW,8BAAe,GAAG,IAAI,CAAC;AAErC;;GAEG;AACW,6BAAc,GAAG,IAAI,CAAC;AAEpC;;GAEG;AACW,6BAAc,GAAG,IAAI,CAAC","sourcesContent":["import { type PointerInput } from \"../DeviceInput/InputDevices/deviceEnums\";\r\n\r\n/**\r\n * Event Types\r\n */\r\nexport const enum DeviceInputEventType {\r\n // Pointers\r\n /** PointerMove */\r\n PointerMove,\r\n /** PointerDown */\r\n PointerDown,\r\n /** PointerUp */\r\n PointerUp,\r\n}\r\n\r\n/**\r\n * Native friendly interface for Event Object\r\n */\r\nexport interface IUIEvent {\r\n /**\r\n * Input array index\r\n */\r\n inputIndex: number;\r\n\r\n /**\r\n * Current target for an event\r\n */\r\n currentTarget?: any;\r\n\r\n /**\r\n * Alias for target\r\n * @deprecated Use target instead\r\n */\r\n srcElement?: any;\r\n\r\n /**\r\n * Type of event\r\n */\r\n type: string;\r\n\r\n /**\r\n * Reference to object where object was dispatched\r\n */\r\n target: any;\r\n\r\n /**\r\n * Tells user agent what to do when not explicitly handled\r\n */\r\n preventDefault: () => void;\r\n}\r\n\r\n/**\r\n * Native friendly interface for KeyboardEvent Object\r\n */\r\nexport interface IKeyboardEvent extends IUIEvent {\r\n /**\r\n * Status of Alt key being pressed\r\n */\r\n altKey: boolean;\r\n\r\n /**\r\n * Unicode value of character pressed\r\n * @deprecated Required for event, use keyCode instead.\r\n */\r\n charCode?: number;\r\n\r\n /**\r\n * Code for key based on layout\r\n */\r\n code: string;\r\n\r\n /**\r\n * Status of Ctrl key being pressed\r\n */\r\n ctrlKey: boolean;\r\n\r\n /**\r\n * String representation of key\r\n */\r\n key: string;\r\n /**\r\n * ASCII value of key\r\n * @deprecated Used with DeviceSourceManager\r\n */\r\n keyCode: number;\r\n\r\n /**\r\n * Status of Meta key (eg. Windows key) being pressed\r\n */\r\n metaKey: boolean;\r\n\r\n /**\r\n * Status of Shift key being pressed\r\n */\r\n shiftKey: boolean;\r\n\r\n /**\r\n * Whether this key event was generated by an auto-repeat\r\n * (the user is holding the key down).\r\n */\r\n repeat?: boolean;\r\n}\r\n\r\n/**\r\n * Native friendly interface for MouseEvent Object\r\n */\r\nexport interface IMouseEvent extends IUIEvent {\r\n /**\r\n * Subset of possible PointerInput values for events, excluding ones that CANNOT be in events organically\r\n */\r\n inputIndex: Exclude<PointerInput, PointerInput.Horizontal | PointerInput.Vertical>;\r\n\r\n /**\r\n * Status of Alt key being pressed\r\n */\r\n altKey: boolean;\r\n\r\n /**\r\n * Value of single mouse button pressed\r\n */\r\n button: number;\r\n\r\n /**\r\n * Value of all mouse buttons pressed\r\n */\r\n buttons: number;\r\n\r\n /**\r\n * Current X coordinate\r\n */\r\n clientX: number;\r\n\r\n /**\r\n * Current Y coordinate\r\n */\r\n clientY: number;\r\n\r\n /**\r\n * Status of Ctrl key being pressed\r\n */\r\n ctrlKey: boolean;\r\n\r\n /**\r\n * Provides current click count\r\n */\r\n detail?: number;\r\n\r\n /**\r\n * Status of Meta key (eg. Windows key) being pressed\r\n */\r\n metaKey: boolean;\r\n\r\n /**\r\n * Delta of movement on X axis\r\n */\r\n movementX: number;\r\n\r\n /**\r\n * Delta of movement on Y axis\r\n */\r\n movementY: number;\r\n\r\n /**\r\n * Delta of movement on X axis\r\n * @deprecated Use 'movementX' instead\r\n */\r\n mozMovementX?: number;\r\n\r\n /**\r\n * Delta of movement on Y axis\r\n * @deprecated Use 'movementY' instead\r\n */\r\n mozMovementY?: number;\r\n\r\n /**\r\n * Delta of movement on X axis\r\n * @deprecated Use 'movementX' instead\r\n */\r\n msMovementX?: number;\r\n\r\n /**\r\n * Delta of movement on Y axis\r\n * @deprecated Use 'movementY' instead\r\n */\r\n msMovementY?: number;\r\n\r\n /**\r\n * Current coordinate of X within container\r\n */\r\n offsetX: number;\r\n\r\n /**\r\n * Current coordinate of Y within container\r\n */\r\n offsetY: number;\r\n\r\n /**\r\n * Horizontal coordinate of event\r\n */\r\n pageX: number;\r\n\r\n /**\r\n * Vertical coordinate of event\r\n */\r\n pageY: number;\r\n\r\n /**\r\n * Status of Shift key being pressed\r\n */\r\n shiftKey: boolean;\r\n\r\n /**\r\n * Delta of movement on X axis\r\n * @deprecated Use 'movementX' instead\r\n */\r\n webkitMovementX?: number;\r\n\r\n /**\r\n * Delta of movement on Y axis\r\n * @deprecated Use 'movementY' instead\r\n */\r\n webkitMovementY?: number;\r\n\r\n /**\r\n * Alias of clientX\r\n */\r\n x: number;\r\n\r\n /**\r\n * Alias of clientY\r\n */\r\n y: number;\r\n}\r\n\r\n/**\r\n * Native friendly interface for PointerEvent Object\r\n */\r\nexport interface IPointerEvent extends IMouseEvent {\r\n /**\r\n * Subset of possible PointerInput values for events, excluding ones that CANNOT be in events organically and mouse wheel values\r\n */\r\n inputIndex: Exclude<PointerInput, PointerInput.Horizontal | PointerInput.Vertical | PointerInput.MouseWheelX | PointerInput.MouseWheelY | PointerInput.MouseWheelZ>;\r\n\r\n /**\r\n * Pointer Event ID\r\n */\r\n pointerId: number;\r\n\r\n /**\r\n * Type of pointer\r\n */\r\n pointerType: string;\r\n}\r\n\r\n/**\r\n * Native friendly interface for WheelEvent Object\r\n */\r\nexport interface IWheelEvent extends IMouseEvent {\r\n /**\r\n * Subset of possible PointerInput values for events that can only be used with mouse wheel\r\n */\r\n inputIndex: PointerInput.MouseWheelX | PointerInput.MouseWheelY | PointerInput.MouseWheelZ;\r\n\r\n /**\r\n * Units for delta value\r\n */\r\n deltaMode: number;\r\n\r\n /**\r\n * Horizontal scroll delta\r\n */\r\n deltaX: number;\r\n\r\n /**\r\n * Vertical scroll delta\r\n */\r\n deltaY: number;\r\n\r\n /**\r\n * Z-Axis scroll delta\r\n */\r\n deltaZ: number;\r\n\r\n /**\r\n * WheelDelta (From MouseWheel Event)\r\n * @deprecated\r\n */\r\n wheelDelta?: number;\r\n}\r\n\r\n/**\r\n * Constants used for Events\r\n */\r\nexport class EventConstants {\r\n /**\r\n * Pixel delta for Wheel Events (Default)\r\n */\r\n public static DOM_DELTA_PIXEL = 0x00;\r\n\r\n /**\r\n * Line delta for Wheel Events\r\n */\r\n public static DOM_DELTA_LINE = 0x01;\r\n\r\n /**\r\n * Page delta for Wheel Events\r\n */\r\n public static DOM_DELTA_PAGE = 0x02;\r\n}\r\n"]}
@@ -0,0 +1,65 @@
1
+ import { FlowGraphBlock, type IFlowGraphBlockConfiguration } from "../../flowGraphBlock.js";
2
+ import { type FlowGraphContext } from "../../flowGraphContext.js";
3
+ import { type FlowGraphDataConnection } from "../../flowGraphDataConnection.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 declare class FlowGraphIsKeyPressedBlock extends FlowGraphBlock {
23
+ /**
24
+ * Input connection: the `KeyboardEvent.code` of the key to check
25
+ * (e.g. "KeyA", "Space", "ShiftLeft").
26
+ */
27
+ readonly key: FlowGraphDataConnection<string>;
28
+ /**
29
+ * Input connection: when true, Shift must also be held.
30
+ */
31
+ readonly withShift: FlowGraphDataConnection<boolean>;
32
+ /**
33
+ * Input connection: when true, Ctrl must also be held.
34
+ */
35
+ readonly withCtrl: FlowGraphDataConnection<boolean>;
36
+ /**
37
+ * Input connection: when true, Alt (Option on macOS) must also be held.
38
+ */
39
+ readonly withAlt: FlowGraphDataConnection<boolean>;
40
+ /**
41
+ * Input connection: when true, Meta (Win key / Cmd) must also be held.
42
+ */
43
+ readonly withMeta: FlowGraphDataConnection<boolean>;
44
+ /**
45
+ * Input connection: when true, the platform-appropriate "command" modifier
46
+ * must also be held (Cmd on macOS, Ctrl on Windows/Linux).
47
+ * This uses the virtual "CommandOrControl" key tracked by the coordinator.
48
+ */
49
+ readonly withCommandOrCtrl: FlowGraphDataConnection<boolean>;
50
+ /**
51
+ * Output connection: true if the key (and all required modifiers) are currently held down.
52
+ */
53
+ readonly isPressed: FlowGraphDataConnection<boolean>;
54
+ /**
55
+ * Creates a new FlowGraphIsKeyPressedBlock.
56
+ * @param config optional configuration
57
+ */
58
+ constructor(config?: IFlowGraphBlockConfiguration);
59
+ /** @internal */
60
+ _updateOutputs(context: FlowGraphContext): void;
61
+ /**
62
+ * @returns class name of the block.
63
+ */
64
+ getClassName(): string;
65
+ }
@@ -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/flowGraphIsKeyPressedBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAqC,MAAM,+BAA+B,CAAC;AAElG,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAEpF;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,0BAA2B,SAAQ,cAAc;IAuC1D;;;OAGG;IACH,YAAmB,MAAqC;QACpD,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;QACzD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;QACtE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;QACpE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;QAClE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;QACpE,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,CAAC,mBAAmB,EAAE,eAAe,CAAC,CAAC;QACtF,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,kBAAkB,CAAC,WAAW,EAAE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,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAC5D,CAAC;QACD,IAAI,OAAO,IAAI,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YACtD,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAC3C,CAAC;QAED,IAAI,CAAC,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":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AO,CAAC,CAAC;QAE7C,qDAAqD;QACrD,IAAI,SAAS,IAAI,SAAS,KAAK,GAAG,CAAC,IAAI,EAAE,CAAC;YACtC,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACzC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QACzC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC9C,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC1C,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC5C,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphMeshPickEventBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAoB,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGpF,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAA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mBAAmB,CAAC,OAAO,CAAC,CAAC;YAC9C,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;QACjD,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACa,oBAAoB,CAAC,QAA0B;QAC3D,QAAQ;IACZ,CAAC;IAED;;OAEG;IACa,mBAAmB,CAAC,QAA0B;QAC1D,QAAQ;IACZ,CAAC;IAED;;OAEG;IACa,YAAY;QACxB,6EAAyC;IAC7C,CAAC;CACJ;AACD,aAAa,wEAAoC,2BAA2B,CAAC,CAAC","sourcesContent":["import { type AbstractMesh } from \"../../../Meshes/abstractMesh\";\r\nimport { FlowGraphEventBlock } from \"../../flowGraphEventBlock\";\r\nimport { type PointerInfo, PointerEventTypes } from \"../../../Events/pointerEvents\";\r\nimport { type FlowGraphContext } from \"../../flowGraphContext\";\r\nimport { type IFlowGraphBlockConfiguration } from \"../../flowGraphBlock\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { _IsDescendantOf } from \"../../utils\";\r\nimport { FlowGraphBlockNames } from \"../flowGraphBlockNames\";\r\nimport { type FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection\";\r\nimport { RichTypeAny, RichTypeNumber, RichTypeVector3 } from \"core/FlowGraph/flowGraphRichTypes\";\r\nimport { type Vector3 } from \"core/Maths/math.vector\";\r\nimport { FlowGraphEventType } from \"core/FlowGraph/flowGraphEventType\";\r\n/**\r\n * Configuration for the mesh pick event block.\r\n */\r\nexport interface IFlowGraphMeshPickEventBlockConfiguration extends IFlowGraphBlockConfiguration {\r\n /**\r\n * Should this mesh block propagation of the event.\r\n */\r\n stopPropagation?: boolean;\r\n\r\n /**\r\n * The mesh to listen to. Can also be set by the asset input.\r\n */\r\n targetMesh?: AbstractMesh;\r\n}\r\n/**\r\n * A block that activates when a mesh is picked.\r\n */\r\nexport class FlowGraphMeshPickEventBlock extends FlowGraphEventBlock {\r\n /**\r\n * Input connection: The mesh to listen to.\r\n */\r\n public readonly asset: FlowGraphDataConnection<AbstractMesh>;\r\n\r\n /**\r\n * Output connection: The picked point.\r\n */\r\n public readonly pickedPoint: FlowGraphDataConnection<Vector3>;\r\n\r\n /**\r\n * Output connection: The picked origin.\r\n */\r\n public readonly pickOrigin: FlowGraphDataConnection<Vector3>;\r\n\r\n /**\r\n * Output connection: The pointer id.\r\n */\r\n public readonly pointerId: FlowGraphDataConnection<number>;\r\n\r\n /**\r\n * Output connection: The picked mesh. Possibly NOT the same as the asset (could be a descendant).\r\n */\r\n public readonly pickedMesh: FlowGraphDataConnection<AbstractMesh>;\r\n\r\n /**\r\n * Input connection: The type of the pointer event.\r\n */\r\n public readonly pointerType: FlowGraphDataConnection<PointerEventTypes>;\r\n\r\n /**\r\n * the type of the event this block reacts to\r\n */\r\n public override readonly type: FlowGraphEventType = FlowGraphEventType.MeshPick;\r\n\r\n public constructor(\r\n /**\r\n * the configuration of the block\r\n */\r\n public override config?: IFlowGraphMeshPickEventBlockConfiguration\r\n ) {\r\n super(config);\r\n this.asset = this.registerDataInput(\"asset\", RichTypeAny, config?.targetMesh);\r\n this.pickedPoint = this.registerDataOutput(\"pickedPoint\", RichTypeVector3);\r\n this.pickOrigin = this.registerDataOutput(\"pickOrigin\", RichTypeVector3);\r\n this.pointerId = this.registerDataOutput(\"pointerId\", RichTypeNumber);\r\n this.pickedMesh = this.registerDataOutput(\"pickedMesh\", RichTypeAny);\r\n this.pointerType = this.registerDataInput(\"pointerType\", RichTypeAny, PointerEventTypes.POINTERPICK);\r\n }\r\n\r\n public _getReferencedMesh(context: FlowGraphContext): AbstractMesh {\r\n return this.asset.getValue(context);\r\n }\r\n\r\n public override _executeEvent(context: FlowGraphContext, pickedInfo: PointerInfo): boolean {\r\n // get the pointer type\r\n const pointerType = this.pointerType.getValue(context);\r\n if (pointerType !== pickedInfo.type) {\r\n // returning true here to continue the propagation of the pointer event to the rest of the blocks\r\n return true;\r\n }\r\n const mesh = this._getReferencedMesh(context);\r\n const pickedMesh = pickedInfo.pickInfo?.pickedMesh;\r\n // When no target mesh is configured, fire for any picked mesh.\r\n // When a target is configured, require an exact match or descendant match.\r\n // Match by reference first, then by descendant, then by stable name/id as a\r\n // fallback for scene reloads where the object reference changes but the mesh\r\n // identity (name) is preserved (uniqueId increments monotonically and is NOT\r\n // stable across reloads).\r\n const meshMatches = !mesh ? !!pickedMesh : !!(pickedMesh && (pickedMesh === mesh || _IsDescendantOf(pickedMesh, mesh) || pickedMesh.name === mesh.name));\r\n if (meshMatches && pickedMesh) {\r\n this.pointerId.setValue((pickedInfo.event as PointerEvent).pointerId, context);\r\n this.pickOrigin.setValue(pickedInfo.pickInfo!.ray?.origin!, context);\r\n this.pickedPoint.setValue(pickedInfo.pickInfo!.pickedPoint!, context);\r\n this.pickedMesh.setValue(pickedMesh, context);\r\n this._execute(context);\r\n // stop the propagation if the configuration says so\r\n return !this.config?.stopPropagation;\r\n } else {\r\n // reset the outputs\r\n this.pointerId.resetToDefaultValue(context);\r\n this.pickOrigin.resetToDefaultValue(context);\r\n this.pickedPoint.resetToDefaultValue(context);\r\n this.pickedMesh.resetToDefaultValue(context);\r\n }\r\n return true;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _preparePendingTasks(_context: FlowGraphContext): void {\r\n // no-op\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _cancelPendingTasks(_context: FlowGraphContext): void {\r\n // no-op\r\n }\r\n\r\n /**\r\n * @returns class name of the block.\r\n */\r\n public override getClassName(): string {\r\n return FlowGraphBlockNames.MeshPickEvent;\r\n }\r\n}\r\nRegisterClass(FlowGraphBlockNames.MeshPickEvent, FlowGraphMeshPickEventBlock);\r\n"]}
1
+ {"version":3,"file":"flowGraphMeshPickEventBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,C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CAAC,CAAC;YAC5C,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;YAC7C,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;YAC9C,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;QACjD,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACa,oBAAoB,CAAC,QAA0B;QAC3D,QAAQ;IACZ,CAAC;IAED;;OAEG;IACa,mBAAmB,CAAC,QAA0B;QAC1D,QAAQ;IACZ,CAAC;IAED;;OAEG;IACa,YAAY;QACxB,6EAAyC;IAC7C,CAAC;CACJ;AACD,aAAa,wEAAoC,2BAA2B,CAAC,CAAC","sourcesContent":["import { type AbstractMesh } from \"../../../Meshes/abstractMesh\";\r\nimport { FlowGraphEventBlock } from \"../../flowGraphEventBlock\";\r\nimport { type PointerInfo, PointerEventTypes } from \"../../../Events/pointerEvents\";\r\nimport { type IPointerEvent } from \"../../../Events/deviceInputEvents\";\r\nimport { type FlowGraphContext } from \"../../flowGraphContext\";\r\nimport { type IFlowGraphBlockConfiguration } from \"../../flowGraphBlock\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { _IsDescendantOf } from \"../../utils\";\r\nimport { FlowGraphBlockNames } from \"../flowGraphBlockNames\";\r\nimport { type FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection\";\r\nimport { RichTypeAny, RichTypeNumber, RichTypeVector3 } from \"core/FlowGraph/flowGraphRichTypes\";\r\nimport { type Vector3 } from \"core/Maths/math.vector\";\r\nimport { FlowGraphEventType } from \"core/FlowGraph/flowGraphEventType\";\r\n/**\r\n * Configuration for the mesh pick event block.\r\n */\r\nexport interface IFlowGraphMeshPickEventBlockConfiguration extends IFlowGraphBlockConfiguration {\r\n /**\r\n * Should this mesh block propagation of the event.\r\n */\r\n stopPropagation?: boolean;\r\n\r\n /**\r\n * The mesh to listen to. Can also be set by the asset input.\r\n */\r\n targetMesh?: AbstractMesh;\r\n}\r\n/**\r\n * A block that activates when a mesh is picked.\r\n */\r\nexport class FlowGraphMeshPickEventBlock extends FlowGraphEventBlock {\r\n /**\r\n * Input connection: The mesh to listen to.\r\n */\r\n public readonly asset: FlowGraphDataConnection<AbstractMesh>;\r\n\r\n /**\r\n * Output connection: The picked point.\r\n */\r\n public readonly pickedPoint: FlowGraphDataConnection<Vector3>;\r\n\r\n /**\r\n * Output connection: The picked origin.\r\n */\r\n public readonly pickOrigin: FlowGraphDataConnection<Vector3>;\r\n\r\n /**\r\n * Output connection: The pointer id.\r\n */\r\n public readonly pointerId: FlowGraphDataConnection<number>;\r\n\r\n /**\r\n * Output connection: The picked mesh. Possibly NOT the same as the asset (could be a descendant).\r\n */\r\n public readonly pickedMesh: FlowGraphDataConnection<AbstractMesh>;\r\n\r\n /**\r\n * Input connection: The type of the pointer event.\r\n */\r\n public readonly pointerType: FlowGraphDataConnection<PointerEventTypes>;\r\n\r\n /**\r\n * the type of the event this block reacts to\r\n */\r\n public override readonly type: FlowGraphEventType = FlowGraphEventType.MeshPick;\r\n\r\n public constructor(\r\n /**\r\n * the configuration of the block\r\n */\r\n public override config?: IFlowGraphMeshPickEventBlockConfiguration\r\n ) {\r\n super(config);\r\n this.asset = this.registerDataInput(\"asset\", RichTypeAny, config?.targetMesh);\r\n this.pickedPoint = this.registerDataOutput(\"pickedPoint\", RichTypeVector3);\r\n this.pickOrigin = this.registerDataOutput(\"pickOrigin\", RichTypeVector3);\r\n this.pointerId = this.registerDataOutput(\"pointerId\", RichTypeNumber);\r\n this.pickedMesh = this.registerDataOutput(\"pickedMesh\", RichTypeAny);\r\n this.pointerType = this.registerDataInput(\"pointerType\", RichTypeAny, PointerEventTypes.POINTERPICK);\r\n }\r\n\r\n public _getReferencedMesh(context: FlowGraphContext): AbstractMesh {\r\n return this.asset.getValue(context);\r\n }\r\n\r\n public override _executeEvent(context: FlowGraphContext, pickedInfo: PointerInfo): boolean {\r\n // get the pointer type\r\n const pointerType = this.pointerType.getValue(context);\r\n if (pointerType !== pickedInfo.type) {\r\n // returning true here to continue the propagation of the pointer event to the rest of the blocks\r\n return true;\r\n }\r\n const mesh = this._getReferencedMesh(context);\r\n const pickedMesh = pickedInfo.pickInfo?.pickedMesh;\r\n // When no target mesh is configured, fire for any picked mesh.\r\n // When a target is configured, require an exact match or descendant match.\r\n // Match by reference first, then by descendant, then by stable name/id as a\r\n // fallback for scene reloads where the object reference changes but the mesh\r\n // identity (name) is preserved (uniqueId increments monotonically and is NOT\r\n // stable across reloads).\r\n const meshMatches = !mesh ? !!pickedMesh : !!(pickedMesh && (pickedMesh === mesh || _IsDescendantOf(pickedMesh, mesh) || pickedMesh.name === mesh.name));\r\n if (meshMatches && pickedMesh) {\r\n this.pointerId.setValue((pickedInfo.event as IPointerEvent).pointerId, context);\r\n this.pickOrigin.setValue(pickedInfo.pickInfo!.ray?.origin!, context);\r\n this.pickedPoint.setValue(pickedInfo.pickInfo!.pickedPoint!, context);\r\n this.pickedMesh.setValue(pickedMesh, context);\r\n this._execute(context);\r\n // stop the propagation if the configuration says so\r\n return !this.config?.stopPropagation;\r\n } else {\r\n // reset the outputs\r\n this.pointerId.resetToDefaultValue(context);\r\n this.pickOrigin.resetToDefaultValue(context);\r\n this.pickedPoint.resetToDefaultValue(context);\r\n this.pickedMesh.resetToDefaultValue(context);\r\n }\r\n return true;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _preparePendingTasks(_context: FlowGraphContext): void {\r\n // no-op\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _cancelPendingTasks(_context: FlowGraphContext): void {\r\n // no-op\r\n }\r\n\r\n /**\r\n * @returns class name of the block.\r\n */\r\n public override getClassName(): string {\r\n return FlowGraphBlockNames.MeshPickEvent;\r\n }\r\n}\r\nRegisterClass(FlowGraphBlockNames.MeshPickEvent, FlowGraphMeshPickEventBlock);\r\n"]}
@@ -1 +1 @@
1
- {"version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;YACtF,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAE,WAAW,CAAC,KAAsB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAChF,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,UAAU,IAAI,IAAI,EAAE,OAAO,CAAC,CAAC;QACtD,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,WAAW,IAAI,IAAI,EAAE,OAAO,CAAC,CAAC;QAC9E,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACvB,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,eAAe,CAAC;IACzC,CAAC;IAED,gBAAgB;IACA,oBAAoB,CAAC,QAA0B;QAC3D,QAAQ;IACZ,CAAC;IAED,gBAAgB;IACA,mBAAmB,CAAC,QAA0B;QAC1D,QAAQ;IACZ,CAAC;IAED;;OAEG;IACa,YAAY;QACxB,mFAA4C;IAChD,CAAC;CACJ;AAED,aAAa,8EAAuC,8BAA8B,CAAC,CAAC","sourcesContent":["import { type AbstractMesh } from \"core/Meshes/abstractMesh\";\nimport { FlowGraphEventBlock } from \"core/FlowGraph/flowGraphEventBlock\";\nimport { type PointerInfo } from \"core/Events/pointerEvents\";\nimport { type FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport { type IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\nimport { _IsDescendantOf } from \"core/FlowGraph/utils\";\nimport { FlowGraphBlockNames } from \"../flowGraphBlockNames\";\nimport { type FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection\";\nimport { RichTypeAny, RichTypeNumber } from \"core/FlowGraph/flowGraphRichTypes\";\nimport { type Vector3 } from \"core/Maths/math.vector\";\nimport { FlowGraphEventType } from \"core/FlowGraph/flowGraphEventType\";\nimport { type Nullable } from \"core/types\";\n\n/**\n * Configuration for the pointer down event block.\n */\nexport interface IFlowGraphPointerDownEventBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * Should this block stop propagation of the event to other listeners.\n */\n stopPropagation?: boolean;\n\n /**\n * Optional mesh to filter events to. If set, the block only fires when the pointer\n * is pressed on this mesh or a descendant of it. If not set, fires on any pointer down.\n */\n targetMesh?: AbstractMesh;\n}\n\n/**\n * A pointer down event block.\n * This block fires when a pointer is pressed (mouse button down / touch start).\n * Optionally filters to a specific mesh via the `targetMesh` input.\n */\nexport class FlowGraphPointerDownEventBlock extends FlowGraphEventBlock {\n /**\n * Optional input connection: restrict firing to this mesh (and its descendants).\n * Leave disconnected to fire on any pointer down.\n */\n public readonly targetMesh: FlowGraphDataConnection<AbstractMesh>;\n\n /**\n * Output connection: The id of the pointer that triggered the event.\n */\n public readonly pointerId: FlowGraphDataConnection<number>;\n\n /**\n * Output connection: The mesh that was picked (if any).\n */\n public readonly pickedMesh: FlowGraphDataConnection<Nullable<AbstractMesh>>;\n\n /**\n * Output connection: The world-space point that was picked (if any).\n */\n public readonly pickedPoint: FlowGraphDataConnection<Nullable<Vector3>>;\n\n /** @internal */\n public override readonly type: FlowGraphEventType = FlowGraphEventType.PointerDown;\n\n /**\n * Creates a new FlowGraphPointerDownEventBlock.\n * @param config optional configuration\n */\n public constructor(config?: IFlowGraphPointerDownEventBlockConfiguration) {\n super(config);\n this.targetMesh = this.registerDataInput(\"targetMesh\", RichTypeAny, config?.targetMesh);\n this.pointerId = this.registerDataOutput(\"pointerId\", RichTypeNumber);\n this.pickedMesh = this.registerDataOutput(\"pickedMesh\", RichTypeAny);\n this.pickedPoint = this.registerDataOutput(\"pickedPoint\", RichTypeAny);\n }\n\n /** @internal */\n public override _executeEvent(context: FlowGraphContext, pointerInfo: PointerInfo): boolean {\n const mesh = this.targetMesh.getValue(context);\n const pickedMesh = pointerInfo.pickInfo?.pickedMesh;\n\n // If a target mesh is set, only fire when that mesh (or a descendant) is picked.\n if (mesh && !(pickedMesh === mesh || (pickedMesh && _IsDescendantOf(pickedMesh, mesh)))) {\n return true;\n }\n\n this.pointerId.setValue((pointerInfo.event as PointerEvent).pointerId, context);\n this.pickedMesh.setValue(pickedMesh ?? null, context);\n this.pickedPoint.setValue(pointerInfo.pickInfo?.pickedPoint ?? null, context);\n this._execute(context);\n return !this.config?.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 /**\n * @returns the class name of the block.\n */\n public override getClassName(): string {\n return FlowGraphBlockNames.PointerDownEvent;\n }\n}\n\nRegisterClass(FlowGraphBlockNames.PointerDownEvent, FlowGraphPointerDownEventBlock);\n"]}
1
+ {"version":3,"file":"flowGraphPointerDownEventBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FlowGraph/Blocks/Event/flowGraphPointerDownEventBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAKzE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAqBhF;;;;GAIG;AACH,MAAM,OAAO,8BAA+B,SAAQ,mBAAmB;IAyBnE;;;OAGG;IACH,YAAmB,MAAqD;QACpE,KAAK,CAAC,MAAM,CAAC,CAAC;QARlB,gBAAgB;QACS,SAAI,sDAAsD;QAQ/E,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,iBAAiB,CAAC,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;QACxF,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,kBAAkB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QACtE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,kBAAkB,CA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ph/flowGraphEventBlock\";\nimport { type PointerInfo } from \"core/Events/pointerEvents\";\nimport { type IPointerEvent } from \"core/Events/deviceInputEvents\";\nimport { type FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport { type IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\nimport { _IsDescendantOf } from \"core/FlowGraph/utils\";\nimport { FlowGraphBlockNames } from \"../flowGraphBlockNames\";\nimport { type FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection\";\nimport { RichTypeAny, RichTypeNumber } from \"core/FlowGraph/flowGraphRichTypes\";\nimport { type Vector3 } from \"core/Maths/math.vector\";\nimport { FlowGraphEventType } from \"core/FlowGraph/flowGraphEventType\";\nimport { type Nullable } from \"core/types\";\n\n/**\n * Configuration for the pointer down event block.\n */\nexport interface IFlowGraphPointerDownEventBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * Should this block stop propagation of the event to other listeners.\n */\n stopPropagation?: boolean;\n\n /**\n * Optional mesh to filter events to. If set, the block only fires when the pointer\n * is pressed on this mesh or a descendant of it. If not set, fires on any pointer down.\n */\n targetMesh?: AbstractMesh;\n}\n\n/**\n * A pointer down event block.\n * This block fires when a pointer is pressed (mouse button down / touch start).\n * Optionally filters to a specific mesh via the `targetMesh` input.\n */\nexport class FlowGraphPointerDownEventBlock extends FlowGraphEventBlock {\n /**\n * Optional input connection: restrict firing to this mesh (and its descendants).\n * Leave disconnected to fire on any pointer down.\n */\n public readonly targetMesh: FlowGraphDataConnection<AbstractMesh>;\n\n /**\n * Output connection: The id of the pointer that triggered the event.\n */\n public readonly pointerId: FlowGraphDataConnection<number>;\n\n /**\n * Output connection: The mesh that was picked (if any).\n */\n public readonly pickedMesh: FlowGraphDataConnection<Nullable<AbstractMesh>>;\n\n /**\n * Output connection: The world-space point that was picked (if any).\n */\n public readonly pickedPoint: FlowGraphDataConnection<Nullable<Vector3>>;\n\n /** @internal */\n public override readonly type: FlowGraphEventType = FlowGraphEventType.PointerDown;\n\n /**\n * Creates a new FlowGraphPointerDownEventBlock.\n * @param config optional configuration\n */\n public constructor(config?: IFlowGraphPointerDownEventBlockConfiguration) {\n super(config);\n this.targetMesh = this.registerDataInput(\"targetMesh\", RichTypeAny, config?.targetMesh);\n this.pointerId = this.registerDataOutput(\"pointerId\", RichTypeNumber);\n this.pickedMesh = this.registerDataOutput(\"pickedMesh\", RichTypeAny);\n this.pickedPoint = this.registerDataOutput(\"pickedPoint\", RichTypeAny);\n }\n\n /** @internal */\n public override _executeEvent(context: FlowGraphContext, pointerInfo: PointerInfo): boolean {\n const mesh = this.targetMesh.getValue(context);\n const pickedMesh = pointerInfo.pickInfo?.pickedMesh;\n\n // If a target mesh is set, only fire when that mesh (or a descendant) is picked.\n if (mesh && !(pickedMesh === mesh || (pickedMesh && _IsDescendantOf(pickedMesh, mesh)))) {\n return true;\n }\n\n this.pointerId.setValue((pointerInfo.event as IPointerEvent).pointerId, context);\n this.pickedMesh.setValue(pickedMesh ?? null, context);\n this.pickedPoint.setValue(pointerInfo.pickInfo?.pickedPoint ?? null, context);\n this._execute(context);\n return !this.config?.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 /**\n * @returns the class name of the block.\n */\n public override getClassName(): string {\n return FlowGraphBlockNames.PointerDownEvent;\n }\n}\n\nRegisterClass(FlowGraphBlockNames.PointerDownEvent, FlowGraphPointerDownEventBlock);\n"]}