@xtctwins/tctwins-core 1.0.39 → 1.0.41

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.
@@ -3388,7 +3388,7 @@ _this18._initMarkerDiv();_this18._onMouseHoverSurface=null;_this18._onHoverNothi
3388
3388
  * Activates this AngleMeasurementsTouchControl, ready to respond to input.
3389
3389
  */,set:function set(snapping){if(snapping!==this._snapping){this._snapping=snapping;this.deactivate();this.activate();}else{this._snapping=snapping;}}},{key:"activate",value:function activate(){var _this24=this;if(this._active){return;}var plugin=this.plugin;var scene=this.scene;var canvas=scene.canvas.canvas;plugin.pointerLens;var pointerWorldPos=math.vec3();var touchTolerance=20;var longTouchTimeout=null;this._touchState=WAITING_FOR_ORIGIN_TOUCH_START$1;var touchStartCanvasPos=math.vec2();var touchMoveCanvasPos=math.vec2();var touchEndCanvasPos=math.vec2();var touchId=null;var disableCameraNavigation=function disableCameraNavigation(){_this24.plugin.viewer.cameraControl.active=false;};var enableCameraNavigation=function enableCameraNavigation(){_this24.plugin.viewer.cameraControl.active=true;};var cancel=function cancel(){if(longTouchTimeout){clearTimeout(longTouchTimeout);longTouchTimeout=null;}if(_this24._currentAngleMeasurement){_this24._currentAngleMeasurement.destroy();_this24._currentAngleMeasurement=null;}enableCameraNavigation();_this24._touchState=WAITING_FOR_ORIGIN_TOUCH_START$1;};canvas.addEventListener("touchstart",this._onCanvasTouchStart=function(event){if(!event.isTrusted)return;var currentNumTouches=event.touches.length;//多指触碰
3390
3390
  if(currentNumTouches!==1){if(longTouchTimeout){clearTimeout(longTouchTimeout);longTouchTimeout=null;}return;}//touch--0
3391
- var touch=event.touches[0];var touchX=touch.clientX;var touchY=touch.clientY;touchStartCanvasPos.set([touchX,touchY]);touchMoveCanvasPos.set([touchX,touchY]);switch(_this24._touchState){case WAITING_FOR_ORIGIN_TOUCH_START$1:if(currentNumTouches!==1&&longTouchTimeout!==null){// Two or more fingers down
3391
+ var touch=event.touches[0];var touchX=touch.clientX;var touchY=touch.clientY;touchStartCanvasPos.set([touchX+_this24.offsetX,touchY+_this24.offsetY]);touchMoveCanvasPos.set([touchX+_this24.offsetX,touchY+_this24.offsetY]);switch(_this24._touchState){case WAITING_FOR_ORIGIN_TOUCH_START$1:if(currentNumTouches!==1&&longTouchTimeout!==null){// Two or more fingers down
3392
3392
  cancel();return;}var snapPickResult=scene.pick({canvasPos:touchMoveCanvasPos,snapToVertex:_this24._snapping,snapToEdge:_this24._snapping});if(snapPickResult&&snapPickResult.snapped){pointerWorldPos.set(snapPickResult.worldPos);_this24.pointerCircle.start(snapPickResult.snappedCanvasPos);}else{var pickResult=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(pickResult&&pickResult.worldPos){pointerWorldPos.set(pickResult.worldPos);_this24.pointerCircle.start(pickResult.canvasPos);}else{return;}}longTouchTimeout=setTimeout(function(){if(currentNumTouches!==1||touchMoveCanvasPos[0]>touchStartCanvasPos[0]+touchTolerance||touchMoveCanvasPos[0]<touchStartCanvasPos[0]-touchTolerance||touchMoveCanvasPos[1]>touchStartCanvasPos[1]+touchTolerance||touchMoveCanvasPos[1]<touchStartCanvasPos[1]-touchTolerance){return;// Has moved
3393
3393
  }// Long touch
3394
3394
  if(_this24.pointerLens){_this24.pointerLens.visible=true;_this24.pointerLens.canvasPos=touchStartCanvasPos;_this24.pointerLens.cursorPos=touchStartCanvasPos;}if(_this24.pointerLens){_this24.pointerLens.canvasPos=touchMoveCanvasPos;_this24.pointerLens.snapped=false;}if(_this24.pointerLens){_this24.pointerLens.cursorPos=snapPickResult.canvasPos;_this24.pointerLens.snapped=true;}// pointerWorldPos.set(snapPickResult.worldPos);
@@ -3411,7 +3411,7 @@ return;}// Long touch
3411
3411
  if(_this24.pointerLens){_this24.pointerLens.visible=true;_this24.pointerLens.canvasPos=touchStartCanvasPos;_this24.pointerLens.snapped=false;}var snapPickResult=scene.pick({canvasPos:touchMoveCanvasPos,snapToVertex:_this24._snapping,snapToEdge:_this24._snapping});if(snapPickResult&&snapPickResult.snapped){if(_this24.pointerLens){_this24.pointerLens.cursorPos=snapPickResult.snappedCanvasPos;_this24.pointerLens.snapped=true;}_this24.pointerCircle.start(snapPickResult.snappedCanvasPos);pointerWorldPos.set(snapPickResult.worldPos);_this24._currentAngleMeasurement.target.worldPos=snapPickResult.worldPos;_this24._currentAngleMeasurement.target.entity=snapPickResult.entity;_this24._currentAngleMeasurement.originVisible=true;_this24._currentAngleMeasurement.originWireVisible=true;_this24._currentAngleMeasurement.cornerVisible=true;_this24._currentAngleMeasurement.cornerWireVisible=true;_this24._currentAngleMeasurement.targetVisible=true;_this24._currentAngleMeasurement.targetWireVisible=true;_this24._currentAngleMeasurement.angleVisible=true;_this24.angleMeasurementsPlugin.fire("measurementStart",_this24._currentAngleMeasurement);}else{var _pickResult3=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(_pickResult3&&_pickResult3.worldPos){if(_this24.pointerLens){_this24.pointerLens.cursorPos=_pickResult3.canvasPos;_this24.pointerLens.snapped=false;}_this24.pointerCircle.start(_pickResult3.canvasPos);pointerWorldPos.set(_pickResult3.worldPos);_this24._currentAngleMeasurement.target.worldPos=_pickResult3.worldPos;_this24._currentAngleMeasurement.target.entity=_pickResult3.entity;_this24._currentAngleMeasurement.originVisible=true;_this24._currentAngleMeasurement.originWireVisible=true;_this24._currentAngleMeasurement.cornerVisible=true;_this24._currentAngleMeasurement.cornerWireVisible=true;_this24._currentAngleMeasurement.targetVisible=true;_this24._currentAngleMeasurement.targetWireVisible=true;_this24._currentAngleMeasurement.angleVisible=true;plugin.fire("measurementStart",_this24._currentAngleMeasurement);}else{if(_this24.pointerLens){_this24.pointerLens.cursorPos=null;_this24.pointerLens.snapped=false;}}}_this24._touchState=WAITING_FOR_TARGET_LONG_TOUCH_END$1;// console.log("touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_LONG_TOUCH_END")
3412
3412
  disableCameraNavigation();},_this24._longTouchTimeoutMs);_this24._touchState=WAITING_FOR_TARGET_QUICK_TOUCH_END$1;// console.log("touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_QUICK_TOUCH_END")
3413
3413
  }touchId=touch.identifier;break;default:if(longTouchTimeout!==null){clearTimeout(longTouchTimeout);longTouchTimeout=null;}_this24._touchState=TOUCH_CANCELING$1;// console.log("touchstart: this._touchState= default -> TOUCH_CANCELING")
3414
- return;}},{passive:true});canvas.addEventListener("touchmove",function(event){_this24.pointerCircle.stop();var currentNumTouches=event.touches.length;if(currentNumTouches!==1||event.changedTouches.length!==1){if(longTouchTimeout){clearTimeout(longTouchTimeout);longTouchTimeout=null;}return;}var touch=event.touches[0];var touchX=touch.clientX;var touchY=touch.clientY;if(touch.identifier!==touchId){return;}touchMoveCanvasPos.set([touchX,touchY]);var snapPickResult;var pickResult;switch(_this24._touchState){case WAITING_FOR_ORIGIN_LONG_TOUCH_END$1:if(_this24.pointerLens){_this24.pointerLens.canvasPos=touchMoveCanvasPos;}snapPickResult=scene.pick({canvasPos:touchMoveCanvasPos,snapToVertex:_this24._snapping,snapToEdge:_this24._snapping});if(snapPickResult&&snapPickResult.snapped){if(_this24.pointerLens){_this24.pointerLens.snappedCanvasPos=snapPickResult.snappedCanvasPos;_this24.pointerLens.snapped=true;}pointerWorldPos.set(snapPickResult.worldPos);_this24._currentAngleMeasurement.origin.worldPos=snapPickResult.worldPos;}else{pickResult=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(pickResult&&pickResult.worldPos){if(_this24.pointerLens){_this24.pointerLens.cursorPos=pickResult.canvasPos;_this24.pointerLens.snapped=false;}pointerWorldPos.set(pickResult.worldPos);_this24._currentAngleMeasurement.origin.worldPos=pickResult.worldPos;}else{if(_this24.pointerLens){_this24.pointerLens.cursorPos=null;_this24.pointerLens.snapped=false;}}}_this24._touchState=WAITING_FOR_ORIGIN_LONG_TOUCH_END$1;// console.log("touchmove: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_LONG_TOUCH_END")
3414
+ return;}},{passive:true});canvas.addEventListener("touchmove",function(event){_this24.pointerCircle.stop();var currentNumTouches=event.touches.length;if(currentNumTouches!==1||event.changedTouches.length!==1){if(longTouchTimeout){clearTimeout(longTouchTimeout);longTouchTimeout=null;}return;}var touch=event.touches[0];var touchX=touch.clientX;var touchY=touch.clientY;if(touch.identifier!==touchId){return;}touchMoveCanvasPos.set([touchX+_this24.offsetX,touchY+_this24.offsetY]);var snapPickResult;var pickResult;switch(_this24._touchState){case WAITING_FOR_ORIGIN_LONG_TOUCH_END$1:if(_this24.pointerLens){_this24.pointerLens.canvasPos=touchMoveCanvasPos;}snapPickResult=scene.pick({canvasPos:touchMoveCanvasPos,snapToVertex:_this24._snapping,snapToEdge:_this24._snapping});if(snapPickResult&&snapPickResult.snapped){if(_this24.pointerLens){_this24.pointerLens.snappedCanvasPos=snapPickResult.snappedCanvasPos;_this24.pointerLens.snapped=true;}pointerWorldPos.set(snapPickResult.worldPos);_this24._currentAngleMeasurement.origin.worldPos=snapPickResult.worldPos;}else{pickResult=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(pickResult&&pickResult.worldPos){if(_this24.pointerLens){_this24.pointerLens.cursorPos=pickResult.canvasPos;_this24.pointerLens.snapped=false;}pointerWorldPos.set(pickResult.worldPos);_this24._currentAngleMeasurement.origin.worldPos=pickResult.worldPos;}else{if(_this24.pointerLens){_this24.pointerLens.cursorPos=null;_this24.pointerLens.snapped=false;}}}_this24._touchState=WAITING_FOR_ORIGIN_LONG_TOUCH_END$1;// console.log("touchmove: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_LONG_TOUCH_END")
3415
3415
  break;case WAITING_FOR_CORNER_LONG_TOUCH_END:if(currentNumTouches!==1&&longTouchTimeout!==null){// Two or more fingers down
3416
3416
  clearTimeout(longTouchTimeout);longTouchTimeout=null;if(_this24.pointerLens){_this24.pointerLens.visible=false;}_this24._touchState=TOUCH_CANCELING$1;// console.log("touchmove: this._touchState= QUICK_TOUCH_FINDING_CORNER -> TOUCH_CANCELING")
3417
3417
  return;}if(_this24.pointerLens){_this24.pointerLens.canvasPos=touchMoveCanvasPos;}snapPickResult=scene.pick({canvasPos:touchMoveCanvasPos,snapToVertex:_this24._snapping,snapToEdge:_this24._snapping});if(snapPickResult&&snapPickResult.worldPos){if(_this24.pointerLens){_this24.pointerLens.cursorPos=snapPickResult.snappedCanvasPos;_this24.pointerLens.snapped=true;}_this24._currentAngleMeasurement.corner.worldPos=snapPickResult.worldPos;_this24._currentAngleMeasurement.originVisible=true;_this24._currentAngleMeasurement.originWireVisible=true;_this24._currentAngleMeasurement.cornerVisible=true;_this24._currentAngleMeasurement.cornerWireVisible=false;_this24._currentAngleMeasurement.targetVisible=false;_this24._currentAngleMeasurement.targetWireVisible=false;_this24._currentAngleMeasurement.angleVisible=false;}else{pickResult=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(pickResult&&pickResult.worldPos){if(_this24.pointerLens){_this24.pointerLens.cursorPos=pickResult.canvasPos;_this24.pointerLens.snapped=false;}_this24._currentAngleMeasurement.corner.worldPos=pickResult.worldPos;_this24._currentAngleMeasurement.originVisible=true;_this24._currentAngleMeasurement.originWireVisible=true;_this24._currentAngleMeasurement.cornerVisible=true;_this24._currentAngleMeasurement.cornerWireVisible=false;_this24._currentAngleMeasurement.targetVisible=false;_this24._currentAngleMeasurement.targetWireVisible=false;_this24._currentAngleMeasurement.angleVisible=false;}}_this24._touchState=WAITING_FOR_CORNER_LONG_TOUCH_END;break;case WAITING_FOR_TARGET_LONG_TOUCH_END$1:if(currentNumTouches!==1&&longTouchTimeout!==null){// Two or more fingers down
@@ -19748,7 +19748,7 @@ _this90.pointerCircle=new PointerCircle(distanceMeasurementsPlugin.viewer,{id:"d
19748
19748
  * @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.
19749
19749
  */function get(){return this._snapping;}/**
19750
19750
  * Activates this DistanceMeasurementsTouchControl, ready to respond to input.
19751
- */,set:function set(snapping){if(snapping!==this._snapping){this._snapping=snapping;this.deactivate();this.activate();}else{this._snapping=snapping;}}},{key:"activate",value:function activate(){var _this91=this;if(this._active){return;}var plugin=this.plugin;var scene=this.scene;var canvas=scene.canvas.canvas;this.pointerLens;var pointerWorldPos=math.vec3();var touchTolerance=20;var longTouchTimeout=null;this._touchState=WAITING_FOR_ORIGIN_TOUCH_START;var touchStartCanvasPos=math.vec2();var touchMoveCanvasPos=math.vec2();var touchEndCanvasPos=math.vec2();var touchId=null;var disableCameraNavigation=function disableCameraNavigation(){_this91.plugin.viewer.cameraControl.active=false;};var enableCameraNavigation=function enableCameraNavigation(){_this91.plugin.viewer.cameraControl.active=true;};var cancel=function cancel(){if(longTouchTimeout){clearTimeout(longTouchTimeout);longTouchTimeout=null;}if(_this91._currentDistanceMeasurement){_this91._currentDistanceMeasurement.destroy();_this91._currentDistanceMeasurement=null;}enableCameraNavigation();_this91._touchState=WAITING_FOR_ORIGIN_TOUCH_START;};canvas.addEventListener("touchstart",this._onCanvasTouchStart=function(event){if(!event.isTrusted)return;var currentNumTouches=event.touches.length;if(currentNumTouches!==1){if(longTouchTimeout){clearTimeout(longTouchTimeout);longTouchTimeout=null;}return;}var touch=event.touches[0];var touchX=touch.clientX;var touchY=touch.clientY;touchStartCanvasPos.set([touchX,touchY]);touchMoveCanvasPos.set([touchX,touchY]);switch(_this91._touchState){case WAITING_FOR_ORIGIN_TOUCH_START:if(currentNumTouches!==1&&longTouchTimeout!==null){// Two or more fingers down
19751
+ */,set:function set(snapping){if(snapping!==this._snapping){this._snapping=snapping;this.deactivate();this.activate();}else{this._snapping=snapping;}}},{key:"activate",value:function activate(){var _this91=this;if(this._active){return;}var plugin=this.plugin;var scene=this.scene;var canvas=scene.canvas.canvas;this.pointerLens;var pointerWorldPos=math.vec3();var touchTolerance=20;var longTouchTimeout=null;this._touchState=WAITING_FOR_ORIGIN_TOUCH_START;var touchStartCanvasPos=math.vec2();var touchMoveCanvasPos=math.vec2();var touchEndCanvasPos=math.vec2();var touchId=null;var disableCameraNavigation=function disableCameraNavigation(){_this91.plugin.viewer.cameraControl.active=false;};var enableCameraNavigation=function enableCameraNavigation(){_this91.plugin.viewer.cameraControl.active=true;};var cancel=function cancel(){if(longTouchTimeout){clearTimeout(longTouchTimeout);longTouchTimeout=null;}if(_this91._currentDistanceMeasurement){_this91._currentDistanceMeasurement.destroy();_this91._currentDistanceMeasurement=null;}enableCameraNavigation();_this91._touchState=WAITING_FOR_ORIGIN_TOUCH_START;};canvas.addEventListener("touchstart",this._onCanvasTouchStart=function(event){if(!event.isTrusted)return;var currentNumTouches=event.touches.length;if(currentNumTouches!==1){if(longTouchTimeout){clearTimeout(longTouchTimeout);longTouchTimeout=null;}return;}var touch=event.touches[0];var touchX=touch.clientX;var touchY=touch.clientY;touchStartCanvasPos.set([touchX+_this91.offsetX,touchY+_this91.offsetY]);touchMoveCanvasPos.set([touchX+_this91.offsetX,touchY+_this91.offsetY]);switch(_this91._touchState){case WAITING_FOR_ORIGIN_TOUCH_START:if(currentNumTouches!==1&&longTouchTimeout!==null){// Two or more fingers down
19752
19752
  cancel();return;}var snapPickResult=scene.pick({canvasPos:touchMoveCanvasPos,snapping:_this91._snapping,snapToEdge:_this91._snapping});if(snapPickResult&&snapPickResult.snapped){pointerWorldPos.set(snapPickResult.worldPos);_this91.pointerCircle.start(snapPickResult.snappedCanvasPos);}else{var pickResult=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(pickResult&&pickResult.worldPos){pointerWorldPos.set(pickResult.worldPos);_this91.pointerCircle.start(pickResult.canvasPos);}else{return;}}longTouchTimeout=setTimeout(function(){if(currentNumTouches!==1||touchMoveCanvasPos[0]>touchStartCanvasPos[0]+touchTolerance||touchMoveCanvasPos[0]<touchStartCanvasPos[0]-touchTolerance||touchMoveCanvasPos[1]>touchStartCanvasPos[1]+touchTolerance||touchMoveCanvasPos[1]<touchStartCanvasPos[1]-touchTolerance){return;// Has moved
19753
19753
  }// Long touch
19754
19754
  if(_this91.pointerLens){_this91.pointerLens.visible=true;_this91.pointerLens.canvasPos=touchStartCanvasPos;_this91.pointerLens.cursorPos=touchStartCanvasPos;}if(_this91.pointerLens){_this91.pointerLens.canvasPos=touchMoveCanvasPos;_this91.pointerLens.snapped=false;}if(_this91.pointerLens){_this91.pointerLens.cursorPos=snapPickResult.canvasPos;_this91.pointerLens.snapped=true;}// pointerWorldPos.set(snapPickResult.snappedWorldPos);
@@ -19765,7 +19765,7 @@ return;}// Long touch
19765
19765
  if(_this91.pointerLens){_this91.pointerLens.visible=true;_this91.pointerLens.canvasPos=touchStartCanvasPos;_this91.pointerLens.snapped=false;}var snapPickResult=scene.pick({canvasPos:touchMoveCanvasPos,snapToVertex:_this91._snapping,snapToEdge:_this91._snapping});if(snapPickResult&&snapPickResult.snapped){if(_this91.pointerLens){_this91.pointerLens.cursorPos=snapPickResult.snappedCanvasPos;_this91.pointerLens.snapped=true;}_this91.pointerCircle.start(snapPickResult.snappedCanvasPos);pointerWorldPos.set(snapPickResult.worldPos);_this91._currentDistanceMeasurement.target.worldPos=snapPickResult.worldPos;_this91._currentDistanceMeasurement.target.entity=snapPickResult.entity;_this91._currentDistanceMeasurement.targetVisible=true;_this91._currentDistanceMeasurement.wireVisible=true;_this91._currentDistanceMeasurement.labelsVisible=true;_this91.distanceMeasurementsPlugin.fire("measurementStart",_this91._currentDistanceMeasurement);}else{var _pickResult6=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(_pickResult6&&_pickResult6.worldPos){if(_this91.pointerLens){_this91.pointerLens.cursorPos=_pickResult6.canvasPos;_this91.pointerLens.snapped=false;}_this91.pointerCircle.start(_pickResult6.canvasPos);pointerWorldPos.set(_pickResult6.worldPos);_this91._currentDistanceMeasurement.target.worldPos=_pickResult6.worldPos;_this91._currentDistanceMeasurement.target.entity=_pickResult6.entity;_this91._currentDistanceMeasurement.targetVisible=true;_this91._currentDistanceMeasurement.wireVisible=true;_this91._currentDistanceMeasurement.labelsVisible=true;_this91.distanceMeasurementsPlugin.fire("measurementStart",_this91._currentDistanceMeasurement);}else{if(_this91.pointerLens){_this91.pointerLens.cursorPos=null;_this91.pointerLens.snapped=false;}}}_this91._touchState=WAITING_FOR_TARGET_LONG_TOUCH_END;// console.log("touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_LONG_TOUCH_END")
19766
19766
  disableCameraNavigation();},_this91._longTouchTimeoutMs);_this91._touchState=WAITING_FOR_TARGET_QUICK_TOUCH_END;// console.log("touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_QUICK_TOUCH_END")
19767
19767
  }touchId=touch.identifier;break;default:if(longTouchTimeout!==null){clearTimeout(longTouchTimeout);longTouchTimeout=null;}_this91._touchState=TOUCH_CANCELING;// console.log("touchstart: this._touchState= default -> TOUCH_CANCELING")
19768
- return;}},{passive:true});canvas.addEventListener("touchmove",function(event){_this91.pointerCircle.stop();var currentNumTouches=event.touches.length;if(currentNumTouches!==1||event.changedTouches.length!==1){if(longTouchTimeout){clearTimeout(longTouchTimeout);longTouchTimeout=null;}return;}var touch=event.touches[0];var touchX=touch.clientX;var touchY=touch.clientY;if(touch.identifier!==touchId){return;}touchMoveCanvasPos.set([touchX,touchY]);var snapPickResult;var pickResult;switch(_this91._touchState){case WAITING_FOR_ORIGIN_LONG_TOUCH_END:if(_this91.pointerLens){_this91.pointerLens.canvasPos=touchMoveCanvasPos;}snapPickResult=scene.pick({canvasPos:touchMoveCanvasPos,snapToVertex:_this91._snapping,snapToEdge:_this91._snapping});if(snapPickResult&&snapPickResult.snapped){if(_this91.pointerLens){_this91.pointerLens.snappedCanvasPos=snapPickResult.snappedCanvasPos;_this91.pointerLens.snapped=true;}pointerWorldPos.set(snapPickResult.worldPos);if(!_this91._currentDistanceMeasurement){_this91._currentDistanceMeasurement=plugin.createMeasurement({id:math.createUUID(),origin:{worldPos:snapPickResult.worldPos,entity:snapPickResult.entity},target:{worldPos:snapPickResult.worldPos,entity:snapPickResult.entity},precision:plugin.precision});_this91._currentDistanceMeasurement.labelsVisible=false;_this91._currentDistanceMeasurement.xAxisVisible=false;_this91._currentDistanceMeasurement.yAxisVisible=false;_this91._currentDistanceMeasurement.zAxisVisible=false;_this91._currentDistanceMeasurement.wireVisible=false;_this91._currentDistanceMeasurement.originVisible=true;_this91._currentDistanceMeasurement.targetVisible=false;_this91._currentDistanceMeasurement.clickable=false;}else{_this91._currentDistanceMeasurement.origin.worldPos=snapPickResult.worldPos;}_this91.distanceMeasurementsPlugin.fire("measurementStart",_this91._currentDistanceMeasurement);}else{pickResult=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(pickResult&&pickResult.worldPos){if(_this91.pointerLens){_this91.pointerLens.cursorPos=pickResult.canvasPos;_this91.pointerLens.snapped=false;}pointerWorldPos.set(pickResult.worldPos);if(!_this91._currentDistanceMeasurement){_this91._currentDistanceMeasurement=plugin.createMeasurement({id:math.createUUID(),origin:{worldPos:pickResult.worldPos,entity:pickResult.entity},target:{worldPos:pickResult.worldPos,entity:pickResult.entity},precision:plugin.precision});_this91._currentDistanceMeasurement.labelsVisible=false;_this91._currentDistanceMeasurement.xAxisVisible=false;_this91._currentDistanceMeasurement.yAxisVisible=false;_this91._currentDistanceMeasurement.zAxisVisible=false;_this91._currentDistanceMeasurement.wireVisible=false;_this91._currentDistanceMeasurement.originVisible=true;_this91._currentDistanceMeasurement.targetVisible=false;_this91._currentDistanceMeasurement.clickable=false;}else{_this91._currentDistanceMeasurement.origin.worldPos=pickResult.worldPos;}_this91.distanceMeasurementsPlugin.fire("measurementStart",_this91._currentDistanceMeasurement);}else{if(_this91.pointerLens){_this91.pointerLens.cursorPos=null;_this91.pointerLens.snapped=false;}}}_this91._touchState=WAITING_FOR_ORIGIN_LONG_TOUCH_END;// console.log("touchmove: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_LONG_TOUCH_END")
19768
+ return;}},{passive:true});canvas.addEventListener("touchmove",function(event){_this91.pointerCircle.stop();var currentNumTouches=event.touches.length;if(currentNumTouches!==1||event.changedTouches.length!==1){if(longTouchTimeout){clearTimeout(longTouchTimeout);longTouchTimeout=null;}return;}var touch=event.touches[0];var touchX=touch.clientX;var touchY=touch.clientY;if(touch.identifier!==touchId){return;}touchMoveCanvasPos.set([touchX+_this91.offsetX,touchY+_this91.offsetY]);var snapPickResult;var pickResult;switch(_this91._touchState){case WAITING_FOR_ORIGIN_LONG_TOUCH_END:if(_this91.pointerLens){_this91.pointerLens.canvasPos=touchMoveCanvasPos;}snapPickResult=scene.pick({canvasPos:touchMoveCanvasPos,snapToVertex:_this91._snapping,snapToEdge:_this91._snapping});if(snapPickResult&&snapPickResult.snapped){if(_this91.pointerLens){_this91.pointerLens.snappedCanvasPos=snapPickResult.snappedCanvasPos;_this91.pointerLens.snapped=true;}pointerWorldPos.set(snapPickResult.worldPos);if(!_this91._currentDistanceMeasurement){_this91._currentDistanceMeasurement=plugin.createMeasurement({id:math.createUUID(),origin:{worldPos:snapPickResult.worldPos,entity:snapPickResult.entity},target:{worldPos:snapPickResult.worldPos,entity:snapPickResult.entity},precision:plugin.precision});_this91._currentDistanceMeasurement.labelsVisible=false;_this91._currentDistanceMeasurement.xAxisVisible=false;_this91._currentDistanceMeasurement.yAxisVisible=false;_this91._currentDistanceMeasurement.zAxisVisible=false;_this91._currentDistanceMeasurement.wireVisible=false;_this91._currentDistanceMeasurement.originVisible=true;_this91._currentDistanceMeasurement.targetVisible=false;_this91._currentDistanceMeasurement.clickable=false;}else{_this91._currentDistanceMeasurement.origin.worldPos=snapPickResult.worldPos;}_this91.distanceMeasurementsPlugin.fire("measurementStart",_this91._currentDistanceMeasurement);}else{pickResult=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(pickResult&&pickResult.worldPos){if(_this91.pointerLens){_this91.pointerLens.cursorPos=pickResult.canvasPos;_this91.pointerLens.snapped=false;}pointerWorldPos.set(pickResult.worldPos);if(!_this91._currentDistanceMeasurement){_this91._currentDistanceMeasurement=plugin.createMeasurement({id:math.createUUID(),origin:{worldPos:pickResult.worldPos,entity:pickResult.entity},target:{worldPos:pickResult.worldPos,entity:pickResult.entity},precision:plugin.precision});_this91._currentDistanceMeasurement.labelsVisible=false;_this91._currentDistanceMeasurement.xAxisVisible=false;_this91._currentDistanceMeasurement.yAxisVisible=false;_this91._currentDistanceMeasurement.zAxisVisible=false;_this91._currentDistanceMeasurement.wireVisible=false;_this91._currentDistanceMeasurement.originVisible=true;_this91._currentDistanceMeasurement.targetVisible=false;_this91._currentDistanceMeasurement.clickable=false;}else{_this91._currentDistanceMeasurement.origin.worldPos=pickResult.worldPos;}_this91.distanceMeasurementsPlugin.fire("measurementStart",_this91._currentDistanceMeasurement);}else{if(_this91.pointerLens){_this91.pointerLens.cursorPos=null;_this91.pointerLens.snapped=false;}}}_this91._touchState=WAITING_FOR_ORIGIN_LONG_TOUCH_END;// console.log("touchmove: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_LONG_TOUCH_END")
19769
19769
  break;// case WAITING_FOR_TARGET_TOUCH_START:
19770
19770
  // this._touchState = WAITING_FOR_TARGET_TOUCH_START;
19771
19771
  // console.log("touchmove: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_TOUCH_START")
@@ -22307,7 +22307,7 @@ var worldPos2=this._unproject(targetCanvasPos,tempVec4b$4);var _offset=math.subV
22307
22307
  this._scene=scene;this._configs=configs;this._pivotWorldPos=math.vec3();this._cameraOffset=math.vec3();this._azimuth=0;this._polar=0;this._radius=0;this._pivotPosSet=false;// Initially false, true as soon as _pivotWorldPos has been set to some value
22308
22308
  this._pivoting=false;// True while pivoting
22309
22309
  this._shown=false;this._pivotSphereEnabled=false;this._pivotSphere=null;this._pivotSphereSize=1;this._pivotSphereGeometry=null;this._pivotSphereMaterial=null;this._rtcCenter=math.vec3();this._rtcPos=math.vec3();this._pivotViewPos=math.vec4();this._pivotProjPos=math.vec4();this._pivotCanvasPos=math.vec2();this._cameraDirty=true;this._onViewMatrix=this._scene.camera.on("viewMatrix",function(){_this111._cameraDirty=true;});this._onProjMatrix=this._scene.camera.on("projMatrix",function(){_this111._cameraDirty=true;});this._onTick=this._scene.on("tick",function(){_this111.updatePivotElement();_this111.updatePivotSphere();});}return _createClass(PivotController,[{key:"createPivotSphere",value:function createPivotSphere(){var currentPos=this.getPivotPos();var cameraPos=math.vec3();math.decomposeMat4(math.inverseMat4(this._scene.viewer.camera.viewMatrix,math.mat4()),cameraPos,math.vec4(),math.vec3());var length=math.distVec3(cameraPos,currentPos);var radius=Math.tan(Math.PI/500)*length*this._pivotSphereSize;if(this._scene.camera.projection=="ortho"){radius/=this._scene.camera.ortho.scale/2;}worldToRTCPos(currentPos,this._rtcCenter,this._rtcPos);this._pivotSphereGeometry=new VBOGeometry(this._scene,buildSphereGeometry({radius:radius}));this._pivotSphere=new Mesh(this._scene,{geometry:this._pivotSphereGeometry,material:this._pivotSphereMaterial,pickable:false,position:this._rtcPos,rtcCenter:this._rtcCenter});}},{key:"destroyPivotSphere",value:function destroyPivotSphere(){if(this._pivotSphere){this._pivotSphere.destroy();this._pivotSphere=null;}if(this._pivotSphereGeometry){this._pivotSphereGeometry.destroy();this._pivotSphereGeometry=null;}}},{key:"getPointScreenPos",value:function getPointScreenPos(pos){var camera=this._scene.camera;var canvas=this._scene.canvas;var canvasAABB=canvas.boundary;var canvasWidth=canvasAABB[2];var canvasHeight=canvasAABB[3];var pos11=math.vec4();var pos22=math.vec4();var screenPos=math.vec2();math.transformPoint3(camera.viewMatrix,pos,pos11);math.transformPoint4(camera.projMatrix,pos,pos22);screenPos[0]=Math.floor((1+pos22[0]/pos22[3])*canvasWidth/2);screenPos[1]=Math.floor((1-pos22[1]/pos22[3])*canvasHeight/2);return screenPos;}},{key:"updatePivotElement",value:function updatePivotElement(){var camera=this._scene.camera;var canvas=this._scene.canvas;if(this._pivoting&&this._cameraDirty){math.transformPoint3(camera.viewMatrix,this.getPivotPos(),this._pivotViewPos);this._pivotViewPos[3]=1;math.transformPoint4(camera.projMatrix,this._pivotViewPos,this._pivotProjPos);var canvasAABB=canvas.boundary;var canvasWidth=canvasAABB[2];var canvasHeight=canvasAABB[3];this._pivotCanvasPos[0]=Math.floor((1+this._pivotProjPos[0]/this._pivotProjPos[3])*canvasWidth/2);this._pivotCanvasPos[1]=Math.floor((1-this._pivotProjPos[1]/this._pivotProjPos[3])*canvasHeight/2);// data-textures: avoid to do continuous DOM layout calculations
22310
- var canvasBoundingRect=canvas._lastBoundingClientRect;var canvasElem=canvas.canvas;canvasBoundingRect=canvas._lastBoundingClientRect=canvasElem.getBoundingClientRect();if(this._pivotElement){this._pivotElement.style.left=Math.floor(canvasBoundingRect.left+this._pivotCanvasPos[0])-this._pivotElement.clientWidth/2+window.scrollX+canvas.offset[0];this._pivotElement.style.top=Math.floor(canvasBoundingRect.top+this._pivotCanvasPos[1])-this._pivotElement.clientHeight/2+window.scrollY+canvas.offset[1];}this._cameraDirty=false;}}},{key:"updatePivotSphere",value:function updatePivotSphere(){if(this._pivoting&&this._pivotSphere){worldToRTCPos(this.getPivotPos(),this._rtcCenter,this._rtcPos);if(!math.compareVec3(this._rtcPos,this._pivotSphere.position)){this.destroyPivotSphere();this.createPivotSphere();}}}/**
22310
+ var canvasBoundingRect=canvas._lastBoundingClientRect;var canvasElem=canvas.canvas;canvasBoundingRect=canvas._lastBoundingClientRect=canvasElem.getBoundingClientRect();if(this._pivotElement){this._pivotElement.style.left=Math.floor(canvasBoundingRect.left+this._pivotCanvasPos[0])-this._pivotElement.clientWidth/2+window.scrollX;this._pivotElement.style.top=Math.floor(canvasBoundingRect.top+this._pivotCanvasPos[1])-this._pivotElement.clientHeight/2+window.scrollY;}this._cameraDirty=false;}}},{key:"updatePivotSphere",value:function updatePivotSphere(){if(this._pivoting&&this._pivotSphere){worldToRTCPos(this.getPivotPos(),this._rtcCenter,this._rtcPos);if(!math.compareVec3(this._rtcPos,this._pivotSphere.position)){this.destroyPivotSphere();this.createPivotSphere();}}}/**
22311
22311
  * Sets the HTML DOM element that will represent the pivot position.
22312
22312
  *
22313
22313
  * @param pivotElement
@@ -22553,8 +22553,13 @@ pagePos:[Math.round(rightClickPageX),Math.round(rightClickPageY)],canvasPos:[Mat
22553
22553
  var pickedSurfaceSubs=cameraControl.hasSubs("pickedSurface");getCanvasPosFromEvent(touches[0],pickController.pickCursorPos);pickController.schedulePickEntity=true;pickController.schedulePickSurface=pickedSurfaceSubs;pickController.update();if(pickController.pickResult){cameraControl.fire("touchEntity",pickController.pickResult);if(pickController.pickedSurface){cameraControl.fire("touchSurface",pickController.pickResult);}}else{cameraControl.fire("touchNothing");}}else{tapStartTime=-1;}///////////
22554
22554
  while(activeTouches.length<touches.length){activeTouches.push(new Float32Array(2));}for(var _i473=0,len=touches.length;_i473<len;++_i473){getCanvasPosFromEvent(touches[_i473],activeTouches[_i473]);}activeTouches.length=touches.length;},{passive:true});this.canvas.addEventListener("touchend",this._canvasTouchEndHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}var currentTime=Date.now();var touches=e.touches;var changedTouches=e.changedTouches;var pickedSurfaceSubs=cameraControl.hasSubs("pickedSurface");if(states.longTouchTimeout!==null){clearTimeout(states.longTouchTimeout);states.longTouchTimeout=null;}// process tap
22555
22555
  if(touches.length===0&&changedTouches.length===1){if(tapStartTime>-1&&currentTime-tapStartTime<TAP_INTERVAL){// Double-tap
22556
- if(lastTapTime>-1&&tapStartTime-lastTapTime<DBL_TAP_INTERVAL){getCanvasPosFromEvent(changedTouches[0],pickController.pickCursorPos);pickController.schedulePickEntity=true;pickController.schedulePickSurface=pickedSurfaceSubs;pickController.update();if(pickController.pickResult){pickController.pickResult.touchInput=true;cameraControl.fire("doublePicked",pickController.pickResult);cameraControl.fire("touchDoublePicked",pickController.pickResult);if(pickController.pickedSurface){cameraControl.fire("doublePickedSurface",pickController.pickResult);cameraControl.fire("touchDoublePickedSurface",pickController.pickResult);}if(configs.doublePickFlyTo){flyCameraTo(pickController.pickResult);}}else{cameraControl.fire("doublePickedNothing");cameraControl.fire("touchDoublePickedNothing");if(configs.doublePickFlyTo){flyCameraTo();}}lastTapTime=-1;}// Single-tap
22557
- else if(math.distVec2(activeTouches[0],tapStartPos)<TAP_DISTANCE_THRESHOLD){getCanvasPosFromEvent(changedTouches[0],pickController.pickCursorPos);pickController.schedulePickEntity=true;pickController.schedulePickSurface=pickedSurfaceSubs;pickController.update();if(pickController.pickResult){pickController.pickResult.touchInput=true;cameraControl.fire("picked",pickController.pickResult);cameraControl.fire("touchPicked",pickController.pickResult);if(pickController.pickedSurface){cameraControl.fire("pickedSurface",pickController.pickResult);cameraControl.fire("touchPickedSurface",pickController.pickResult);}}else{cameraControl.fire("pickedNothing");cameraControl.fire("touchPickedNothing");}lastTapTime=currentTime;}tapStartTime=-1;}}activeTouches.length=touches.length;for(var _i474=0,len=touches.length;_i474<len;++_i474){activeTouches[_i474][0]=touches[_i474].pageX;activeTouches[_i474][1]=touches[_i474].pageY;}e.stopPropagation();},{passive:true});this.canvas.addEventListener("touchcancel",this._canvasTouchEndHandler);}return _createClass(TouchPickHandler,[{key:"reset",value:function reset(){// TODO
22556
+ if(lastTapTime>-1&&tapStartTime-lastTapTime<DBL_TAP_INTERVAL){getCanvasPosFromEvent(changedTouches[0],pickController.pickCursorPos);pickController.schedulePickEntity=true;pickController.schedulePickSurface=pickedSurfaceSubs;pickController.update();if(pickController.pickResult){pickController.pickResult.touchInput=true;// cameraControl.fire("doublePicked", pickController.pickResult);
22557
+ cameraControl.fire("touchDoublePicked",pickController.pickResult);if(pickController.pickedSurface){// cameraControl.fire("doublePickedSurface", pickController.pickResult);
22558
+ cameraControl.fire("touchDoublePickedSurface",pickController.pickResult);}if(configs.doublePickFlyTo){flyCameraTo(pickController.pickResult);}}else{cameraControl.fire("doublePickedNothing");cameraControl.fire("touchDoublePickedNothing");if(configs.doublePickFlyTo){flyCameraTo();}}lastTapTime=-1;}// Single-tap
22559
+ else if(math.distVec2(activeTouches[0],tapStartPos)<TAP_DISTANCE_THRESHOLD){getCanvasPosFromEvent(changedTouches[0],pickController.pickCursorPos);pickController.schedulePickEntity=true;pickController.schedulePickSurface=pickedSurfaceSubs;pickController.update();if(pickController.pickResult){pickController.pickResult.touchInput=true;// cameraControl.fire("picked", pickController.pickResult);
22560
+ cameraControl.fire("touchPicked",pickController.pickResult);if(pickController.pickedSurface){// cameraControl.fire("pickedSurface", pickController.pickResult);
22561
+ cameraControl.fire("touchPickedSurface",pickController.pickResult);}}else{// cameraControl.fire("pickedNothing");
22562
+ cameraControl.fire("touchPickedNothing");}lastTapTime=currentTime;}tapStartTime=-1;}}activeTouches.length=touches.length;for(var _i474=0,len=touches.length;_i474<len;++_i474){activeTouches[_i474][0]=touches[_i474].pageX;activeTouches[_i474][1]=touches[_i474].pageY;}e.stopPropagation();},{passive:true});this.canvas.addEventListener("touchcancel",this._canvasTouchEndHandler);}return _createClass(TouchPickHandler,[{key:"reset",value:function reset(){// TODO
22558
22563
  // tapStartTime = -1;
22559
22564
  // lastTapTime = -1;
22560
22565
  }},{key:"destroy",value:function destroy(){if(this.canvas!=null){this.canvas.removeEventListener("touchstart",this._canvasTouchStartHandler);this.canvas.removeEventListener("touchend",this._canvasTouchEndHandler);this.canvas.removeEventListener("touchcancel",this._canvasTouchEndHandler);}}}]);}();var DEFAULT_SNAP_PICK_RADIUS=20;var DEFAULT_SNAP_VERTEX=true;var DEFAULT_SNAP_EDGE=true;/**
@@ -26152,7 +26157,7 @@ var sectionPlane=new SectionPlane(this.viewer.scene,{id:params.id,pos:params.pos
26152
26157
  */},{key:"sectionWay",set:function set(way){this._sectionWay=way;}/**
26153
26158
  * 设置剖切面方向
26154
26159
  * @param {number} direction
26155
- */},{key:"sectionDirection",set:function set(direction){this.clear();var dir;switch(direction){case 0:dir=[0,0,-1];break;case 1:dir=[0,-1,0];break;case 2:dir=[-1,0,0];break;}var center=this.viewer.scene.center;this.createSectionPlane({pos:math.AABB3([center[0],center[1],center[2]]),dir:dir});}/**
26160
+ */},{key:"sectionDirection",set:function set(direction){this.clear();var dir;switch(direction){case 0:dir=[0,0,-1];break;case 1:dir=[-1,0,0];break;case 2:dir=[0,-1,0];break;}var center=this.viewer.scene.center;this.createSectionPlane({pos:math.AABB3([center[0],center[1],center[2]]),dir:dir});}/**
26156
26161
  * 设置剖切面位置
26157
26162
  * @param id
26158
26163
  * @param pos
@@ -28934,8 +28939,8 @@ var metaModel=new MetaModel({metaScene:this.viewer.metaScene,id:modelId});this.v
28934
28939
  sceneModel.finalize();metaModel.finalize();_this170.viewer.scene.canvas.spinner.processes--;sceneModel.once("destroyed",function(){_this170.viewer.metaScene.destroyMetaModel(metaModel.id);});_this170.scheduleTask(function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
28935
28940
  sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
28936
28941
  });};var error=function error(errMsg){_this170.viewer.scene.canvas.spinner.processes--;_this170.error(errMsg);sceneModel.fire("error",errMsg);};var nextId=0;var manifestCtx={getNextId:function getNextId(){return"".concat(modelId,".").concat(nextId++);}};//模型文件
28937
- if(params.metaModelSrc||params.metaModelData){if(params.metaModelSrc){var metaModelSrc=params.metaModelSrc;this._dataSource.getMetaModel(metaModelSrc,function(metaModelData){if(sceneModel.destroyed){return;}metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){_this170._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{_this170._parseModel(params.xtc,params,options,sceneModel,null,manifestCtx);finish();}},function(errMsg){error("load(): Failed to load model metadata for model '".concat(modelId," from '").concat(metaModelSrc,"' - ").concat(errMsg));});}else if(params.metaModelData){metaModel.loadData(params.metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){this._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{this._parseModel(params.xtc,params,options,sceneModel,null,manifestCtx);finish();}}}else{if(params.src){this._loadModel(params.src,params,options,sceneModel,metaModel,manifestCtx,finish,error);}else if(params.xtc){this._parseModel(params.xtc,params,options,sceneModel,metaModel,manifestCtx);finish();}else if(params.manifestSrc||params.manifest){var baseDir=params.manifestSrc?getBaseDirectory(params.manifestSrc):"";var loadJSONs=function loadJSONs(metaDataFiles,done,error){var i=0;var loadNext=function loadNext(){if(i>=metaDataFiles.length){done();}else{_this170._dataSource.getMetaModel("".concat(baseDir).concat(metaDataFiles[i]),function(metaModelData){metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});i++;_this170.scheduleTask(loadNext,100);},error);}};loadNext();};var loadXTCs=function loadXTCs(xtcFiles,done,error){var i=0;var loadNext=function loadNext(){if(i>=xtcFiles.length){done();}else{_this170._dataSource.getXTC("".concat(baseDir).concat(xtcFiles[i]),function(arrayBuffer){_this170._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);i++;_this170.scheduleTask(loadNext,100);},error);}};loadNext();};if(params.manifest){var manifestData=params.manifest;var xtcFiles=manifestData.xtcFiles;if(!xtcFiles||xtcFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXTCs(xtcFiles,finish,error);},error);}else{loadXTCs(xtcFiles,finish,error);}}else{this._dataSource.getManifest(params.manifestSrc,function(manifestData){if(sceneModel.destroyed){return;}var xtcFiles=manifestData.xtcFiles;if(!xtcFiles||xtcFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXTCs(xtcFiles,finish,error);},error);}else{loadXTCs(xtcFiles,finish,error);}},error);}}}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel,metaModel,manifestCtx,done,error){var _this171=this;this._dataSource.getXTC(params.src,function(arrayBuffer){_this171._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);done();},error);}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx){if(sceneModel.destroyed){return;}var dataView=new DataView(arrayBuffer);var dataArray=new Uint8Array(arrayBuffer);var xtcVersion=dataView.getUint32(0,true);var parser=parsers[xtcVersion];if(!parser){this.error("Unsupported .XTC file version: "+xtcVersion+" - this XTCLoaderPlugin supports versions "+Object.keys(parsers));return;}this.log("Loading .xtc V"+xtcVersion);var numElements=dataView.getUint32(4,true);var elements=[];var byteOffset=(numElements+2)*4;for(var _i610=0;_i610<numElements;_i610++){var elementSize=dataView.getUint32((_i610+2)*4,true);elements.push(dataArray.subarray(byteOffset,byteOffset+elementSize));byteOffset+=elementSize;}parser.parse(this.viewer,options,elements,sceneModel,metaModel,manifestCtx);}},{key:"loadMetadata",value:function loadMetadata(metaModel,deflatedMetadata,done){var _this172=this;metaModel._finalized=false;try{{this._workerInflate(metaModel,deflatedMetadata,function(worker){worker.terminate();_this172.fire("metaLoaded",{result:"success",metaModel:metaModel});if(typeof done==="function")done();},function(worker,error){worker.terminate();_this172.fire("metaLoaded",{result:"failed",message:error,metaModel:metaModel});});}}catch(error){this.fire("metaloaded",{result:error,metaModel:metaModel});}}},{key:"_workerInflate",value:function _workerInflate(metaModel,buffer,done,err){var plugin=this;var worker=createInlineWorker();worker.postMessage({buffer:buffer// executionTime: new Date().getTime()
28938
- });worker.onmessage=function(e){plugin.fire("metaLoading",function(){metaModel.loadData(e.data.metaJson,function(){metaModel.finalize();if(typeof done==="function")done(worker);else worker.terminate();},function(e){if(typeof err==="function")err(worker,e);});});};worker.onerror=function(e){if(typeof err==="function")err(worker,e.message);worker.terminate();};}// _createDefaultMetaModelIfNeeded(sceneModel, params, options) {
28942
+ if(params.metaModelSrc||params.metaModelData){if(params.metaModelSrc){var metaModelSrc=params.metaModelSrc;this._dataSource.getMetaModel(metaModelSrc,function(metaModelData){if(sceneModel.destroyed){return;}metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){_this170._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{_this170._parseModel(params.xtc,params,options,sceneModel,null,manifestCtx);finish();}},function(errMsg){error("load(): Failed to load model metadata for model '".concat(modelId," from '").concat(metaModelSrc,"' - ").concat(errMsg));});}else if(params.metaModelData){metaModel.loadData(params.metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){this._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{this._parseModel(params.xtc,params,options,sceneModel,null,manifestCtx);finish();}}}else{if(params.src){this._loadModel(params.src,params,options,sceneModel,metaModel,manifestCtx,finish,error);}else if(params.xtc){this._parseModel(params.xtc,params,options,sceneModel,metaModel,manifestCtx);finish();}else if(params.manifestSrc||params.manifest){var baseDir=params.manifestSrc?getBaseDirectory(params.manifestSrc):"";var loadJSONs=function loadJSONs(metaDataFiles,done,error){var i=0;var loadNext=function loadNext(){if(i>=metaDataFiles.length){done();}else{_this170._dataSource.getMetaModel("".concat(baseDir).concat(metaDataFiles[i]),function(metaModelData){metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});i++;_this170.scheduleTask(loadNext,100);},error);}};loadNext();};var loadXTCs=function loadXTCs(xtcFiles,done,error){var i=0;var loadNext=function loadNext(){if(i>=xtcFiles.length){done();}else{_this170._dataSource.getXTC("".concat(baseDir).concat(xtcFiles[i]),function(arrayBuffer){_this170._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);i++;_this170.scheduleTask(loadNext,100);},error);}};loadNext();};if(params.manifest){var manifestData=params.manifest;var xtcFiles=manifestData.xtcFiles;if(!xtcFiles||xtcFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXTCs(xtcFiles,finish,error);},error);}else{loadXTCs(xtcFiles,finish,error);}}else{this._dataSource.getManifest(params.manifestSrc,function(manifestData){if(sceneModel.destroyed){return;}var xtcFiles=manifestData.xtcFiles;if(!xtcFiles||xtcFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXTCs(xtcFiles,finish,error);},error);}else{loadXTCs(xtcFiles,finish,error);}},error);}}}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel,metaModel,manifestCtx,done,error){var _this171=this;this._dataSource.getXTC(params.src,function(arrayBuffer){_this171._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);done();},error);}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx){if(sceneModel.destroyed){return;}var dataView=new DataView(arrayBuffer);var dataArray=new Uint8Array(arrayBuffer);var xtcVersion=dataView.getUint32(0,true);var parser=parsers[xtcVersion];if(!parser){this.error("Unsupported .XTC file version: "+xtcVersion+" - this XTCLoaderPlugin supports versions "+Object.keys(parsers));return;}this.log("Loading .xtc V"+xtcVersion);var numElements=dataView.getUint32(4,true);var elements=[];var byteOffset=(numElements+2)*4;for(var _i610=0;_i610<numElements;_i610++){var elementSize=dataView.getUint32((_i610+2)*4,true);elements.push(dataArray.subarray(byteOffset,byteOffset+elementSize));byteOffset+=elementSize;}parser.parse(this.viewer,options,elements,sceneModel,metaModel,manifestCtx);}},{key:"loadMetadata",value:function loadMetadata(metaModel,deflatedMetadata,force,done){var _this172=this;metaModel._finalized=false;try{{this._workerInflate(metaModel,deflatedMetadata,force,function(worker){worker.terminate();_this172.fire("metaLoaded",{result:"success",metaModel:metaModel});if(typeof done==="function")done();},function(worker,error){worker.terminate();_this172.fire("metaLoaded",{result:"failed",message:error,metaModel:metaModel});});}}catch(error){this.fire("metaloaded",{result:error,metaModel:metaModel});}}},{key:"_workerInflate",value:function _workerInflate(metaModel,buffer,force,done,err){var plugin=this;var worker=createInlineWorker();worker.postMessage({buffer:buffer// executionTime: new Date().getTime()
28943
+ });worker.onmessage=function(e){if(force){metaModel.loadData(e.data.metaJson,function(){metaModel.finalize();if(typeof done==="function")done(worker);else worker.terminate();},function(e){if(typeof err==="function")err(worker,e);});}else{plugin.fire("metaLoading",function(){metaModel.loadData(e.data.metaJson,function(){metaModel.finalize();if(typeof done==="function")done(worker);else worker.terminate();},function(e){if(typeof err==="function")err(worker,e);});});}};worker.onerror=function(e){if(typeof err==="function")err(worker,e.message);worker.terminate();};}// _createDefaultMetaModelIfNeeded(sceneModel, params, options) {
28939
28944
  //
28940
28945
  // const metaModelId = sceneModel.id;
28941
28946
  //