@xeokit/xeokit-sdk 2.6.62 → 2.6.63

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xeokit/xeokit-sdk",
3
- "version": "2.6.62",
3
+ "version": "2.6.63",
4
4
  "description": "Web Programming Toolkit for 3D/2D BIM and AEC Graphics",
5
5
  "module": "./dist/xeokit-sdk.es.js",
6
6
  "main": "./dist/xeokit-sdk.cjs.js",
@@ -39,6 +39,14 @@ class KeyboardPanRotateDollyHandler {
39
39
  }
40
40
  });
41
41
 
42
+ document.addEventListener("visibilitychange", this._onVisibilityChange = () => {
43
+ keyDownMap.splice(0);
44
+ })
45
+
46
+ window.addEventListener("blur", this._onBlur = () => {
47
+ keyDownMap.splice(0);
48
+ })
49
+
42
50
  this._onTick = scene.on("tick", (e) => {
43
51
 
44
52
  if (!(configs.active && configs.pointerEnabled) || (!scene.input.keyboardEnabled)) {
@@ -168,6 +176,8 @@ class KeyboardPanRotateDollyHandler {
168
176
 
169
177
  this._scene.input.off(this._onSceneMouseMove);
170
178
  this._scene.input.off(this._onSceneKeyDown);
179
+ document.removeEventListener("visibilitychange", this._onVisibilityChange);
180
+ window.removeEventListener("blur", this._onBlur);
171
181
  this._scene.input.off(this._onSceneKeyUp);
172
182
  }
173
183
  }
@@ -77,6 +77,14 @@ class MousePanRotateDollyHandler {
77
77
  keyDown[keyCode] = false;
78
78
  });
79
79
 
80
+ document.addEventListener("visibilitychange", this._onVisibilityChange = () => {
81
+ keyDown.splice(0);
82
+ })
83
+
84
+ window.addEventListener("blur", this._onBlur = () => {
85
+ keyDown.splice(0);
86
+ })
87
+
80
88
  function setMousedownState(pick = true) {
81
89
  setMousedownPositions();
82
90
  if (pick) {
@@ -355,6 +363,8 @@ class MousePanRotateDollyHandler {
355
363
 
356
364
  document.removeEventListener("keydown", this._documentKeyDownHandler);
357
365
  document.removeEventListener("keyup", this._documentKeyUpHandler);
366
+ document.removeEventListener("visibilitychange", this._onVisibilityChange);
367
+ window.removeEventListener("blur", this._onBlur);
358
368
  canvas.removeEventListener("mousedown", this._mouseDownHandler);
359
369
  document.removeEventListener("mousemove", this._documentMouseMoveHandler);
360
370
  canvas.removeEventListener("mousemove", this._canvasMouseMoveHandler);
@@ -407,7 +407,7 @@ export class VBORenderer {
407
407
  }
408
408
 
409
409
  if (this._instancing) {
410
- if (this._edges) {
410
+ if (this._edges && state.edgeIndicesBuf) {
411
411
  state.edgeIndicesBuf.bind();
412
412
  } else {
413
413
  if (state.indicesBuf) {
@@ -415,7 +415,7 @@ export class VBORenderer {
415
415
  }
416
416
  }
417
417
  } else {
418
- if (this._edges) {
418
+ if (this._edges && state.edgeIndicesBuf) {
419
419
  state.edgeIndicesBuf.bind();
420
420
  } else {
421
421
  if (state.indicesBuf) {
@@ -19,7 +19,9 @@ export class TrianglesBatchingRenderer extends VBORenderer {
19
19
  } = drawCfg;
20
20
 
21
21
  if (this._edges) {
22
- gl.drawElements(gl.LINES, state.edgeIndicesBuf.numItems, state.edgeIndicesBuf.itemType, 0);
22
+ if (state.edgeIndicesBuf) {
23
+ gl.drawElements(gl.LINES, state.edgeIndicesBuf.numItems, state.edgeIndicesBuf.itemType, 0);
24
+ }
23
25
  } else {
24
26
  const count = frameCtx.pickElementsCount || state.indicesBuf.numItems;
25
27
  const offset = frameCtx.pickElementsOffset ? frameCtx.pickElementsOffset * state.indicesBuf.itemByteSize : 0;
@@ -128,9 +128,11 @@ export class TrianglesSnapRenderer extends VBORenderer{
128
128
  //=============================================================
129
129
 
130
130
  if (frameCtx.snapMode === "edge") {
131
- state.edgeIndicesBuf.bind();
132
- gl.drawElements(gl.LINES, state.edgeIndicesBuf.numItems, state.edgeIndicesBuf.itemType, 0);
133
- state.edgeIndicesBuf.unbind(); // needed?
131
+ if (state.edgeIndicesBuf) {
132
+ state.edgeIndicesBuf.bind();
133
+ gl.drawElements(gl.LINES, state.edgeIndicesBuf.numItems, state.edgeIndicesBuf.itemType, 0);
134
+ state.edgeIndicesBuf.unbind(); // needed?
135
+ }
134
136
  } else {
135
137
  gl.drawArrays(gl.POINTS, 0, state.positionsBuf.numItems);
136
138
  }
@@ -18,7 +18,9 @@ export class TrianglesInstancingRenderer extends VBORenderer {
18
18
  } = drawCfg;
19
19
 
20
20
  if (this._edges) {
21
- gl.drawElementsInstanced(gl.LINES, state.edgeIndicesBuf.numItems, state.edgeIndicesBuf.itemType, 0, state.numInstances);
21
+ if (state.edgeIndicesBuf) {
22
+ gl.drawElementsInstanced(gl.LINES, state.edgeIndicesBuf.numItems, state.edgeIndicesBuf.itemType, 0, state.numInstances);
23
+ }
22
24
  } else {
23
25
  gl.drawElementsInstanced(gl.TRIANGLES, state.indicesBuf.numItems, state.indicesBuf.itemType, 0, state.numInstances);
24
26
 
@@ -134,10 +134,12 @@ export class TrianglesSnapRenderer extends VBORenderer {
134
134
  this._aFlags.bindArrayBuffer(state.flagsBuf);
135
135
  gl.vertexAttribDivisor(this._aFlags.location, 1);
136
136
 
137
- if (frameCtx.snapMode === "edge") {
138
- state.edgeIndicesBuf.bind();
139
- gl.drawElementsInstanced(gl.LINES, state.edgeIndicesBuf.numItems, state.edgeIndicesBuf.itemType, 0, state.numInstances);
140
- state.edgeIndicesBuf.unbind(); // needed?
137
+ if (frameCtx.snapMode === "edge" ) {
138
+ if (state.edgeIndicesBuf) {
139
+ state.edgeIndicesBuf.bind();
140
+ gl.drawElementsInstanced(gl.LINES, state.edgeIndicesBuf.numItems, state.edgeIndicesBuf.itemType, 0, state.numInstances);
141
+ state.edgeIndicesBuf.unbind(); // needed?
142
+ }
141
143
  } else {
142
144
  gl.drawArraysInstanced(gl.POINTS, 0, state.positionsBuf.numItems, state.numInstances);
143
145
  }