@configura/babylon-view 2.1.0-alpha.2 → 2.2.0-alpha.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/dist/camera/CfgOrbitalCamera.js +1 -5
- package/dist/geometry/stretch/CfgStretchData.js +2 -5
- package/dist/nodes/CfgSymRootNode.js +12 -1
- package/dist/utilities/utilities3D.d.ts +1 -1
- package/dist/utilities/utilities3D.js +0 -6
- package/package.json +12 -7
- package/dist/camera/CfgArcRotateCameraPointersInput.d.ts +0 -27
- package/dist/camera/CfgArcRotateCameraPointersInput.js +0 -266
|
@@ -4,7 +4,6 @@ import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
|
|
4
4
|
import { degToRad, normalizeAngle, Observable } from "@configura/web-utilities";
|
|
5
5
|
import { CfgBoundingBox } from "../utilities/CfgBoundingBox.js";
|
|
6
6
|
import { boundingBoxesAreSignificantlyDifferent, measureLongestDistanceToCorner, } from "../utilities/utilities3D.js";
|
|
7
|
-
import { CfgArcRotateCameraPointersInput } from "./CfgArcRotateCameraPointersInput.js";
|
|
8
7
|
import { orbitalCameraControlPropsEquals, } from "./CfgOrbitalCameraControlProps.js";
|
|
9
8
|
const NEAREST_ALLOWED_TO_BETA_LIMITS = 0.1;
|
|
10
9
|
export const MAX_UPPER_BETA_LIMIT = Math.PI - NEAREST_ALLOWED_TO_BETA_LIMITS;
|
|
@@ -58,9 +57,6 @@ export class CfgOrbitalCamera extends WorkaroundCfgOrbitalCamera {
|
|
|
58
57
|
false, // No panning with keyboard
|
|
59
58
|
false // No panning with mouse
|
|
60
59
|
);
|
|
61
|
-
// Workaround for touch issues on iOS, see comments in CfgArcRotateCameraPointersInput.ts
|
|
62
|
-
this.inputs.removeByType("ArcRotateCameraPointersInput");
|
|
63
|
-
this.inputs.add(new CfgArcRotateCameraPointersInput());
|
|
64
60
|
// Make sure to disable all forms of "panning", which for the ArcRotateCamera is defined
|
|
65
61
|
// as movement sideways without rotation to keep the camera centered on the target.
|
|
66
62
|
// The settings above for attachControl will not disable two-finger touch.
|
|
@@ -78,7 +74,7 @@ export class CfgOrbitalCamera extends WorkaroundCfgOrbitalCamera {
|
|
|
78
74
|
this.onViewMatrixChangedObservable.add(this._boundCameraListener);
|
|
79
75
|
}
|
|
80
76
|
dispose() {
|
|
81
|
-
this.detachControl(
|
|
77
|
+
this.detachControl();
|
|
82
78
|
this.onViewMatrixChangedObservable.removeCallback(this._boundCameraListener);
|
|
83
79
|
this._scene.onPointerObservable.removeCallback(this._pointerUpDownCallback);
|
|
84
80
|
super.dispose();
|
|
@@ -108,6 +108,7 @@ export class CfgStretchData {
|
|
|
108
108
|
this.getAlongness = (p) => calculateAlongness(p, this.sp, this.spToEpLength, this.normalNormalized);
|
|
109
109
|
}
|
|
110
110
|
static make(logger, symNode, detailLevel) {
|
|
111
|
+
var _a;
|
|
111
112
|
const symMeasure = symNode.getMeasure();
|
|
112
113
|
if (symMeasure === undefined) {
|
|
113
114
|
throw new Error("No symMeasure found");
|
|
@@ -149,11 +150,7 @@ export class CfgStretchData {
|
|
|
149
150
|
if (name.startsWith("divider")) {
|
|
150
151
|
const nodeChildren = node.children(logger, true, true);
|
|
151
152
|
for (const [subLevelNodeName, subNode] of nodeChildren) {
|
|
152
|
-
const
|
|
153
|
-
if (trans === undefined) {
|
|
154
|
-
continue;
|
|
155
|
-
}
|
|
156
|
-
const pos = trans.pos;
|
|
153
|
+
const pos = (_a = subNode.symTransform()) === null || _a === void 0 ? void 0 : _a.pos;
|
|
157
154
|
if (pos === undefined) {
|
|
158
155
|
continue;
|
|
159
156
|
}
|
|
@@ -184,7 +184,18 @@ export class CfgSymRootNode extends CfgSymNode {
|
|
|
184
184
|
if (!childNode.isStretch(logger, detailLevel)) {
|
|
185
185
|
continue;
|
|
186
186
|
}
|
|
187
|
-
|
|
187
|
+
let stretchData;
|
|
188
|
+
try {
|
|
189
|
+
stretchData = CfgStretchData.make(logger, childNode, detailLevel);
|
|
190
|
+
}
|
|
191
|
+
catch (e) {
|
|
192
|
+
const err = e;
|
|
193
|
+
const file = this._identifier.split("/").pop();
|
|
194
|
+
const error = new Error(`Invalid stretch data in model (${file}): ${err.message}`);
|
|
195
|
+
logger.errorAsObject(error);
|
|
196
|
+
this._stretchDatas = []; // No use to try again
|
|
197
|
+
throw error;
|
|
198
|
+
}
|
|
188
199
|
if (stretchData === undefined) {
|
|
189
200
|
continue;
|
|
190
201
|
}
|
|
@@ -25,7 +25,7 @@ export declare const boundingBoxChangeIsSignificantForAxis: (bbOld: CfgBoundingB
|
|
|
25
25
|
* bbNew in that direction is shrink or grow.
|
|
26
26
|
*/
|
|
27
27
|
export declare function boundingBoxesAreSignificantlyDifferent(bbOld: CfgBoundingBox, bbNew: CfgBoundingBox, acceptableDifferenceShrink: number, acceptableDifferenceGrow: number): boolean;
|
|
28
|
-
export declare function unifyBoundingRect(boundingRect:
|
|
28
|
+
export declare function unifyBoundingRect(boundingRect: DOMRect): {
|
|
29
29
|
x: number;
|
|
30
30
|
y: number;
|
|
31
31
|
width: number;
|
|
@@ -57,12 +57,6 @@ export function boundingBoxesAreSignificantlyDifferent(bbOld, bbNew, acceptableD
|
|
|
57
57
|
return false;
|
|
58
58
|
}
|
|
59
59
|
export function unifyBoundingRect(boundingRect) {
|
|
60
|
-
function isDomRect(object) {
|
|
61
|
-
return typeof object === "object" && object !== null && "x" in object;
|
|
62
|
-
}
|
|
63
|
-
if (isDomRect(boundingRect)) {
|
|
64
|
-
return boundingRect;
|
|
65
|
-
}
|
|
66
60
|
return {
|
|
67
61
|
x: boundingRect.left,
|
|
68
62
|
y: boundingRect.top,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@configura/babylon-view",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0-alpha.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -15,17 +15,22 @@
|
|
|
15
15
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@babylonjs/core": "
|
|
19
|
-
"@
|
|
20
|
-
"@
|
|
18
|
+
"@babylonjs/core": "5.52.0",
|
|
19
|
+
"@babylonjs/gui": "5.52.0",
|
|
20
|
+
"@babylonjs/gui-editor": "5.52.0",
|
|
21
|
+
"@babylonjs/loaders": "5.52.0",
|
|
22
|
+
"@babylonjs/materials": "5.52.0",
|
|
23
|
+
"@babylonjs/serializers": "5.52.0",
|
|
24
|
+
"@configura/web-core": "2.2.0-alpha.0",
|
|
25
|
+
"@configura/web-utilities": "2.2.0-alpha.0"
|
|
21
26
|
},
|
|
22
27
|
"devDependencies": {
|
|
23
|
-
"@configura/web-api": "2.
|
|
28
|
+
"@configura/web-api": "2.2.0-alpha.0",
|
|
24
29
|
"del-cli": "^3.0.0",
|
|
25
|
-
"typescript": "4.
|
|
30
|
+
"typescript": "4.5"
|
|
26
31
|
},
|
|
27
32
|
"publishConfig": {
|
|
28
33
|
"access": "public"
|
|
29
34
|
},
|
|
30
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "b01f3df9b902478356fb957c7b85ec6e3f2c5e9c"
|
|
31
36
|
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { ArcRotateCameraPointersInput } from "@babylonjs/core/Cameras/Inputs/arcRotateCameraPointersInput.js";
|
|
2
|
-
import "@babylonjs/core/Engines/Extensions/engine.webVR.js";
|
|
3
|
-
/**
|
|
4
|
-
* This class exists to workaround a severe touch input issue that exists on at least iOS 13.4 in
|
|
5
|
-
* Babylon release 4.1.0 and possibly later.
|
|
6
|
-
*
|
|
7
|
-
* The main workaround is marked with "--- START OF WORKAROUND ---" in the source below.
|
|
8
|
-
*
|
|
9
|
-
* Most of the code below is copied from the Babylon source class BaseCameraPointersInput.ts,
|
|
10
|
-
* which ArcRotateCameraPointersInput extends. Some additional private support code from
|
|
11
|
-
* BaseCameraPointersInput is also included and suffixed with "CfgPatch".
|
|
12
|
-
*
|
|
13
|
-
* @warning: DO NOT do any other changes to this file! They WILL be lost when this workaround is no
|
|
14
|
-
* longer needed.
|
|
15
|
-
*
|
|
16
|
-
* @todo Every time the babylon module is updated to a new release, test if the workaround is still
|
|
17
|
-
* needed. If not, simply remove this file and update CfgOrbitalCamera.ts to not use it.
|
|
18
|
-
*/
|
|
19
|
-
export declare class CfgArcRotateCameraPointersInput extends ArcRotateCameraPointersInput {
|
|
20
|
-
attachControl(noPreventDefault?: boolean): void;
|
|
21
|
-
detachControl(ignored?: any): void;
|
|
22
|
-
private _observerCfgPatch;
|
|
23
|
-
private _onLostFocusCfgPatch;
|
|
24
|
-
private _pointA;
|
|
25
|
-
private _pointB;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=CfgArcRotateCameraPointersInput.d.ts.map
|
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
// Disable eslint since this (mostly) isn't our code
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
import { ArcRotateCameraPointersInput } from "@babylonjs/core/Cameras/Inputs/arcRotateCameraPointersInput.js";
|
|
4
|
-
import "@babylonjs/core/Engines/Extensions/engine.webVR.js"; // isInVRExclusivePointerMode
|
|
5
|
-
import { PointerEventTypes, } from "@babylonjs/core/Events/pointerEvents.js";
|
|
6
|
-
import { Tools } from "@babylonjs/core/Misc/tools.js";
|
|
7
|
-
/**
|
|
8
|
-
* This class exists to workaround a severe touch input issue that exists on at least iOS 13.4 in
|
|
9
|
-
* Babylon release 4.1.0 and possibly later.
|
|
10
|
-
*
|
|
11
|
-
* The main workaround is marked with "--- START OF WORKAROUND ---" in the source below.
|
|
12
|
-
*
|
|
13
|
-
* Most of the code below is copied from the Babylon source class BaseCameraPointersInput.ts,
|
|
14
|
-
* which ArcRotateCameraPointersInput extends. Some additional private support code from
|
|
15
|
-
* BaseCameraPointersInput is also included and suffixed with "CfgPatch".
|
|
16
|
-
*
|
|
17
|
-
* @warning: DO NOT do any other changes to this file! They WILL be lost when this workaround is no
|
|
18
|
-
* longer needed.
|
|
19
|
-
*
|
|
20
|
-
* @todo Every time the babylon module is updated to a new release, test if the workaround is still
|
|
21
|
-
* needed. If not, simply remove this file and update CfgOrbitalCamera.ts to not use it.
|
|
22
|
-
*/
|
|
23
|
-
export class CfgArcRotateCameraPointersInput extends ArcRotateCameraPointersInput {
|
|
24
|
-
constructor() {
|
|
25
|
-
super(...arguments);
|
|
26
|
-
this._observerCfgPatch = null;
|
|
27
|
-
this._onLostFocusCfgPatch = null;
|
|
28
|
-
this._pointA = null;
|
|
29
|
-
this._pointB = null;
|
|
30
|
-
}
|
|
31
|
-
attachControl(noPreventDefault) {
|
|
32
|
-
noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);
|
|
33
|
-
var engine = this.camera.getEngine();
|
|
34
|
-
const element = engine.getInputElement();
|
|
35
|
-
var previousPinchSquaredDistance = 0;
|
|
36
|
-
var previousMultiTouchPanPosition = null;
|
|
37
|
-
this._pointA = null;
|
|
38
|
-
this._pointB = null;
|
|
39
|
-
this._altKey = false;
|
|
40
|
-
this._ctrlKey = false;
|
|
41
|
-
this._metaKey = false;
|
|
42
|
-
this._shiftKey = false;
|
|
43
|
-
this._buttonsPressed = 0;
|
|
44
|
-
const pointerInput = (p, s) => {
|
|
45
|
-
var evt = p.event;
|
|
46
|
-
let isTouch = evt.pointerType === "touch";
|
|
47
|
-
if (engine.isInVRExclusivePointerMode) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
if (p.type !== PointerEventTypes.POINTERMOVE &&
|
|
51
|
-
this.buttons.indexOf(evt.button) === -1) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
let srcElement = (evt.srcElement || evt.target);
|
|
55
|
-
this._altKey = evt.altKey;
|
|
56
|
-
this._ctrlKey = evt.ctrlKey;
|
|
57
|
-
this._metaKey = evt.metaKey;
|
|
58
|
-
this._shiftKey = evt.shiftKey;
|
|
59
|
-
this._buttonsPressed = evt.buttons;
|
|
60
|
-
if (engine.isPointerLock) {
|
|
61
|
-
let offsetX = evt.movementX ||
|
|
62
|
-
evt.mozMovementX ||
|
|
63
|
-
evt.webkitMovementX ||
|
|
64
|
-
evt.msMovementX ||
|
|
65
|
-
0;
|
|
66
|
-
let offsetY = evt.movementY ||
|
|
67
|
-
evt.mozMovementY ||
|
|
68
|
-
evt.webkitMovementY ||
|
|
69
|
-
evt.msMovementY ||
|
|
70
|
-
0;
|
|
71
|
-
this.onTouch(null, offsetX, offsetY);
|
|
72
|
-
this._pointA = null;
|
|
73
|
-
this._pointB = null;
|
|
74
|
-
}
|
|
75
|
-
else if (p.type === PointerEventTypes.POINTERDOWN && srcElement) {
|
|
76
|
-
try {
|
|
77
|
-
srcElement.setPointerCapture(evt.pointerId);
|
|
78
|
-
}
|
|
79
|
-
catch (e) {
|
|
80
|
-
//Nothing to do with the error. Execution will continue.
|
|
81
|
-
}
|
|
82
|
-
if (this._pointA === null) {
|
|
83
|
-
this._pointA = {
|
|
84
|
-
x: evt.clientX,
|
|
85
|
-
y: evt.clientY,
|
|
86
|
-
pointerId: evt.pointerId,
|
|
87
|
-
type: evt.pointerType,
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
else if (this._pointB === null) {
|
|
91
|
-
this._pointB = {
|
|
92
|
-
x: evt.clientX,
|
|
93
|
-
y: evt.clientY,
|
|
94
|
-
pointerId: evt.pointerId,
|
|
95
|
-
type: evt.pointerType,
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
this.onButtonDown(evt);
|
|
99
|
-
if (!noPreventDefault) {
|
|
100
|
-
evt.preventDefault();
|
|
101
|
-
element && element.focus();
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
else if (p.type === PointerEventTypes.POINTERDOUBLETAP) {
|
|
105
|
-
this.onDoubleTap(evt.pointerType);
|
|
106
|
-
}
|
|
107
|
-
else if (p.type === PointerEventTypes.POINTERUP && srcElement) {
|
|
108
|
-
try {
|
|
109
|
-
srcElement.releasePointerCapture(evt.pointerId);
|
|
110
|
-
}
|
|
111
|
-
catch (e) {
|
|
112
|
-
//Nothing to do with the error.
|
|
113
|
-
}
|
|
114
|
-
if (!isTouch) {
|
|
115
|
-
this._pointB = null; // Mouse and pen are mono pointer
|
|
116
|
-
}
|
|
117
|
-
//would be better to use pointers.remove(evt.pointerId) for multi-touch gestures,
|
|
118
|
-
//but emptying completely pointers collection is required to fix a bug on iPhone :
|
|
119
|
-
//when changing orientation while pinching camera,
|
|
120
|
-
//one pointer stay pressed forever if we don't release all pointers
|
|
121
|
-
//will be ok to put back pointers.remove(evt.pointerId); when iPhone bug corrected
|
|
122
|
-
if (engine._badOS) {
|
|
123
|
-
this._pointA = this._pointB = null;
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
//only remove the impacted pointer in case of multi-touch allowing on most
|
|
127
|
-
//platforms switching from rotate to zoom and pan seamlessly.
|
|
128
|
-
if (this._pointB && this._pointA && this._pointA.pointerId === evt.pointerId) {
|
|
129
|
-
this._pointA = this._pointB;
|
|
130
|
-
this._pointB = null;
|
|
131
|
-
}
|
|
132
|
-
else if (this._pointA &&
|
|
133
|
-
this._pointB &&
|
|
134
|
-
this._pointB.pointerId === evt.pointerId) {
|
|
135
|
-
this._pointB = null;
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
this._pointA = this._pointB = null;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
if (previousPinchSquaredDistance !== 0 || previousMultiTouchPanPosition) {
|
|
142
|
-
// Previous pinch data is populated but a button has been lifted
|
|
143
|
-
// so pinch has ended.
|
|
144
|
-
this.onMultiTouch(this._pointA, this._pointB, previousPinchSquaredDistance, 0, // pinchSquaredDistance
|
|
145
|
-
previousMultiTouchPanPosition, null // multiTouchPanPosition
|
|
146
|
-
);
|
|
147
|
-
previousPinchSquaredDistance = 0;
|
|
148
|
-
previousMultiTouchPanPosition = null;
|
|
149
|
-
}
|
|
150
|
-
this.onButtonUp(evt);
|
|
151
|
-
if (!noPreventDefault) {
|
|
152
|
-
evt.preventDefault();
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
else if (p.type === PointerEventTypes.POINTERMOVE) {
|
|
156
|
-
if (!noPreventDefault) {
|
|
157
|
-
evt.preventDefault();
|
|
158
|
-
}
|
|
159
|
-
// --- START OF WORKAROUND ---
|
|
160
|
-
// At least iOS 13.4 has problems where some touches generates pointer move events
|
|
161
|
-
// without a starting pointer down event nor a finishing pointer up. It appears
|
|
162
|
-
// that the triggering cause is using two fingers at almost the same time.
|
|
163
|
-
//
|
|
164
|
-
// Babylon.js (version 4.1.0 as of this writing) does not gracefully handle this
|
|
165
|
-
// but instead starts flickering between the two different touch points since it
|
|
166
|
-
// does not validate that the pointerID matches the stored point A.
|
|
167
|
-
//
|
|
168
|
-
// Babylon also doesn't properly handle when more than two fingers gets pressed or
|
|
169
|
-
// a third finger gets added, again starting to flicker between the touch points
|
|
170
|
-
// since it only checks if the pointerID is "point A" and assumes that all other
|
|
171
|
-
// touches are "point B".
|
|
172
|
-
//
|
|
173
|
-
// The short code snippet below provides some filtering and workarounds not yet
|
|
174
|
-
// present in Babylon. All other code around this workaround comes from the release
|
|
175
|
-
// version of Babylon 4.1.0, class ArcRotateCameraPointerInput.ts
|
|
176
|
-
if (engine._badOS) {
|
|
177
|
-
// Unknown touch when only one touch is registered, register as second touch
|
|
178
|
-
if (this._pointA && !this._pointB && evt.pointerId !== this._pointA.pointerId) {
|
|
179
|
-
this._pointB = {
|
|
180
|
-
x: evt.clientX,
|
|
181
|
-
y: evt.clientY,
|
|
182
|
-
pointerId: evt.pointerId,
|
|
183
|
-
type: evt.pointerType,
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
// The touch does not match either of the registered touches, ignore it
|
|
188
|
-
if (!((this._pointA && this._pointA.pointerId === evt.pointerId) ||
|
|
189
|
-
(this._pointB && this._pointB.pointerId === evt.pointerId))) {
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
// --- END OF WORKAROUND ---
|
|
193
|
-
// One button down
|
|
194
|
-
if (this._pointA && this._pointB === null) {
|
|
195
|
-
var offsetX = evt.clientX - this._pointA.x;
|
|
196
|
-
var offsetY = evt.clientY - this._pointA.y;
|
|
197
|
-
this.onTouch(this._pointA, offsetX, offsetY);
|
|
198
|
-
this._pointA.x = evt.clientX;
|
|
199
|
-
this._pointA.y = evt.clientY;
|
|
200
|
-
}
|
|
201
|
-
// Two buttons down: pinch
|
|
202
|
-
else if (this._pointA && this._pointB) {
|
|
203
|
-
var ed = this._pointA.pointerId === evt.pointerId ? this._pointA : this._pointB;
|
|
204
|
-
ed.x = evt.clientX;
|
|
205
|
-
ed.y = evt.clientY;
|
|
206
|
-
var distX = this._pointA.x - this._pointB.x;
|
|
207
|
-
var distY = this._pointA.y - this._pointB.y;
|
|
208
|
-
var pinchSquaredDistance = distX * distX + distY * distY;
|
|
209
|
-
var multiTouchPanPosition = {
|
|
210
|
-
x: (this._pointA.x + this._pointB.x) / 2,
|
|
211
|
-
y: (this._pointA.y + this._pointB.y) / 2,
|
|
212
|
-
pointerId: evt.pointerId,
|
|
213
|
-
type: p.type,
|
|
214
|
-
};
|
|
215
|
-
this.onMultiTouch(this._pointA, this._pointB, previousPinchSquaredDistance, pinchSquaredDistance, previousMultiTouchPanPosition, multiTouchPanPosition);
|
|
216
|
-
previousMultiTouchPanPosition = multiTouchPanPosition;
|
|
217
|
-
previousPinchSquaredDistance = pinchSquaredDistance;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
this._observerCfgPatch = this.camera
|
|
222
|
-
.getScene()
|
|
223
|
-
.onPointerObservable.add(pointerInput, PointerEventTypes.POINTERDOWN |
|
|
224
|
-
PointerEventTypes.POINTERUP |
|
|
225
|
-
PointerEventTypes.POINTERMOVE);
|
|
226
|
-
this._onLostFocusCfgPatch = () => {
|
|
227
|
-
this._pointA = this._pointB = null;
|
|
228
|
-
previousPinchSquaredDistance = 0;
|
|
229
|
-
previousMultiTouchPanPosition = null;
|
|
230
|
-
this.onLostFocus();
|
|
231
|
-
};
|
|
232
|
-
element &&
|
|
233
|
-
element.addEventListener("contextmenu", this.onContextMenu.bind(this), false);
|
|
234
|
-
let hostWindow = this.camera.getScene().getEngine().getHostWindow();
|
|
235
|
-
if (hostWindow) {
|
|
236
|
-
Tools.RegisterTopRootEvents(hostWindow, [
|
|
237
|
-
{ name: "blur", handler: this._onLostFocusCfgPatch },
|
|
238
|
-
]);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
detachControl(ignored) {
|
|
242
|
-
if (this._onLostFocusCfgPatch) {
|
|
243
|
-
let hostWindow = this.camera.getScene().getEngine().getHostWindow();
|
|
244
|
-
if (hostWindow) {
|
|
245
|
-
Tools.UnregisterTopRootEvents(hostWindow, [
|
|
246
|
-
{ name: "blur", handler: this._onLostFocusCfgPatch },
|
|
247
|
-
]);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
if (this._observerCfgPatch) {
|
|
251
|
-
this.camera.getScene().onPointerObservable.remove(this._observerCfgPatch);
|
|
252
|
-
this._observerCfgPatch = null;
|
|
253
|
-
if (this.onContextMenu) {
|
|
254
|
-
const inputElement = this.camera.getScene().getEngine().getInputElement();
|
|
255
|
-
inputElement &&
|
|
256
|
-
inputElement.removeEventListener("contextmenu", this.onContextMenu);
|
|
257
|
-
}
|
|
258
|
-
this._onLostFocusCfgPatch = null;
|
|
259
|
-
}
|
|
260
|
-
this._altKey = false;
|
|
261
|
-
this._ctrlKey = false;
|
|
262
|
-
this._metaKey = false;
|
|
263
|
-
this._shiftKey = false;
|
|
264
|
-
this._buttonsPressed = 0;
|
|
265
|
-
}
|
|
266
|
-
}
|