@xeokit/xeokit-sdk 2.4.2-beta-19 → 2.4.2-beta-21

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.
@@ -56361,10 +56361,15 @@ class SceneModelMesh {
56361
56361
  */
56362
56362
  get aabb() { // called by SceneModelEntity
56363
56363
  if (this._aabbDirty) {
56364
- if (this.obb && this.transform) {
56365
- math.transformOBB3(this.transform.worldMatrix, this.obb, tempOBB3);
56366
- math.transformOBB3(this.model.worldMatrix, tempOBB3, tempOBB3b);
56367
- math.OBB3ToAABB3(tempOBB3b, this._aabb);
56364
+ if (this.obb) {
56365
+ if (this.transform) {
56366
+ math.transformOBB3(this.transform.worldMatrix, this.obb, tempOBB3);
56367
+ math.transformOBB3(this.model.worldMatrix, tempOBB3, tempOBB3b);
56368
+ math.OBB3ToAABB3(tempOBB3b, this._aabb);
56369
+ } else {
56370
+ math.transformOBB3(this.model.worldMatrix, this.obb, tempOBB3);
56371
+ math.OBB3ToAABB3(tempOBB3, this._aabb);
56372
+ }
56368
56373
  }
56369
56374
  this._aabbDirty = false;
56370
56375
  }
@@ -87491,6 +87496,8 @@ class PickController {
87491
87496
 
87492
87497
  this._lastPickedEntityId = null;
87493
87498
 
87499
+ this._lastHash = null;
87500
+
87494
87501
  this._needFireEvents = 0;
87495
87502
  }
87496
87503
 
@@ -87498,6 +87505,7 @@ class PickController {
87498
87505
  * Immediately attempts a pick, if scheduled.
87499
87506
  */
87500
87507
  update() {
87508
+
87501
87509
  if (!this._configs.pointerEnabled) {
87502
87510
  return;
87503
87511
  }
@@ -87506,6 +87514,11 @@ class PickController {
87506
87514
  return;
87507
87515
  }
87508
87516
 
87517
+ const hash = `${~~this.pickCursorPos[0]}-${~~this.pickCursorPos[1]}-${this.scheduleSnapOrPick}-${this.schedulePickSurface}-${this.schedulePickEntity}`;
87518
+ if (this._lastHash === hash) {
87519
+ return;
87520
+ }
87521
+
87509
87522
  this.picked = false;
87510
87523
  this.pickedSurface = false;
87511
87524
  this.snappedOrPicked = false;
@@ -56357,10 +56357,15 @@ class SceneModelMesh {
56357
56357
  */
56358
56358
  get aabb() { // called by SceneModelEntity
56359
56359
  if (this._aabbDirty) {
56360
- if (this.obb && this.transform) {
56361
- math.transformOBB3(this.transform.worldMatrix, this.obb, tempOBB3);
56362
- math.transformOBB3(this.model.worldMatrix, tempOBB3, tempOBB3b);
56363
- math.OBB3ToAABB3(tempOBB3b, this._aabb);
56360
+ if (this.obb) {
56361
+ if (this.transform) {
56362
+ math.transformOBB3(this.transform.worldMatrix, this.obb, tempOBB3);
56363
+ math.transformOBB3(this.model.worldMatrix, tempOBB3, tempOBB3b);
56364
+ math.OBB3ToAABB3(tempOBB3b, this._aabb);
56365
+ } else {
56366
+ math.transformOBB3(this.model.worldMatrix, this.obb, tempOBB3);
56367
+ math.OBB3ToAABB3(tempOBB3, this._aabb);
56368
+ }
56364
56369
  }
56365
56370
  this._aabbDirty = false;
56366
56371
  }
@@ -87487,6 +87492,8 @@ class PickController {
87487
87492
 
87488
87493
  this._lastPickedEntityId = null;
87489
87494
 
87495
+ this._lastHash = null;
87496
+
87490
87497
  this._needFireEvents = 0;
87491
87498
  }
87492
87499
 
@@ -87494,6 +87501,7 @@ class PickController {
87494
87501
  * Immediately attempts a pick, if scheduled.
87495
87502
  */
87496
87503
  update() {
87504
+
87497
87505
  if (!this._configs.pointerEnabled) {
87498
87506
  return;
87499
87507
  }
@@ -87502,6 +87510,11 @@ class PickController {
87502
87510
  return;
87503
87511
  }
87504
87512
 
87513
+ const hash = `${~~this.pickCursorPos[0]}-${~~this.pickCursorPos[1]}-${this.scheduleSnapOrPick}-${this.schedulePickSurface}-${this.schedulePickEntity}`;
87514
+ if (this._lastHash === hash) {
87515
+ return;
87516
+ }
87517
+
87505
87518
  this.picked = false;
87506
87519
  this.pickedSurface = false;
87507
87520
  this.snappedOrPicked = false;
@@ -17212,7 +17212,7 @@ this._colorizing=false;this._transparent=opacity<255;/**
17212
17212
  */},{key:"aabb",get:/**
17213
17213
  * @private
17214
17214
  */function get(){// called by SceneModelEntity
17215
- if(this._aabbDirty){if(this.obb&&this.transform){math.transformOBB3(this.transform.worldMatrix,this.obb,tempOBB3);math.transformOBB3(this.model.worldMatrix,tempOBB3,tempOBB3b);math.OBB3ToAABB3(tempOBB3b,this._aabb);}this._aabbDirty=false;}return this._aabb;}/**
17215
+ if(this._aabbDirty){if(this.obb){if(this.transform){math.transformOBB3(this.transform.worldMatrix,this.obb,tempOBB3);math.transformOBB3(this.model.worldMatrix,tempOBB3,tempOBB3b);math.OBB3ToAABB3(tempOBB3b,this._aabb);}else{math.transformOBB3(this.model.worldMatrix,this.obb,tempOBB3);math.OBB3ToAABB3(tempOBB3,this._aabb);}}this._aabbDirty=false;}return this._aabb;}/**
17216
17216
  * @private
17217
17217
  */,set:function set(aabb){// Called by SceneModel
17218
17218
  this._aabb=aabb;}},{key:"_destroy",value:function _destroy(){this.model.scene._renderer.putPickID(this.pickId);}}]);return SceneModelMesh;}();/**
@@ -21285,9 +21285,9 @@ var eyeLookLen=math.lenVec3(math.subVec3(camera.look,camera.eye,math.vec3()));va
21285
21285
  */this.pickedSurface=false;/**
21286
21286
  * Will hold the PickResult after after picking.
21287
21287
  * @type {PickResult}
21288
- */this.pickResult=null;this._lastPickedEntityId=null;this._needFireEvents=0;}/**
21288
+ */this.pickResult=null;this._lastPickedEntityId=null;this._lastHash=null;this._needFireEvents=0;}/**
21289
21289
  * Immediately attempts a pick, if scheduled.
21290
- */_createClass(PickController,[{key:"update",value:function update(){if(!this._configs.pointerEnabled){return;}if(!this.schedulePickEntity&&!this.schedulePickSurface){return;}this.picked=false;this.pickedSurface=false;this.snappedOrPicked=false;this.hoveredSnappedOrSurfaceOff=false;var hasHoverSurfaceSubs=this._cameraControl.hasSubs("hoverSurface");if(this.scheduleSnapOrPick){var snapPickResult=this._scene.pick({canvasPos:this.pickCursorPos,snapRadius:this._configs.snapRadius,snapToVertex:this._configs.snapToVertex,snapToEdge:this._configs.snapToEdge});if(snapPickResult&&(snapPickResult.snappedToEdge||snapPickResult.snappedToVertex)){this.snapPickResult=snapPickResult;this.snappedOrPicked=true;this._needFireEvents++;}else{this.schedulePickSurface=true;// Fallback
21290
+ */_createClass(PickController,[{key:"update",value:function update(){if(!this._configs.pointerEnabled){return;}if(!this.schedulePickEntity&&!this.schedulePickSurface){return;}var hash="".concat(~~this.pickCursorPos[0],"-").concat(~~this.pickCursorPos[1],"-").concat(this.scheduleSnapOrPick,"-").concat(this.schedulePickSurface,"-").concat(this.schedulePickEntity);if(this._lastHash===hash){return;}this.picked=false;this.pickedSurface=false;this.snappedOrPicked=false;this.hoveredSnappedOrSurfaceOff=false;var hasHoverSurfaceSubs=this._cameraControl.hasSubs("hoverSurface");if(this.scheduleSnapOrPick){var snapPickResult=this._scene.pick({canvasPos:this.pickCursorPos,snapRadius:this._configs.snapRadius,snapToVertex:this._configs.snapToVertex,snapToEdge:this._configs.snapToEdge});if(snapPickResult&&(snapPickResult.snappedToEdge||snapPickResult.snappedToVertex)){this.snapPickResult=snapPickResult;this.snappedOrPicked=true;this._needFireEvents++;}else{this.schedulePickSurface=true;// Fallback
21291
21291
  this.snapPickResult=null;}}if(this.schedulePickSurface){if(this.pickResult&&this.pickResult.worldPos){var pickResultCanvasPos=this.pickResult.canvasPos;if(pickResultCanvasPos[0]===this.pickCursorPos[0]&&pickResultCanvasPos[1]===this.pickCursorPos[1]){this.picked=true;this.pickedSurface=true;this._needFireEvents+=hasHoverSurfaceSubs?1:0;this.schedulePickEntity=false;this.schedulePickSurface=false;if(this.scheduleSnapOrPick){this.snappedOrPicked=true;}else{this.hoveredSnappedOrSurfaceOff=true;}this.scheduleSnapOrPick=false;return;}}}if(this.schedulePickEntity){if(this.pickResult&&(this.pickResult.canvasPos||this.pickResult.snappedCanvasPos)){var _pickResultCanvasPos=this.pickResult.canvasPos||this.pickResult.snappedCanvasPos;if(_pickResultCanvasPos[0]===this.pickCursorPos[0]&&_pickResultCanvasPos[1]===this.pickCursorPos[1]){this.picked=true;this.pickedSurface=false;this.schedulePickEntity=false;this.schedulePickSurface=false;return;}}}if(this.schedulePickSurface||this.scheduleSnapOrPick&&!this.snapPickResult){this.pickResult=this._scene.pick({pickSurface:true,pickSurfaceNormal:false,canvasPos:this.pickCursorPos});if(this.pickResult){this.picked=true;if(this.scheduleSnapOrPick){this.snappedOrPicked=true;}else{this.pickedSurface=true;}this._needFireEvents++;}else if(this.scheduleSnapOrPick){this.hoveredSnappedOrSurfaceOff=true;this._needFireEvents++;}}else{// schedulePickEntity == true
21292
21292
  this.pickResult=this._scene.pick({canvasPos:this.pickCursorPos});if(this.pickResult){this.picked=true;this.pickedSurface=false;this._needFireEvents++;}}this.scheduleSnapOrPick=false;this.schedulePickEntity=false;this.schedulePickSurface=false;}},{key:"fireEvents",value:function fireEvents(){if(this._needFireEvents===0){return;}if(this.hoveredSnappedOrSurfaceOff){this._cameraControl.fire("hoverSnapOrSurfaceOff",{canvasPos:this.pickCursorPos,pointerPos:this.pickCursorPos},true);}if(this.snappedOrPicked){if(this.snapPickResult){var pickResult=new PickResult();pickResult.snappedToVertex=this.snapPickResult.snappedToVertex;pickResult.snappedToEdge=this.snapPickResult.snappedToEdge;pickResult.worldPos=this.snapPickResult.worldPos;pickResult.canvasPos=this.pickCursorPos;pickResult.snappedCanvasPos=this.snapPickResult.snappedCanvasPos;this._cameraControl.fire("hoverSnapOrSurface",pickResult,true);this.snapPickResult=null;}else{this._cameraControl.fire("hoverSnapOrSurface",this.pickResult,true);}}if(this.picked&&this.pickResult&&(this.pickResult.entity||this.pickResult.worldPos)){if(this.pickResult.entity){var pickedEntityId=this.pickResult.entity.id;if(this._lastPickedEntityId!==pickedEntityId){if(this._lastPickedEntityId!==undefined){this._cameraControl.fire("hoverOut",{entity:this._scene.objects[this._lastPickedEntityId]},true);}this._cameraControl.fire("hoverEnter",this.pickResult,true);this._lastPickedEntityId=pickedEntityId;}}this._cameraControl.fire("hover",this.pickResult,true);if(this.pickResult.worldPos){this.pickedSurface=true;this._cameraControl.fire("hoverSurface",this.pickResult,true);}}else{if(this._lastPickedEntityId!==undefined){this._cameraControl.fire("hoverOut",{entity:this._scene.objects[this._lastPickedEntityId]},true);this._lastPickedEntityId=undefined;}this._cameraControl.fire("hoverOff",{canvasPos:this.pickCursorPos},true);}this.pickResult=null;this._needFireEvents=0;}}]);return PickController;}();/**
21293
21293
  * @private