@babylonjs/core 5.28.0 → 5.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Actions/actionManager.js +2 -0
- package/Actions/actionManager.js.map +1 -1
- package/Cameras/camera.js +4 -4
- package/Cameras/camera.js.map +1 -1
- package/Collisions/pickingInfo.d.ts +0 -2
- package/Collisions/pickingInfo.js +0 -2
- package/Collisions/pickingInfo.js.map +1 -1
- package/Culling/ray.js +5 -0
- package/Culling/ray.js.map +1 -1
- package/Engines/Extensions/engine.videoTexture.js +6 -3
- package/Engines/Extensions/engine.videoTexture.js.map +1 -1
- package/Engines/renderTargetWrapper.d.ts +2 -1
- package/Engines/renderTargetWrapper.js +1 -0
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/thinEngine.js +2 -2
- package/Engines/thinEngine.js.map +1 -1
- package/Events/pointerEvents.d.ts +11 -6
- package/Events/pointerEvents.js +24 -6
- package/Events/pointerEvents.js.map +1 -1
- package/Inputs/scene.inputManager.d.ts +9 -1
- package/Inputs/scene.inputManager.js +76 -37
- package/Inputs/scene.inputManager.js.map +1 -1
- package/Layers/effectLayer.js +2 -6
- package/Layers/effectLayer.js.map +1 -1
- package/Materials/PBR/pbrMetallicRoughnessMaterial.d.ts +1 -1
- package/Materials/PBR/pbrMetallicRoughnessMaterial.js +1 -1
- package/Materials/PBR/pbrMetallicRoughnessMaterial.js.map +1 -1
- package/Materials/Textures/htmlElementTexture.d.ts +5 -0
- package/Materials/Textures/htmlElementTexture.js +4 -1
- package/Materials/Textures/htmlElementTexture.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.d.ts +1 -1
- package/Materials/Textures/renderTargetTexture.js +2 -2
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/videoTexture.d.ts +6 -1
- package/Materials/Textures/videoTexture.js +7 -2
- package/Materials/Textures/videoTexture.js.map +1 -1
- package/Maths/math.vector.d.ts +390 -319
- package/Maths/math.vector.js +298 -153
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Builders/decalBuilder.d.ts +8 -0
- package/Meshes/Builders/decalBuilder.js +270 -51
- package/Meshes/Builders/decalBuilder.js.map +1 -1
- package/Meshes/mesh.js +40 -0
- package/Meshes/mesh.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.d.ts +14 -8
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +16 -6
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
- package/PostProcesses/blurPostProcess.d.ts +2 -1
- package/PostProcesses/blurPostProcess.js +3 -2
- package/PostProcesses/blurPostProcess.js.map +1 -1
- package/PostProcesses/circleOfConfusionPostProcess.js +2 -1
- package/PostProcesses/circleOfConfusionPostProcess.js.map +1 -1
- package/PostProcesses/depthOfFieldBlurPostProcess.d.ts +2 -1
- package/PostProcesses/depthOfFieldBlurPostProcess.js +3 -5
- package/PostProcesses/depthOfFieldBlurPostProcess.js.map +1 -1
- package/PostProcesses/depthOfFieldEffect.js +9 -4
- package/PostProcesses/depthOfFieldEffect.js.map +1 -1
- package/PostProcesses/depthOfFieldMergePostProcess.js.map +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.js +2 -6
- package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
- package/Rendering/depthRenderer.js +2 -6
- package/Rendering/depthRenderer.js.map +1 -1
- package/Rendering/geometryBufferRenderer.js +2 -6
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Rendering/renderingGroup.d.ts +4 -0
- package/Rendering/renderingGroup.js +7 -1
- package/Rendering/renderingGroup.js.map +1 -1
- package/Rendering/renderingManager.d.ts +5 -0
- package/Rendering/renderingManager.js +15 -0
- package/Rendering/renderingManager.js.map +1 -1
- package/Shaders/circleOfConfusion.fragment.js +1 -1
- package/Shaders/circleOfConfusion.fragment.js.map +1 -1
- package/Shaders/depthOfFieldMerge.fragment.js +1 -1
- package/Shaders/depthOfFieldMerge.fragment.js.map +1 -1
- package/Shaders/kernelBlur.fragment.js +2 -2
- package/Shaders/kernelBlur.fragment.js.map +1 -1
- package/XR/webXRRenderTargetTextureProvider.js +1 -0
- package/XR/webXRRenderTargetTextureProvider.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +5 -0
- package/scene.js +10 -6
- package/scene.js.map +1 -1
|
@@ -2,6 +2,7 @@ import type { Nullable } from "../types";
|
|
|
2
2
|
import { Vector2 } from "../Maths/math.vector";
|
|
3
3
|
import type { PickingInfo } from "../Collisions/pickingInfo";
|
|
4
4
|
import type { IMouseEvent } from "./deviceInputEvents";
|
|
5
|
+
import type { InputManager } from "../Inputs/scene.inputManager";
|
|
5
6
|
declare type Ray = import("../Culling/ray").Ray;
|
|
6
7
|
/**
|
|
7
8
|
* Gather the list of pointer event types as constants.
|
|
@@ -102,21 +103,25 @@ export declare class PointerInfoPre extends PointerInfoBase {
|
|
|
102
103
|
* The event member is an instance of PointerEvent for all types except PointerWheel and is of type MouseWheelEvent when type equals PointerWheel. The different event types can be found in the PointerEventTypes class.
|
|
103
104
|
*/
|
|
104
105
|
export declare class PointerInfo extends PointerInfoBase {
|
|
106
|
+
private _pickInfo;
|
|
107
|
+
private _inputManager;
|
|
105
108
|
/**
|
|
106
|
-
* Defines the picking info associated
|
|
109
|
+
* Defines the picking info associated with this PointerInfo object (if applicable)
|
|
107
110
|
*/
|
|
108
|
-
pickInfo: Nullable<PickingInfo>;
|
|
111
|
+
get pickInfo(): Nullable<PickingInfo>;
|
|
109
112
|
/**
|
|
110
113
|
* Instantiates a PointerInfo to store pointer related info to the onPointerObservable event.
|
|
111
114
|
* @param type Defines the type of event (PointerEventTypes)
|
|
112
115
|
* @param event Defines the related dom event
|
|
113
|
-
* @param pickInfo Defines the picking info associated to the info (if any)
|
|
116
|
+
* @param pickInfo Defines the picking info associated to the info (if any)
|
|
117
|
+
* @param inputManager Defines the InputManager to use if there is no pickInfo
|
|
114
118
|
*/
|
|
115
|
-
constructor(type: number, event: IMouseEvent,
|
|
119
|
+
constructor(type: number, event: IMouseEvent, pickInfo: Nullable<PickingInfo>, inputManager?: Nullable<InputManager>);
|
|
116
120
|
/**
|
|
117
|
-
*
|
|
121
|
+
* Generates the picking info if needed
|
|
118
122
|
*/
|
|
119
|
-
|
|
123
|
+
/** @internal */
|
|
124
|
+
_generatePickInfo(): void;
|
|
120
125
|
}
|
|
121
126
|
/**
|
|
122
127
|
* Data relating to a touch event on the screen.
|
package/Events/pointerEvents.js
CHANGED
|
@@ -89,15 +89,33 @@ export class PointerInfo extends PointerInfoBase {
|
|
|
89
89
|
* Instantiates a PointerInfo to store pointer related info to the onPointerObservable event.
|
|
90
90
|
* @param type Defines the type of event (PointerEventTypes)
|
|
91
91
|
* @param event Defines the related dom event
|
|
92
|
-
* @param pickInfo Defines the picking info associated to the info (if any)
|
|
92
|
+
* @param pickInfo Defines the picking info associated to the info (if any)
|
|
93
|
+
* @param inputManager Defines the InputManager to use if there is no pickInfo
|
|
93
94
|
*/
|
|
94
|
-
constructor(type, event,
|
|
95
|
+
constructor(type, event, pickInfo, inputManager = null) {
|
|
96
|
+
super(type, event);
|
|
97
|
+
this._pickInfo = pickInfo;
|
|
98
|
+
this._inputManager = inputManager;
|
|
99
|
+
}
|
|
95
100
|
/**
|
|
96
|
-
* Defines the picking info associated
|
|
101
|
+
* Defines the picking info associated with this PointerInfo object (if applicable)
|
|
97
102
|
*/
|
|
98
|
-
pickInfo) {
|
|
99
|
-
|
|
100
|
-
|
|
103
|
+
get pickInfo() {
|
|
104
|
+
if (!this._pickInfo) {
|
|
105
|
+
this._generatePickInfo();
|
|
106
|
+
}
|
|
107
|
+
return this._pickInfo;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Generates the picking info if needed
|
|
111
|
+
*/
|
|
112
|
+
/** @internal */
|
|
113
|
+
_generatePickInfo() {
|
|
114
|
+
if (this._inputManager) {
|
|
115
|
+
this._pickInfo = this._inputManager._pickMove(this.event.pointerId);
|
|
116
|
+
this._inputManager._setRayOnPointerInfo(this._pickInfo, this.event);
|
|
117
|
+
this._inputManager = null;
|
|
118
|
+
}
|
|
101
119
|
}
|
|
102
120
|
}
|
|
103
121
|
//# sourceMappingURL=pointerEvents.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pointerEvents.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Events/pointerEvents.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"pointerEvents.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Events/pointerEvents.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAO/C;;GAEG;AACH,MAAM,OAAO,iBAAiB;;AAC1B;;GAEG;AACoB,6BAAW,GAAG,IAAI,CAAC;AAC1C;;GAEG;AACoB,2BAAS,GAAG,IAAI,CAAC;AACxC;;GAEG;AACoB,6BAAW,GAAG,IAAI,CAAC;AAC1C;;GAEG;AACoB,8BAAY,GAAG,IAAI,CAAC;AAC3C;;GAEG;AACoB,6BAAW,GAAG,IAAI,CAAC;AAC1C;;GAEG;AACoB,4BAAU,GAAG,IAAI,CAAC;AACzC;;GAEG;AACoB,kCAAgB,GAAG,IAAI,CAAC;AAGnD;;GAEG;AACH,MAAM,OAAO,eAAe;IACxB;;;;OAIG;IACH;IACI;;OAEG;IACI,IAAY;IACnB;;OAEG;IACI,KAAkB;QAJlB,SAAI,GAAJ,IAAI,CAAQ;QAIZ,UAAK,GAAL,KAAK,CAAa;IAC1B,CAAC;CACP;AAED;;;GAGG;AACH,MAAM,OAAO,cAAe,SAAQ,eAAe;IA0B/C;;;;;;OAMG;IACH,YAAY,IAAY,EAAE,KAAkB,EAAE,MAAc,EAAE,MAAc;QACxE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAjCvB;;WAEG;QACI,QAAG,GAAkB,IAAI,CAAC;QAOjC;;WAEG;QACI,wBAAmB,GAA0B,IAAI,CAAC;QAqBrD,IAAI,CAAC,uBAAuB,GAAG,KAAK,CAAC;QACrC,IAAI,CAAC,aAAa,GAAG,IAAI,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrD,CAAC;CACJ;AAED;;;GAGG;AACH,MAAM,OAAO,WAAY,SAAQ,eAAe;IAc5C;;;;;;OAMG;IACH,YAAY,IAAY,EAAE,KAAkB,EAAE,QAA+B,EAAE,eAAuC,IAAI;QACtH,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACnB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;IACtC,CAAC;IArBD;;OAEG;IACH,IAAW,QAAQ;QACf,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACjB,IAAI,CAAC,iBAAiB,EAAE,CAAC;SAC5B;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAcD;;OAEG;IACH,gBAAgB;IACT,iBAAiB;QACpB,IAAI,IAAI,CAAC,aAAa,EAAE;YACpB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAE,IAAI,CAAC,KAAuB,CAAC,SAAS,CAAC,CAAC;YACvF,IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YACpE,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;SAC7B;IACL,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { Vector2 } from \"../Maths/math.vector\";\r\nimport type { PickingInfo } from \"../Collisions/pickingInfo\";\r\nimport type { IMouseEvent, IPointerEvent } from \"./deviceInputEvents\";\r\nimport type { InputManager } from \"../Inputs/scene.inputManager\";\r\n\r\ndeclare type Ray = import(\"../Culling/ray\").Ray;\r\n\r\n/**\r\n * Gather the list of pointer event types as constants.\r\n */\r\nexport class PointerEventTypes {\r\n /**\r\n * The pointerdown event is fired when a pointer becomes active. For mouse, it is fired when the device transitions from no buttons depressed to at least one button depressed. For touch, it is fired when physical contact is made with the digitizer. For pen, it is fired when the stylus makes physical contact with the digitizer.\r\n */\r\n public static readonly POINTERDOWN = 0x01;\r\n /**\r\n * The pointerup event is fired when a pointer is no longer active.\r\n */\r\n public static readonly POINTERUP = 0x02;\r\n /**\r\n * The pointermove event is fired when a pointer changes coordinates.\r\n */\r\n public static readonly POINTERMOVE = 0x04;\r\n /**\r\n * The pointerwheel event is fired when a mouse wheel has been rotated.\r\n */\r\n public static readonly POINTERWHEEL = 0x08;\r\n /**\r\n * The pointerpick event is fired when a mesh or sprite has been picked by the pointer.\r\n */\r\n public static readonly POINTERPICK = 0x10;\r\n /**\r\n * The pointertap event is fired when a the object has been touched and released without drag.\r\n */\r\n public static readonly POINTERTAP = 0x20;\r\n /**\r\n * The pointerdoubletap event is fired when a the object has been touched and released twice without drag.\r\n */\r\n public static readonly POINTERDOUBLETAP = 0x40;\r\n}\r\n\r\n/**\r\n * Base class of pointer info types.\r\n */\r\nexport class PointerInfoBase {\r\n /**\r\n * Instantiates the base class of pointers info.\r\n * @param type Defines the type of event (PointerEventTypes)\r\n * @param event Defines the related dom event\r\n */\r\n constructor(\r\n /**\r\n * Defines the type of event (PointerEventTypes)\r\n */\r\n public type: number,\r\n /**\r\n * Defines the related dom event\r\n */\r\n public event: IMouseEvent\r\n ) {}\r\n}\r\n\r\n/**\r\n * This class is used to store pointer related info for the onPrePointerObservable event.\r\n * Set the skipOnPointerObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onPointerObservable\r\n */\r\nexport class PointerInfoPre extends PointerInfoBase {\r\n /**\r\n * Ray from a pointer if available (eg. 6dof controller)\r\n */\r\n public ray: Nullable<Ray> = null;\r\n\r\n /**\r\n * Defines picking info coming from a near interaction (proximity instead of ray-based picking)\r\n */\r\n public nearInteractionPickingInfo: Nullable<PickingInfo>;\r\n\r\n /**\r\n * The original picking info that was used to trigger the pointer event\r\n */\r\n public originalPickingInfo: Nullable<PickingInfo> = null;\r\n\r\n /**\r\n * Defines the local position of the pointer on the canvas.\r\n */\r\n public localPosition: Vector2;\r\n\r\n /**\r\n * Defines whether the engine should skip the next OnPointerObservable associated to this pre.\r\n */\r\n public skipOnPointerObservable: boolean;\r\n\r\n /**\r\n * Instantiates a PointerInfoPre to store pointer related info to the onPrePointerObservable event.\r\n * @param type Defines the type of event (PointerEventTypes)\r\n * @param event Defines the related dom event\r\n * @param localX Defines the local x coordinates of the pointer when the event occured\r\n * @param localY Defines the local y coordinates of the pointer when the event occured\r\n */\r\n constructor(type: number, event: IMouseEvent, localX: number, localY: number) {\r\n super(type, event);\r\n this.skipOnPointerObservable = false;\r\n this.localPosition = new Vector2(localX, localY);\r\n }\r\n}\r\n\r\n/**\r\n * This type contains all the data related to a pointer event in Babylon.js.\r\n * The event member is an instance of PointerEvent for all types except PointerWheel and is of type MouseWheelEvent when type equals PointerWheel. The different event types can be found in the PointerEventTypes class.\r\n */\r\nexport class PointerInfo extends PointerInfoBase {\r\n private _pickInfo: Nullable<PickingInfo>;\r\n private _inputManager: Nullable<InputManager>;\r\n\r\n /**\r\n * Defines the picking info associated with this PointerInfo object (if applicable)\r\n */\r\n public get pickInfo(): Nullable<PickingInfo> {\r\n if (!this._pickInfo) {\r\n this._generatePickInfo();\r\n }\r\n\r\n return this._pickInfo;\r\n }\r\n /**\r\n * Instantiates a PointerInfo to store pointer related info to the onPointerObservable event.\r\n * @param type Defines the type of event (PointerEventTypes)\r\n * @param event Defines the related dom event\r\n * @param pickInfo Defines the picking info associated to the info (if any)\r\n * @param inputManager Defines the InputManager to use if there is no pickInfo\r\n */\r\n constructor(type: number, event: IMouseEvent, pickInfo: Nullable<PickingInfo>, inputManager: Nullable<InputManager> = null) {\r\n super(type, event);\r\n this._pickInfo = pickInfo;\r\n this._inputManager = inputManager;\r\n }\r\n\r\n /**\r\n * Generates the picking info if needed\r\n */\r\n /** @internal */\r\n public _generatePickInfo(): void {\r\n if (this._inputManager) {\r\n this._pickInfo = this._inputManager._pickMove((this.event as IPointerEvent).pointerId);\r\n this._inputManager._setRayOnPointerInfo(this._pickInfo, this.event);\r\n this._inputManager = null;\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Data relating to a touch event on the screen.\r\n */\r\nexport interface PointerTouch {\r\n /**\r\n * X coordinate of touch.\r\n */\r\n x: number;\r\n /**\r\n * Y coordinate of touch.\r\n */\r\n y: number;\r\n /**\r\n * Id of touch. Unique for each finger.\r\n */\r\n pointerId: number;\r\n /**\r\n * Event type passed from DOM.\r\n */\r\n type: any;\r\n}\r\n"]}
|
|
@@ -2,6 +2,7 @@ import type { Nullable } from "../types";
|
|
|
2
2
|
import { PickingInfo } from "../Collisions/pickingInfo";
|
|
3
3
|
import { Vector2 } from "../Maths/math.vector";
|
|
4
4
|
import type { AbstractMesh } from "../Meshes/abstractMesh";
|
|
5
|
+
import type { IMouseEvent } from "../Events/deviceInputEvents";
|
|
5
6
|
declare type Scene = import("../scene").Scene;
|
|
6
7
|
/**
|
|
7
8
|
* Class used to manage all inputs for the scene.
|
|
@@ -32,6 +33,8 @@ export declare class InputManager {
|
|
|
32
33
|
private _previousPickResult;
|
|
33
34
|
private _totalPointersPressed;
|
|
34
35
|
private _doubleClickOccured;
|
|
36
|
+
private _isSwiping;
|
|
37
|
+
private _swipeButtonPressed;
|
|
35
38
|
private _pointerOverMesh;
|
|
36
39
|
private _pickedDownMesh;
|
|
37
40
|
private _pickedUpMesh;
|
|
@@ -45,6 +48,7 @@ export declare class InputManager {
|
|
|
45
48
|
private _previousStartingPointerTime;
|
|
46
49
|
private _pointerCaptures;
|
|
47
50
|
private _meshUnderPointerId;
|
|
51
|
+
private _movePointerInfo;
|
|
48
52
|
private _onKeyDown;
|
|
49
53
|
private _onKeyUp;
|
|
50
54
|
private _scene;
|
|
@@ -84,8 +88,12 @@ export declare class InputManager {
|
|
|
84
88
|
set pointerY(value: number);
|
|
85
89
|
private _updatePointerPosition;
|
|
86
90
|
private _processPointerMove;
|
|
87
|
-
|
|
91
|
+
/** @internal */
|
|
92
|
+
_setRayOnPointerInfo(pickInfo: Nullable<PickingInfo>, event: IMouseEvent): void;
|
|
88
93
|
private _checkPrePointerObservable;
|
|
94
|
+
/** @internal */
|
|
95
|
+
_pickMove(pointerId: number): Nullable<PickingInfo>;
|
|
96
|
+
private _setCursorAndPointerOverMesh;
|
|
89
97
|
/**
|
|
90
98
|
* Use this method to simulate a pointer move on a mesh
|
|
91
99
|
* The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay
|
|
@@ -58,6 +58,8 @@ export class InputManager {
|
|
|
58
58
|
this._previousPickResult = null;
|
|
59
59
|
this._totalPointersPressed = 0;
|
|
60
60
|
this._doubleClickOccured = false;
|
|
61
|
+
this._isSwiping = false;
|
|
62
|
+
this._swipeButtonPressed = -1;
|
|
61
63
|
this._pointerX = 0;
|
|
62
64
|
this._pointerY = 0;
|
|
63
65
|
this._startingPointerPosition = new Vector2(0, 0);
|
|
@@ -66,6 +68,7 @@ export class InputManager {
|
|
|
66
68
|
this._previousStartingPointerTime = 0;
|
|
67
69
|
this._pointerCaptures = {};
|
|
68
70
|
this._meshUnderPointerId = {};
|
|
71
|
+
this._movePointerInfo = null;
|
|
69
72
|
this._deviceSourceManager = null;
|
|
70
73
|
this._scene = scene || EngineStore.LastCreatedScene;
|
|
71
74
|
if (!this._scene) {
|
|
@@ -77,6 +80,13 @@ export class InputManager {
|
|
|
77
80
|
* @returns Mesh that the pointer is pointer is hovering over
|
|
78
81
|
*/
|
|
79
82
|
get meshUnderPointer() {
|
|
83
|
+
if (this._movePointerInfo) {
|
|
84
|
+
// Because _pointerOverMesh is populated as part of _pickMove, we need to force a pick to update it.
|
|
85
|
+
// Calling _pickMove calls _setCursorAndPointerOverMesh which calls setPointerOverMesh
|
|
86
|
+
this._movePointerInfo._generatePickInfo();
|
|
87
|
+
// Once we have what we need, we can clear _movePointerInfo because we don't need it anymore
|
|
88
|
+
this._movePointerInfo = null;
|
|
89
|
+
}
|
|
80
90
|
return this._pointerOverMesh;
|
|
81
91
|
}
|
|
82
92
|
/**
|
|
@@ -135,40 +145,35 @@ export class InputManager {
|
|
|
135
145
|
canvas.style.cursor = scene.defaultCursor;
|
|
136
146
|
}
|
|
137
147
|
}
|
|
138
|
-
|
|
139
|
-
if (isMeshPicked) {
|
|
140
|
-
scene.setPointerOverMesh(pickResult.pickedMesh, evt.pointerId, pickResult);
|
|
141
|
-
if (!scene.doNotHandleCursors && canvas && this._pointerOverMesh) {
|
|
142
|
-
const actionManager = this._pointerOverMesh._getActionManagerForTrigger();
|
|
143
|
-
if (actionManager && actionManager.hasPointerTriggers) {
|
|
144
|
-
canvas.style.cursor = actionManager.hoverCursor || scene.hoverCursor;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
scene.setPointerOverMesh(null, evt.pointerId, pickResult);
|
|
150
|
-
}
|
|
148
|
+
this._setCursorAndPointerOverMesh(pickResult, evt.pointerId, scene);
|
|
151
149
|
for (const step of scene._pointerMoveStage) {
|
|
150
|
+
const isMeshPicked = (pickResult === null || pickResult === void 0 ? void 0 : pickResult.pickedMesh) ? true : false;
|
|
152
151
|
pickResult = step.action(this._unTranslatedPointerX, this._unTranslatedPointerY, pickResult, isMeshPicked, canvas);
|
|
153
152
|
}
|
|
153
|
+
const type = evt.inputIndex >= PointerInput.MouseWheelX && evt.inputIndex <= PointerInput.MouseWheelZ ? PointerEventTypes.POINTERWHEEL : PointerEventTypes.POINTERMOVE;
|
|
154
|
+
if (scene.onPointerMove && pickResult) {
|
|
155
|
+
scene.onPointerMove(evt, pickResult, type);
|
|
156
|
+
}
|
|
157
|
+
let pointerInfo;
|
|
154
158
|
if (pickResult) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
159
|
+
pointerInfo = new PointerInfo(type, evt, pickResult);
|
|
160
|
+
this._setRayOnPointerInfo(pickResult, evt);
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
pointerInfo = new PointerInfo(type, evt, null, this);
|
|
164
|
+
this._movePointerInfo = pointerInfo;
|
|
165
|
+
}
|
|
166
|
+
if (scene.onPointerObservable.hasObservers()) {
|
|
167
|
+
scene.onPointerObservable.notifyObservers(pointerInfo, type);
|
|
164
168
|
}
|
|
165
169
|
}
|
|
166
170
|
// Pointers handling
|
|
167
|
-
|
|
171
|
+
/** @internal */
|
|
172
|
+
_setRayOnPointerInfo(pickInfo, event) {
|
|
168
173
|
const scene = this._scene;
|
|
169
|
-
if (
|
|
170
|
-
if (!
|
|
171
|
-
|
|
174
|
+
if (pickInfo && scene._pickingAvailable) {
|
|
175
|
+
if (!pickInfo.ray) {
|
|
176
|
+
pickInfo.ray = scene.createPickingRay(event.offsetX, event.offsetY, Matrix.Identity(), scene.activeCamera);
|
|
172
177
|
}
|
|
173
178
|
}
|
|
174
179
|
}
|
|
@@ -190,6 +195,29 @@ export class InputManager {
|
|
|
190
195
|
return false;
|
|
191
196
|
}
|
|
192
197
|
}
|
|
198
|
+
/** @internal */
|
|
199
|
+
_pickMove(pointerId) {
|
|
200
|
+
const scene = this._scene;
|
|
201
|
+
const pickResult = scene.pick(this._unTranslatedPointerX, this._unTranslatedPointerY, scene.pointerMovePredicate, false, scene.cameraToUseForPointers, scene.pointerMoveTrianglePredicate);
|
|
202
|
+
this._setCursorAndPointerOverMesh(pickResult, pointerId, scene);
|
|
203
|
+
return pickResult;
|
|
204
|
+
}
|
|
205
|
+
_setCursorAndPointerOverMesh(pickResult, pointerId, scene) {
|
|
206
|
+
const engine = scene.getEngine();
|
|
207
|
+
const canvas = engine.getInputElement();
|
|
208
|
+
if (pickResult === null || pickResult === void 0 ? void 0 : pickResult.pickedMesh) {
|
|
209
|
+
this.setPointerOverMesh(pickResult.pickedMesh, pointerId, pickResult);
|
|
210
|
+
if (!scene.doNotHandleCursors && canvas && this._pointerOverMesh) {
|
|
211
|
+
const actionManager = this._pointerOverMesh._getActionManagerForTrigger();
|
|
212
|
+
if (actionManager && actionManager.hasPointerTriggers) {
|
|
213
|
+
canvas.style.cursor = actionManager.hoverCursor || scene.hoverCursor;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
this.setPointerOverMesh(null, pointerId, pickResult);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
193
221
|
/**
|
|
194
222
|
* Use this method to simulate a pointer move on a mesh
|
|
195
223
|
* The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay
|
|
@@ -268,7 +296,7 @@ export class InputManager {
|
|
|
268
296
|
}
|
|
269
297
|
if (scene.onPointerObservable.hasObservers()) {
|
|
270
298
|
const pi = new PointerInfo(type, evt, pickResult);
|
|
271
|
-
this._setRayOnPointerInfo(
|
|
299
|
+
this._setRayOnPointerInfo(pickResult, evt);
|
|
272
300
|
scene.onPointerObservable.notifyObservers(pi, type);
|
|
273
301
|
}
|
|
274
302
|
}
|
|
@@ -278,8 +306,7 @@ export class InputManager {
|
|
|
278
306
|
* @internals Boolean if delta for pointer exceeds drag movement threshold
|
|
279
307
|
*/
|
|
280
308
|
_isPointerSwiping() {
|
|
281
|
-
return
|
|
282
|
-
Math.abs(this._startingPointerPosition.y - this._pointerY) > InputManager.DragMovementThreshold);
|
|
309
|
+
return this._isSwiping;
|
|
283
310
|
}
|
|
284
311
|
/**
|
|
285
312
|
* Use this method to simulate a pointer up on a mesh
|
|
@@ -314,7 +341,7 @@ export class InputManager {
|
|
|
314
341
|
if (clickInfo.singleClick && !clickInfo.ignore && scene.onPointerObservable.hasObservers()) {
|
|
315
342
|
const type = PointerEventTypes.POINTERPICK;
|
|
316
343
|
const pi = new PointerInfo(type, evt, pickResult);
|
|
317
|
-
this._setRayOnPointerInfo(
|
|
344
|
+
this._setRayOnPointerInfo(pickResult, evt);
|
|
318
345
|
scene.onPointerObservable.notifyObservers(pi, type);
|
|
319
346
|
}
|
|
320
347
|
}
|
|
@@ -354,14 +381,14 @@ export class InputManager {
|
|
|
354
381
|
}
|
|
355
382
|
if (type) {
|
|
356
383
|
const pi = new PointerInfo(type, evt, pickResult);
|
|
357
|
-
this._setRayOnPointerInfo(
|
|
384
|
+
this._setRayOnPointerInfo(pickResult, evt);
|
|
358
385
|
scene.onPointerObservable.notifyObservers(pi, type);
|
|
359
386
|
}
|
|
360
387
|
}
|
|
361
388
|
if (!clickInfo.ignore) {
|
|
362
389
|
type = PointerEventTypes.POINTERUP;
|
|
363
390
|
const pi = new PointerInfo(type, evt, pickResult);
|
|
364
|
-
this._setRayOnPointerInfo(
|
|
391
|
+
this._setRayOnPointerInfo(pickResult, evt);
|
|
365
392
|
scene.onPointerObservable.notifyObservers(pi, type);
|
|
366
393
|
}
|
|
367
394
|
}
|
|
@@ -400,7 +427,7 @@ export class InputManager {
|
|
|
400
427
|
// Because this is only called from _initClickEvent, which is called in _onPointerUp, we'll use the pointerUpPredicate for the pick call
|
|
401
428
|
this._initActionManager = (act) => {
|
|
402
429
|
if (!this._meshPickProceed) {
|
|
403
|
-
const pickResult = scene.skipPointerUpPicking
|
|
430
|
+
const pickResult = scene.skipPointerUpPicking || (scene._registeredActions === 0 && !scene.onPointerObservable.hasObservers())
|
|
404
431
|
? null
|
|
405
432
|
: scene.pick(this._unTranslatedPointerX, this._unTranslatedPointerY, scene.pointerUpPredicate, false, scene.cameraToUseForPointers);
|
|
406
433
|
this._currentPickResult = pickResult;
|
|
@@ -547,8 +574,13 @@ export class InputManager {
|
|
|
547
574
|
(mesh.enablePointerMoveEvents || scene.constantlyUpdateMeshUnderPointer || mesh._getActionManagerForTrigger() !== null) &&
|
|
548
575
|
(!scene.cameraToUseForPointers || (scene.cameraToUseForPointers.layerMask & mesh.layerMask) !== 0);
|
|
549
576
|
}
|
|
550
|
-
//
|
|
551
|
-
|
|
577
|
+
// Check if pointer leaves DragMovementThreshold range to determine if swipe is occurring
|
|
578
|
+
if (!this._isSwiping && this._swipeButtonPressed !== -1) {
|
|
579
|
+
this._isSwiping =
|
|
580
|
+
Math.abs(this._startingPointerPosition.x - this._pointerX) > InputManager.DragMovementThreshold ||
|
|
581
|
+
Math.abs(this._startingPointerPosition.y - this._pointerY) > InputManager.DragMovementThreshold;
|
|
582
|
+
}
|
|
583
|
+
const pickResult = scene._registeredActions > 0 ? this._pickMove(evt.pointerId) : null;
|
|
552
584
|
this._processPointerMove(pickResult, evt);
|
|
553
585
|
};
|
|
554
586
|
this._onPointerDown = (evt) => {
|
|
@@ -560,6 +592,9 @@ export class InputManager {
|
|
|
560
592
|
evt.pointerId = 0;
|
|
561
593
|
}
|
|
562
594
|
this._updatePointerPosition(evt);
|
|
595
|
+
if (this._swipeButtonPressed === -1) {
|
|
596
|
+
this._swipeButtonPressed = evt.button;
|
|
597
|
+
}
|
|
563
598
|
if (scene.preventDefaultOnPointerDown && elementToAttachTo) {
|
|
564
599
|
evt.preventDefault();
|
|
565
600
|
elementToAttachTo.focus();
|
|
@@ -587,7 +622,7 @@ export class InputManager {
|
|
|
587
622
|
// Meshes
|
|
588
623
|
this._pickedDownMesh = null;
|
|
589
624
|
let pickResult;
|
|
590
|
-
if (scene.skipPointerDownPicking) {
|
|
625
|
+
if (scene.skipPointerDownPicking || (scene._registeredActions === 0 && !scene.onPointerObservable.hasObservers())) {
|
|
591
626
|
pickResult = new PickingInfo();
|
|
592
627
|
}
|
|
593
628
|
else {
|
|
@@ -655,6 +690,10 @@ export class InputManager {
|
|
|
655
690
|
}
|
|
656
691
|
this._processPointerUp(pickResult, evt, clickInfo);
|
|
657
692
|
this._previousPickResult = this._currentPickResult;
|
|
693
|
+
if (this._swipeButtonPressed === evt.button) {
|
|
694
|
+
this._isSwiping = false;
|
|
695
|
+
this._swipeButtonPressed = -1;
|
|
696
|
+
}
|
|
658
697
|
});
|
|
659
698
|
};
|
|
660
699
|
this._onKeyDown = (evt) => {
|
|
@@ -798,7 +837,7 @@ export class InputManager {
|
|
|
798
837
|
* @returns a Mesh or null if no mesh is under the pointer
|
|
799
838
|
*/
|
|
800
839
|
getPointerOverMesh() {
|
|
801
|
-
return this.
|
|
840
|
+
return this.meshUnderPointer;
|
|
802
841
|
}
|
|
803
842
|
/**
|
|
804
843
|
* @param mesh - Mesh to invalidate
|