@xeokit/xeokit-sdk 2.4.2-beta-13 → 2.4.2-beta-14
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/xeokit-sdk.cjs.js +40 -26
- package/dist/xeokit-sdk.es.js +40 -26
- package/dist/xeokit-sdk.es5.js +143 -143
- package/dist/xeokit-sdk.min.cjs.js +2 -2
- package/dist/xeokit-sdk.min.es.js +2 -2
- package/dist/xeokit-sdk.min.es5.js +3 -3
- package/package.json +1 -1
- package/src/extras/MarqueePicker/MarqueePicker.js +14 -14
- package/src/viewer/scene/CameraControl/lib/controllers/PickController.js +26 -12
package/package.json
CHANGED
|
@@ -7,20 +7,6 @@ import {Frustum, frustumIntersectsAABB3, setFrustum} from "../../viewer/scene/ma
|
|
|
7
7
|
*/
|
|
8
8
|
export class MarqueePicker extends Component {
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
* Pick mode that picks {@link Entity}s that intersect the marquee box.
|
|
12
|
-
*
|
|
13
|
-
* @type {number}
|
|
14
|
-
*/
|
|
15
|
-
static PICK_MODE_INTERSECTS = 0;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Pick mode that picks {@link Entity}s that are completely inside the marquee box.
|
|
19
|
-
*
|
|
20
|
-
* @type {number}
|
|
21
|
-
*/
|
|
22
|
-
static PICK_MODE_INSIDE = 1;
|
|
23
|
-
|
|
24
10
|
/**
|
|
25
11
|
* Creates a MarqueePicker.
|
|
26
12
|
*
|
|
@@ -269,3 +255,17 @@ export class MarqueePicker extends Component {
|
|
|
269
255
|
}
|
|
270
256
|
}
|
|
271
257
|
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Pick mode that picks {@link Entity}s that intersect the marquee box.
|
|
261
|
+
*
|
|
262
|
+
* @type {number}
|
|
263
|
+
*/
|
|
264
|
+
MarqueePicker.PICK_MODE_INTERSECTS = 0;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Pick mode that picks {@link Entity}s that are completely inside the marquee box.
|
|
268
|
+
*
|
|
269
|
+
* @type {number}
|
|
270
|
+
*/
|
|
271
|
+
MarqueePicker.PICK_MODE_INSIDE = 1;
|
|
@@ -69,13 +69,29 @@ class PickController {
|
|
|
69
69
|
|
|
70
70
|
this._lastPickedEntityId = null;
|
|
71
71
|
|
|
72
|
-
this._needFireEvents =
|
|
72
|
+
this._needFireEvents = 0;
|
|
73
|
+
|
|
74
|
+
this._needToUpdate = false;
|
|
75
|
+
|
|
76
|
+
this._tickSub = this._scene.on("tick", () => {
|
|
77
|
+
this.runUpdate();
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
update() {
|
|
82
|
+
this._needToUpdate = true;
|
|
73
83
|
}
|
|
74
84
|
|
|
75
85
|
/**
|
|
76
86
|
* Immediately attempts a pick, if scheduled.
|
|
77
87
|
*/
|
|
78
|
-
|
|
88
|
+
runUpdate() {
|
|
89
|
+
|
|
90
|
+
if (!this._needToUpdate) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
this._needToUpdate = false;
|
|
79
95
|
|
|
80
96
|
if (!this._configs.pointerEnabled) {
|
|
81
97
|
return;
|
|
@@ -90,8 +106,6 @@ class PickController {
|
|
|
90
106
|
this.snappedOrPicked = false;
|
|
91
107
|
this.hoveredSnappedOrSurfaceOff = false;
|
|
92
108
|
|
|
93
|
-
this._needFireEvents = false;
|
|
94
|
-
|
|
95
109
|
const hasHoverSurfaceSubs = this._cameraControl.hasSubs("hoverSurface");
|
|
96
110
|
|
|
97
111
|
if (this.scheduleSnapOrPick) {
|
|
@@ -104,7 +118,7 @@ class PickController {
|
|
|
104
118
|
if (snapPickResult && snapPickResult.snappedWorldPos) {
|
|
105
119
|
this.snapPickResult = snapPickResult;
|
|
106
120
|
this.snappedOrPicked = true;
|
|
107
|
-
this._needFireEvents
|
|
121
|
+
this._needFireEvents++;
|
|
108
122
|
} else {
|
|
109
123
|
this.schedulePickSurface = true; // Fallback
|
|
110
124
|
this.snapPickResult = null;
|
|
@@ -117,7 +131,7 @@ class PickController {
|
|
|
117
131
|
if (pickResultCanvasPos[0] === this.pickCursorPos[0] && pickResultCanvasPos[1] === this.pickCursorPos[1]) {
|
|
118
132
|
this.picked = true;
|
|
119
133
|
this.pickedSurface = true;
|
|
120
|
-
this._needFireEvents
|
|
134
|
+
this._needFireEvents += hasHoverSurfaceSubs ? 1 : 0;
|
|
121
135
|
this.schedulePickEntity = false;
|
|
122
136
|
this.schedulePickSurface = false;
|
|
123
137
|
if (this.scheduleSnapOrPick) {
|
|
@@ -137,7 +151,6 @@ class PickController {
|
|
|
137
151
|
if (pickResultCanvasPos[0] === this.pickCursorPos[0] && pickResultCanvasPos[1] === this.pickCursorPos[1]) {
|
|
138
152
|
this.picked = true;
|
|
139
153
|
this.pickedSurface = false;
|
|
140
|
-
this._needFireEvents = false;
|
|
141
154
|
this.schedulePickEntity = false;
|
|
142
155
|
this.schedulePickSurface = false;
|
|
143
156
|
return;
|
|
@@ -158,10 +171,10 @@ class PickController {
|
|
|
158
171
|
} else {
|
|
159
172
|
this.pickedSurface = true;
|
|
160
173
|
}
|
|
161
|
-
this._needFireEvents
|
|
174
|
+
this._needFireEvents++;
|
|
162
175
|
} else if (this.scheduleSnapOrPick) {
|
|
163
176
|
this.hoveredSnappedOrSurfaceOff = true;
|
|
164
|
-
this._needFireEvents
|
|
177
|
+
this._needFireEvents++;
|
|
165
178
|
}
|
|
166
179
|
|
|
167
180
|
} else { // schedulePickEntity == true
|
|
@@ -173,7 +186,7 @@ class PickController {
|
|
|
173
186
|
if (this.pickResult) {
|
|
174
187
|
this.picked = true;
|
|
175
188
|
this.pickedSurface = false;
|
|
176
|
-
this._needFireEvents
|
|
189
|
+
this._needFireEvents++;
|
|
177
190
|
}
|
|
178
191
|
}
|
|
179
192
|
|
|
@@ -184,7 +197,7 @@ class PickController {
|
|
|
184
197
|
|
|
185
198
|
fireEvents() {
|
|
186
199
|
|
|
187
|
-
if (
|
|
200
|
+
if (this._needFireEvents == 0) {
|
|
188
201
|
return;
|
|
189
202
|
}
|
|
190
203
|
|
|
@@ -254,10 +267,11 @@ class PickController {
|
|
|
254
267
|
|
|
255
268
|
this.pickResult = null;
|
|
256
269
|
|
|
257
|
-
this._needFireEvents =
|
|
270
|
+
this._needFireEvents = 0;
|
|
258
271
|
}
|
|
259
272
|
|
|
260
273
|
destroy() {
|
|
274
|
+
this._scene.off(this._tickSub);
|
|
261
275
|
}
|
|
262
276
|
}
|
|
263
277
|
|