@xtctwins/tctwins-bimx-viewer 0.1.14 → 0.1.17

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.
@@ -2533,51 +2533,51 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._cornerDot.s
2533
2533
  * @interface
2534
2534
  * @abstract
2535
2535
  */var AngleMeasurementsControl=/*#__PURE__*/function(_Component3){function AngleMeasurementsControl(){_classCallCheck(this,AngleMeasurementsControl);return _callSuper(this,AngleMeasurementsControl,arguments);}_inherits(AngleMeasurementsControl,_Component3);return _createClass(AngleMeasurementsControl,[{key:"active",get:/**
2536
- * Gets if this AngleMeasurementsControl is currently active, where it is responding to input.
2537
- *
2538
- * @returns {boolean} True if this AngleMeassurementsControl is active.
2539
- * @abstract
2540
- */function get(){}/**
2541
- * Sets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsControl.
2542
- *
2543
- * This is `true` by default.
2544
- *
2545
- * Internally, this deactivates then activates the AngleMeasurementsControl when changed, which means that
2546
- * it will destroy any AngleMeasurements currently under construction, and incurs some overhead, since it unbinds
2547
- * and rebinds various input handlers.
2548
- *
2549
- * @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this AngleMeasurementsControl.
2550
- */},{key:"snapping",get:/**
2551
- * Gets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsControl.
2552
- *
2553
- * This is `true` by default.
2554
- *
2555
- * @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsControl.
2556
- */function get(){return true;}/**
2557
- * Activates this AngleMeasurementsMouseControl, ready to respond to input.
2558
- *
2559
- * @abstract
2560
- */,set:function set(snapping){}},{key:"activate",value:function activate(){}/**
2561
- * Deactivates this AngleMeasurementsControl, making it unresponsive to input.
2562
- *
2563
- * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsControl.
2564
- *
2565
- * @abstract
2566
- */},{key:"deactivate",value:function deactivate(){}/**
2567
- * Resets this AngleMeasurementsControl.
2568
- *
2569
- * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsControl.
2570
- *
2571
- * Does nothing if the AngleMeasurementsControl is not active.
2572
- *
2573
- * @abstract
2574
- */},{key:"reset",value:function reset(){}/**
2575
- * Destroys this AngleMeasurementsMouseControl.
2576
- *
2577
- * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsControl.
2578
- *
2579
- * @abstract
2580
- */},{key:"destroy",value:function destroy(){}}]);}(Component);var MOUSE_FINDING_ORIGIN=0;var MOUSE_FINDING_CORNER=1;var MOUSE_FINDING_TARGET=2;/**
2536
+ * Gets if this AngleMeasurementsControl is currently active, where it is responding to input.
2537
+ *
2538
+ * @returns {boolean} True if this AngleMeassurementsControl is active.
2539
+ * @abstract
2540
+ */function get(){},set:function set(active){}/**
2541
+ * Sets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsControl.
2542
+ *
2543
+ * This is `true` by default.
2544
+ *
2545
+ * Internally, this deactivates then activates the AngleMeasurementsControl when changed, which means that
2546
+ * it will destroy any AngleMeasurements currently under construction, and incurs some overhead, since it unbinds
2547
+ * and rebinds various input handlers.
2548
+ *
2549
+ * @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this AngleMeasurementsControl.
2550
+ */},{key:"snapping",get:/**
2551
+ * Gets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsControl.
2552
+ *
2553
+ * This is `true` by default.
2554
+ *
2555
+ * @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsControl.
2556
+ */function get(){return true;}/**
2557
+ * Activates this AngleMeasurementsMouseControl, ready to respond to input.
2558
+ *
2559
+ * @abstract
2560
+ */,set:function set(snapping){}},{key:"activate",value:function activate(){}/**
2561
+ * Deactivates this AngleMeasurementsControl, making it unresponsive to input.
2562
+ *
2563
+ * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsControl.
2564
+ *
2565
+ * @abstract
2566
+ */},{key:"deactivate",value:function deactivate(){}/**
2567
+ * Resets this AngleMeasurementsControl.
2568
+ *
2569
+ * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsControl.
2570
+ *
2571
+ * Does nothing if the AngleMeasurementsControl is not active.
2572
+ *
2573
+ * @abstract
2574
+ */},{key:"reset",value:function reset(){}/**
2575
+ * Destroys this AngleMeasurementsMouseControl.
2576
+ *
2577
+ * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsControl.
2578
+ *
2579
+ * @abstract
2580
+ */},{key:"destroy",value:function destroy(){}}]);}(Component);var MOUSE_FINDING_ORIGIN=0;var MOUSE_FINDING_CORNER=1;var MOUSE_FINDING_TARGET=2;/**
2581
2581
  * Creates {@link AngleMeasurement}s in an {@link AngleMeasurementsPlugin} from mouse input.
2582
2582
  *
2583
2583
  * ## Usage
@@ -2623,7 +2623,7 @@ s * @param {function} [cfg.canvasToPagePos] Optional function to map canvas-spa
2623
2623
  * @param {boolean} [cfg.snapping=true] Whether to initially enable snap-to-vertex and snap-to-edge for this AngleMeasurementsMouseControl.
2624
2624
  * @param {_offsetX} [cfg._offsetX] _offsetX of the mouse
2625
2625
  * @param {_offsetY} [cfg._offsetY] _offsetY of the mouse
2626
- * */function AngleMeasurementsMouseControl(angleMeasurementsPlugin){var _this11;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,AngleMeasurementsMouseControl);_this11=_callSuper(this,AngleMeasurementsMouseControl,[angleMeasurementsPlugin.viewer.scene]);_this11.cfg=cfg;_this11._canvasToPagePos=cfg.canvasToPagePos;_this11.pointerLens=cfg.pointerLens;_this11._active=false;_this11._mouseState=MOUSE_FINDING_ORIGIN;_this11._currentAngleMeasurement=null;// init markerDiv element (think about making its style configurable)
2626
+ * */function AngleMeasurementsMouseControl(angleMeasurementsPlugin){var _this11;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,AngleMeasurementsMouseControl);_this11=_callSuper(this,AngleMeasurementsMouseControl,[angleMeasurementsPlugin.viewer.scene]);_this11.cfg=cfg;_this11._canvasToPagePos=cfg.canvasToPagePos;_this11.pointerLens=cfg.pointerLens;_this11._active=false;_this11._activate=false;_this11._mouseState=MOUSE_FINDING_ORIGIN;_this11._currentAngleMeasurement=null;// init markerDiv element (think about making its style configurable)
2627
2627
  _this11._initMarkerDiv();_this11._onMouseHoverSurface=null;_this11._onHoverNothing=null;_this11._onPickedNothing=null;_this11._onPickedSurface=null;_this11._onInputMouseDown=null;_this11._onInputMouseUp=null;_this11._snapping=cfg.snapping!==false;_this11._attachPlugin(angleMeasurementsPlugin,cfg);_this11._offsetX=cfg._offsetX|0;_this11._offsetY=cfg._offsetY|0;return _this11;}_inherits(AngleMeasurementsMouseControl,_AngleMeasurementsCon);return _createClass(AngleMeasurementsMouseControl,[{key:"_initMarkerDiv",value:function _initMarkerDiv(){var markerDiv=document.createElement("div");markerDiv.setAttribute("id","myAnglePivotMarker");var canvas=this.scene.canvas.canvas;canvas.parentNode.insertBefore(markerDiv,canvas);markerDiv.style.background="black";markerDiv.style.border="2px solid blue";markerDiv.style.borderRadius="10px";markerDiv.style.width="5px";markerDiv.style.height="5px";markerDiv.style.margin="-200px -200px";markerDiv.style.zIndex="100";markerDiv.style.position="absolute";markerDiv.style.pointerEvents="none";this.markerDiv=markerDiv;}},{key:"_destroyMarkerDiv",value:function _destroyMarkerDiv(){if(this.markerDiv){this.markerDiv.parentNode.removeChild(this.markerDiv);this.markerDiv=null;}}},{key:"_attachPlugin",value:function _attachPlugin(angleMeasurementsPlugin){var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};/**
2628
2628
  * The {@link AngleMeasurementsPlugin} that owns this AngleMeasurementsMouseControl.
2629
2629
  *
@@ -2644,7 +2644,7 @@ _this11._initMarkerDiv();_this11._onMouseHoverSurface=null;_this11._onHoverNothi
2644
2644
  * Gets if this AngleMeasurementsMouseControl is currently active, where it is responding to input.
2645
2645
  *
2646
2646
  * @returns {boolean}
2647
- */,set:function set(offsetY){this._offsetY=offsetY;}},{key:"active",get:function get(){return this._active;}/**
2647
+ */,set:function set(offsetY){this._offsetY=offsetY;}},{key:"active",get:function get(){return this._active;},set:function set(active){this._active=active;}/**
2648
2648
  * Sets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
2649
2649
  *
2650
2650
  * This is `true` by default.
@@ -2662,8 +2662,8 @@ _this11._initMarkerDiv();_this11._onMouseHoverSurface=null;_this11._onHoverNothi
2662
2662
  * @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
2663
2663
  */function get(){return this._snapping;}/**
2664
2664
  * Activates this AngleMeasurementsMouseControl, ready to respond to input.
2665
- */,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 _this12=this;if(this._active){return;}if(!this.markerDiv){this._initMarkerDiv();// if the marker is destroyed after deactivation, we recreate it
2666
- }var angleMeasurementsPlugin=this.angleMeasurementsPlugin;var hover=false;angleMeasurementsPlugin.on("mouseOver",function(e){hover=true;});angleMeasurementsPlugin.on("mouseLeave",function(e){hover=false;});angleMeasurementsPlugin.on("measureDelete",function(e){hover=false;});var scene=this.scene;scene.input;var canvas=scene.canvas.canvas;var clickTolerance=20;var cameraControl=angleMeasurementsPlugin.viewer.cameraControl;var pointerLens=this.pointerLens;var mouseHovering=false;var hoveredEntity=null;var lastMouseCanvasX=0;var lastMouseCanvasY=0;var mouseWorldPos=math.vec3();var mouseHoverCanvasPos=math.vec2();this._currentAngleMeasurement=null;this._onMouseHoverSurface=cameraControl.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",function(event){if(hover)return;if(event.snappedToVertex||event.snappedToEdge){if(pointerLens){pointerLens.visible=true;pointerLens.canvasPos=event.canvasPos;pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;pointerLens.snapped=true;}_this12.markerDiv.style.background="greenyellow";_this12.markerDiv.style.border="2px solid green";}else{if(pointerLens){pointerLens.visible=true;pointerLens.canvasPos=event.canvasPos;pointerLens.snappedCanvasPos=event.canvasPos;pointerLens.snapped=false;}_this12.markerDiv.style.background="pink";_this12.markerDiv.style.border="2px solid red";}var canvasPos=event.snappedCanvasPos||event.canvasPos;mouseHovering=true;hoveredEntity=event.entity;mouseWorldPos.set(event.worldPos);mouseHoverCanvasPos.set(canvasPos);switch(_this12._mouseState){case MOUSE_FINDING_ORIGIN:canvas.getBoundingClientRect();var scrollLeft=window.pageXOffset||document.documentElement.scrollLeft;var scrollTop=window.pageYOffset||document.documentElement.scrollTop;var canvasLeftEdge=scrollLeft;var canvasTopEdge=scrollTop;_this12.markerDiv.style.marginLeft="".concat(_this12._offsetX+canvasLeftEdge+canvasPos[0]-5,"px");_this12.markerDiv.style.marginTop="".concat(_this12._offsetY+canvasTopEdge+canvasPos[1]-5,"px");break;case MOUSE_FINDING_CORNER:if(_this12._currentAngleMeasurement){_this12._currentAngleMeasurement.originWireVisible=true;_this12._currentAngleMeasurement.targetWireVisible=false;_this12._currentAngleMeasurement.cornerVisible=true;_this12._currentAngleMeasurement.angleVisible=false;_this12._currentAngleMeasurement.corner.worldPos=event.worldPos;_this12._currentAngleMeasurement.corner.entity=event.entity;}_this12.markerDiv.style.marginLeft="-10000px";_this12.markerDiv.style.marginTop="-10000px";canvas.style.cursor="pointer";break;case MOUSE_FINDING_TARGET:if(_this12._currentAngleMeasurement){_this12._currentAngleMeasurement.targetWireVisible=true;_this12._currentAngleMeasurement.targetVisible=true;_this12._currentAngleMeasurement.angleVisible=true;_this12._currentAngleMeasurement.target.worldPos=event.worldPos;_this12._currentAngleMeasurement.target.entity=event.entity;}_this12.markerDiv.style.marginLeft="-10000px";_this12.markerDiv.style.marginTop="-10000px";canvas.style.cursor="pointer";break;}});canvas.addEventListener("mousedown",this._onMouseDown=function(e){if(e.which!==1){return;}lastMouseCanvasX=e.clientX;lastMouseCanvasY=e.clientY;});canvas.addEventListener("mouseup",this._onMouseUp=function(e){if(hover)return;if(e.which!==1){return;}if(e.clientX>lastMouseCanvasX+clickTolerance||e.clientX<lastMouseCanvasX-clickTolerance||e.clientY>lastMouseCanvasY+clickTolerance||e.clientY<lastMouseCanvasY-clickTolerance){return;}switch(_this12._mouseState){case MOUSE_FINDING_ORIGIN:if(mouseHovering){_this12._currentAngleMeasurement=angleMeasurementsPlugin.createMeasurement({id:math.createUUID(),origin:{worldPos:mouseWorldPos},corner:{worldPos:mouseWorldPos},target:{worldPos:mouseWorldPos},precision:angleMeasurementsPlugin.precision,approximate:true});_this12._currentAngleMeasurement.clickable=false;_this12._currentAngleMeasurement.originVisible=true;_this12._currentAngleMeasurement.originWireVisible=true;_this12._currentAngleMeasurement.cornerVisible=false;_this12._currentAngleMeasurement.targetWireVisible=false;_this12._currentAngleMeasurement.targetVisible=false;_this12._currentAngleMeasurement.angleVisible=false;_this12._currentAngleMeasurement.origin.entity=hoveredEntity;_this12._mouseState=MOUSE_FINDING_CORNER;angleMeasurementsPlugin.fire("measurementStart",_this12._currentAngleMeasurement);}break;case MOUSE_FINDING_CORNER:if(mouseHovering){_this12._currentAngleMeasurement.targetWireVisible=false;_this12._currentAngleMeasurement.targetVisible=true;_this12._currentAngleMeasurement.angleVisible=true;_this12._currentAngleMeasurement.corner.entity=hoveredEntity;_this12._mouseState=MOUSE_FINDING_TARGET;}else{if(_this12._currentAngleMeasurement){_this12._currentAngleMeasurement.destroy();_this12._currentAngleMeasurement=null;hoveredEntity=null;_this12._mouseState=MOUSE_FINDING_ORIGIN;angleMeasurementsPlugin.fire("measurementCancel",_this12._currentAngleMeasurement);}}break;case MOUSE_FINDING_TARGET:if(mouseHovering){_this12._currentAngleMeasurement.targetVisible=true;_this12._currentAngleMeasurement.angleVisible=true;_this12._currentAngleMeasurement.target.entity=hoveredEntity;_this12._currentAngleMeasurement.clickable=true;hoveredEntity=null;angleMeasurementsPlugin.fire("measurementEnd",_this12._currentAngleMeasurement);_this12._currentAngleMeasurement=null;_this12._mouseState=MOUSE_FINDING_ORIGIN;}else{if(_this12._currentAngleMeasurement){_this12._currentAngleMeasurement.destroy();_this12._currentAngleMeasurement=null;hoveredEntity=null;_this12._mouseState=MOUSE_FINDING_ORIGIN;angleMeasurementsPlugin.fire("measurementCancel",_this12._currentAngleMeasurement);}}break;}});this._onMouseHoverOff=cameraControl.on(this._snapping?"hoverSnapOrSurfaceOff":"hoverOff",function(event){if(hover)return;mouseHovering=false;if(pointerLens){pointerLens.visible=true;pointerLens.pointerPos=event.canvasPos;pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;pointerLens.snapped=false;}_this12.markerDiv.style.marginLeft="-100px";_this12.markerDiv.style.marginTop="-100px";if(_this12._currentAngleMeasurement){switch(_this12._mouseState){case MOUSE_FINDING_ORIGIN:_this12._currentAngleMeasurement.originVisible=false;break;case MOUSE_FINDING_CORNER:_this12._currentAngleMeasurement.cornerVisible=false;_this12._currentAngleMeasurement.originWireVisible=false;_this12._currentAngleMeasurement.targetVisible=false;_this12._currentAngleMeasurement.targetWireVisible=false;_this12._currentAngleMeasurement.angleVisible=false;break;case MOUSE_FINDING_TARGET:_this12._currentAngleMeasurement.targetVisible=false;_this12._currentAngleMeasurement.targetWireVisible=false;_this12._currentAngleMeasurement.angleVisible=false;break;}canvas.style.cursor="default";}});this._active=true;}/**
2665
+ */,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 _this12=this;if(this._activate){return;}if(!this.markerDiv){this._initMarkerDiv();// if the marker is destroyed after deactivation, we recreate it
2666
+ }var angleMeasurementsPlugin=this.angleMeasurementsPlugin;var hover=false;angleMeasurementsPlugin.on("mouseOver",function(e){if(!_this12._active){return;}hover=true;});angleMeasurementsPlugin.on("mouseLeave",function(e){if(!_this12._active){return;}hover=false;});angleMeasurementsPlugin.on("measureDelete",function(e){if(!_this12._active){return;}hover=false;});var scene=this.scene;scene.input;var canvas=scene.canvas.canvas;var clickTolerance=20;var cameraControl=angleMeasurementsPlugin.viewer.cameraControl;var pointerLens=this.pointerLens;var mouseHovering=false;var hoveredEntity=null;var lastMouseCanvasX=0;var lastMouseCanvasY=0;var mouseWorldPos=math.vec3();var mouseHoverCanvasPos=math.vec2();this._currentAngleMeasurement=null;this._onMouseHoverSurface=cameraControl.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",function(event){if(!_this12._active){return;}if(hover)return;if(event.snappedToVertex||event.snappedToEdge){if(pointerLens){pointerLens.visible=true;pointerLens.canvasPos=event.canvasPos;pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;pointerLens.snapped=true;}_this12.markerDiv.style.background="greenyellow";_this12.markerDiv.style.border="2px solid green";}else{if(pointerLens){pointerLens.visible=true;pointerLens.canvasPos=event.canvasPos;pointerLens.snappedCanvasPos=event.canvasPos;pointerLens.snapped=false;}_this12.markerDiv.style.background="pink";_this12.markerDiv.style.border="2px solid red";}var canvasPos=event.snappedCanvasPos||event.canvasPos;mouseHovering=true;hoveredEntity=event.entity;mouseWorldPos.set(event.worldPos);mouseHoverCanvasPos.set(canvasPos);switch(_this12._mouseState){case MOUSE_FINDING_ORIGIN:canvas.getBoundingClientRect();var scrollLeft=window.pageXOffset||document.documentElement.scrollLeft;var scrollTop=window.pageYOffset||document.documentElement.scrollTop;var canvasLeftEdge=scrollLeft;var canvasTopEdge=scrollTop;_this12.markerDiv.style.marginLeft="".concat(_this12._offsetX+canvasLeftEdge+canvasPos[0]-5,"px");_this12.markerDiv.style.marginTop="".concat(_this12._offsetY+canvasTopEdge+canvasPos[1]-5,"px");break;case MOUSE_FINDING_CORNER:if(_this12._currentAngleMeasurement){_this12._currentAngleMeasurement.originWireVisible=true;_this12._currentAngleMeasurement.targetWireVisible=false;_this12._currentAngleMeasurement.cornerVisible=true;_this12._currentAngleMeasurement.angleVisible=false;_this12._currentAngleMeasurement.corner.worldPos=event.worldPos;_this12._currentAngleMeasurement.corner.entity=event.entity;}_this12.markerDiv.style.marginLeft="-10000px";_this12.markerDiv.style.marginTop="-10000px";canvas.style.cursor="pointer";break;case MOUSE_FINDING_TARGET:if(_this12._currentAngleMeasurement){_this12._currentAngleMeasurement.targetWireVisible=true;_this12._currentAngleMeasurement.targetVisible=true;_this12._currentAngleMeasurement.angleVisible=true;_this12._currentAngleMeasurement.target.worldPos=event.worldPos;_this12._currentAngleMeasurement.target.entity=event.entity;}_this12.markerDiv.style.marginLeft="-10000px";_this12.markerDiv.style.marginTop="-10000px";canvas.style.cursor="pointer";break;}});canvas.addEventListener("mousedown",this._onMouseDown=function(e){if(!_this12._active){return;}if(e.which!==1){return;}lastMouseCanvasX=e.clientX;lastMouseCanvasY=e.clientY;});canvas.addEventListener("mouseup",this._onMouseUp=function(e){if(!_this12._active){return;}if(hover)return;if(e.which!==1){return;}if(e.clientX>lastMouseCanvasX+clickTolerance||e.clientX<lastMouseCanvasX-clickTolerance||e.clientY>lastMouseCanvasY+clickTolerance||e.clientY<lastMouseCanvasY-clickTolerance){return;}switch(_this12._mouseState){case MOUSE_FINDING_ORIGIN:if(mouseHovering){_this12._currentAngleMeasurement=angleMeasurementsPlugin.createMeasurement({id:math.createUUID(),origin:{worldPos:mouseWorldPos},corner:{worldPos:mouseWorldPos},target:{worldPos:mouseWorldPos},precision:angleMeasurementsPlugin.precision,approximate:true});_this12._currentAngleMeasurement.clickable=false;_this12._currentAngleMeasurement.originVisible=true;_this12._currentAngleMeasurement.originWireVisible=true;_this12._currentAngleMeasurement.cornerVisible=false;_this12._currentAngleMeasurement.targetWireVisible=false;_this12._currentAngleMeasurement.targetVisible=false;_this12._currentAngleMeasurement.angleVisible=false;_this12._currentAngleMeasurement.origin.entity=hoveredEntity;_this12._mouseState=MOUSE_FINDING_CORNER;angleMeasurementsPlugin.fire("measurementStart",_this12._currentAngleMeasurement);}break;case MOUSE_FINDING_CORNER:if(mouseHovering){_this12._currentAngleMeasurement.targetWireVisible=false;_this12._currentAngleMeasurement.targetVisible=true;_this12._currentAngleMeasurement.angleVisible=true;_this12._currentAngleMeasurement.corner.entity=hoveredEntity;_this12._mouseState=MOUSE_FINDING_TARGET;}else{if(_this12._currentAngleMeasurement){_this12._currentAngleMeasurement.destroy();_this12._currentAngleMeasurement=null;hoveredEntity=null;_this12._mouseState=MOUSE_FINDING_ORIGIN;angleMeasurementsPlugin.fire("measurementCancel",_this12._currentAngleMeasurement);}}break;case MOUSE_FINDING_TARGET:if(mouseHovering){_this12._currentAngleMeasurement.targetVisible=true;_this12._currentAngleMeasurement.angleVisible=true;_this12._currentAngleMeasurement.target.entity=hoveredEntity;_this12._currentAngleMeasurement.clickable=true;hoveredEntity=null;angleMeasurementsPlugin.fire("measurementEnd",_this12._currentAngleMeasurement);_this12._currentAngleMeasurement=null;_this12._mouseState=MOUSE_FINDING_ORIGIN;}else{if(_this12._currentAngleMeasurement){_this12._currentAngleMeasurement.destroy();_this12._currentAngleMeasurement=null;hoveredEntity=null;_this12._mouseState=MOUSE_FINDING_ORIGIN;angleMeasurementsPlugin.fire("measurementCancel",_this12._currentAngleMeasurement);}}break;}});this._onMouseHoverOff=cameraControl.on(this._snapping?"hoverSnapOrSurfaceOff":"hoverOff",function(event){if(!_this12._active){return;}if(hover)return;mouseHovering=false;if(pointerLens){pointerLens.visible=true;pointerLens.pointerPos=event.canvasPos;pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;pointerLens.snapped=false;}_this12.markerDiv.style.marginLeft="-100px";_this12.markerDiv.style.marginTop="-100px";if(_this12._currentAngleMeasurement){switch(_this12._mouseState){case MOUSE_FINDING_ORIGIN:_this12._currentAngleMeasurement.originVisible=false;break;case MOUSE_FINDING_CORNER:_this12._currentAngleMeasurement.cornerVisible=false;_this12._currentAngleMeasurement.originWireVisible=false;_this12._currentAngleMeasurement.targetVisible=false;_this12._currentAngleMeasurement.targetWireVisible=false;_this12._currentAngleMeasurement.angleVisible=false;break;case MOUSE_FINDING_TARGET:_this12._currentAngleMeasurement.targetVisible=false;_this12._currentAngleMeasurement.targetWireVisible=false;_this12._currentAngleMeasurement.angleVisible=false;break;}canvas.style.cursor="default";}});this._activate=true;}/**
2667
2667
  * Deactivates this AngleMeasurementsMouseControl, making it unresponsive to input.
2668
2668
  *
2669
2669
  * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl.
@@ -2967,6 +2967,9 @@ _this11._initMarkerDiv();_this11._onMouseHoverSurface=null;_this11._onHoverNothi
2967
2967
  *
2968
2968
  * @param {Boolean} labelsShown Whether or not to show the labels.
2969
2969
  */},{key:"setLabelsShown",value:function setLabelsShown(labelsShown){for(var _i34=0,_Object$entries=Object.entries(this.measurements);_i34<_Object$entries.length;_i34++){var _Object$entries$_i=_slicedToArray(_Object$entries[_i34],2),key=_Object$entries$_i[0],measurement=_Object$entries$_i[1];measurement.labelShown=labelsShown;}}/**
2970
+ * 控制所有测量对象显示隐藏
2971
+ * @param {*} visible
2972
+ */},{key:"setMeasurementsShown",value:function setMeasurementsShown(visible){for(var key in this.measurements){this.measurements[key].visible=visible;}}/**
2970
2973
  * Destroys all {@link AngleMeasurement}s.
2971
2974
  */},{key:"clear",value:function clear(){var ids=Object.keys(this._measurements);for(var i=0,len=ids.length;i<len;i++){this.destroyMeasurement(ids[i]);}}/**
2972
2975
  * Destroys this AngleMeasurementsPlugin.
@@ -3011,7 +3014,7 @@ _this11._initMarkerDiv();_this11._onMouseHoverSurface=null;_this11._onHoverNothi
3011
3014
  * @param {boolean} [cfg.snapToVertex=true] Whether to initially enable snap-to-vertex and snap-to-edge for this AngleMeasurementsMouseControl.
3012
3015
  * @param {_offsetX} [cfg._offsetX] _offsetX of the mouse
3013
3016
  * @param {_offsetY} [cfg._offsetY] _offsetY of the mouse
3014
- */function AngleMeasurementsTouchControl(angleMeasurementsPlugin){var _this16;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,AngleMeasurementsTouchControl);_this16=_callSuper(this,AngleMeasurementsTouchControl,[angleMeasurementsPlugin.viewer.scene]);_this16.pointerLens=cfg.pointerLens;_this16.pointerCircle=new PointerCircle(angleMeasurementsPlugin.viewer,{id:"angleMeasure_Circle"});_this16._active=false;_this16._initMarkerDiv();_this16._currentAngleMeasurement=null;_this16._onCanvasTouchStart=null;_this16._onCanvasTouchEnd=null;_this16._longTouchTimeoutMs=300;_this16._snapping=cfg.snapping!==false;_this16._snapToEdge=cfg.snapping!==false;_this16._snapToVertex=cfg.snapping!==false;_this16._touchState=WAITING_FOR_ORIGIN_TOUCH_START$1;_this16._attachPlugin(angleMeasurementsPlugin,cfg);_this16._offsetX=cfg._offsetX|0;_this16._offsetY=cfg._offsetY|0;return _this16;}_inherits(AngleMeasurementsTouchControl,_AngleMeasurementsCon2);return _createClass(AngleMeasurementsTouchControl,[{key:"_initMarkerDiv",value:function _initMarkerDiv(){var markerDiv=document.createElement("div");markerDiv.setAttribute("id","myAngleMeasureTouchMarker");var canvas=this.scene.canvas.canvas;canvas.parentNode.insertBefore(markerDiv,canvas);markerDiv.style.background="black";markerDiv.style.border="2px solid blue";markerDiv.style.borderRadius="10px";markerDiv.style.width="5px";markerDiv.style.height="5px";markerDiv.style.margin="-200px -200px";markerDiv.style.zIndex="100";markerDiv.style.position="absolute";markerDiv.style.pointerEvents="none";this.markerDiv=markerDiv;}},{key:"_destroyMarkerDiv",value:function _destroyMarkerDiv(){if(this.markerDiv){this.markerDiv.parentNode.removeChild(this.markerDiv);this.markerDiv=null;}}},{key:"_attachPlugin",value:function _attachPlugin(angleMeasurementsPlugin){/**
3017
+ */function AngleMeasurementsTouchControl(angleMeasurementsPlugin){var _this16;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,AngleMeasurementsTouchControl);_this16=_callSuper(this,AngleMeasurementsTouchControl,[angleMeasurementsPlugin.viewer.scene]);_this16.pointerLens=cfg.pointerLens;_this16.pointerCircle=new PointerCircle(angleMeasurementsPlugin.viewer,{id:"angleMeasure_Circle"});_this16._active=false;_this16._activate=false;_this16._initMarkerDiv();_this16._currentAngleMeasurement=null;_this16._onCanvasTouchStart=null;_this16._onCanvasTouchEnd=null;_this16._longTouchTimeoutMs=300;_this16._snapping=cfg.snapping!==false;_this16._snapToEdge=cfg.snapping!==false;_this16._snapToVertex=cfg.snapping!==false;_this16._touchState=WAITING_FOR_ORIGIN_TOUCH_START$1;_this16._attachPlugin(angleMeasurementsPlugin,cfg);_this16._offsetX=cfg._offsetX|0;_this16._offsetY=cfg._offsetY|0;return _this16;}_inherits(AngleMeasurementsTouchControl,_AngleMeasurementsCon2);return _createClass(AngleMeasurementsTouchControl,[{key:"_initMarkerDiv",value:function _initMarkerDiv(){var markerDiv=document.createElement("div");markerDiv.setAttribute("id","myAngleMeasureTouchMarker");var canvas=this.scene.canvas.canvas;canvas.parentNode.insertBefore(markerDiv,canvas);markerDiv.style.background="black";markerDiv.style.border="2px solid blue";markerDiv.style.borderRadius="10px";markerDiv.style.width="5px";markerDiv.style.height="5px";markerDiv.style.margin="-200px -200px";markerDiv.style.zIndex="100";markerDiv.style.position="absolute";markerDiv.style.pointerEvents="none";this.markerDiv=markerDiv;}},{key:"_destroyMarkerDiv",value:function _destroyMarkerDiv(){if(this.markerDiv){this.markerDiv.parentNode.removeChild(this.markerDiv);this.markerDiv=null;}}},{key:"_attachPlugin",value:function _attachPlugin(angleMeasurementsPlugin){/**
3015
3018
  * The {@link AngleMeasurementsPlugin} that owns this AngleMeasurementsTouchControl.
3016
3019
  * @type {AngleMeasurementsPlugin}
3017
3020
  */this.angleMeasurementsPlugin=angleMeasurementsPlugin;/**
@@ -3028,7 +3031,7 @@ _this11._initMarkerDiv();_this11._onMouseHoverSurface=null;_this11._onHoverNothi
3028
3031
  */function get(){return this._offsetY;}/** Gets if this AngleMeasurementsTouchControl is currently active, where it is responding to input.
3029
3032
  *
3030
3033
  * @returns {Boolean}
3031
- */,set:function set(offsetY){this._offsetY=offsetY;}},{key:"active",get:function get(){return this._active;}/**
3034
+ */,set:function set(offsetY){this._offsetY=offsetY;}},{key:"active",get:function get(){return this._active;},set:function set(active){this._active=active;}/**
3032
3035
  * Sets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
3033
3036
  *
3034
3037
  * This is `true` by default.
@@ -3046,7 +3049,7 @@ _this11._initMarkerDiv();_this11._onMouseHoverSurface=null;_this11._onHoverNothi
3046
3049
  * @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
3047
3050
  */function get(){return this._snapping;}/**
3048
3051
  * Activates this AngleMeasurementsTouchControl, ready to respond to input.
3049
- */,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 _this17=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(){_this17.plugin.viewer.cameraControl.active=false;};var enableCameraNavigation=function enableCameraNavigation(){_this17.plugin.viewer.cameraControl.active=true;};var cancel=function cancel(){if(longTouchTimeout){clearTimeout(longTouchTimeout);longTouchTimeout=null;}if(_this17._currentAngleMeasurement){_this17._currentAngleMeasurement.destroy();_this17._currentAngleMeasurement=null;}enableCameraNavigation();_this17._touchState=WAITING_FOR_ORIGIN_TOUCH_START$1;};canvas.addEventListener("touchstart",this._onCanvasTouchStart=function(event){if(!event.isTrusted)return;var currentNumTouches=event.touches.length;//多指触碰
3052
+ */,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 _this17=this;if(this._activate){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(){_this17.plugin.viewer.cameraControl.active=false;};var enableCameraNavigation=function enableCameraNavigation(){_this17.plugin.viewer.cameraControl.active=true;};var cancel=function cancel(){if(longTouchTimeout){clearTimeout(longTouchTimeout);longTouchTimeout=null;}if(_this17._currentAngleMeasurement){_this17._currentAngleMeasurement.destroy();_this17._currentAngleMeasurement=null;}enableCameraNavigation();_this17._touchState=WAITING_FOR_ORIGIN_TOUCH_START$1;};canvas.addEventListener("touchstart",this._onCanvasTouchStart=function(event){if(!_this17._active){return;}if(!event.isTrusted)return;var currentNumTouches=event.touches.length;//多指触碰
3050
3053
  if(currentNumTouches!==1){if(longTouchTimeout){clearTimeout(longTouchTimeout);longTouchTimeout=null;}return;}//touch--0
3051
3054
  var touch=event.touches[0];var touchX=touch.clientX;var touchY=touch.clientY;touchStartCanvasPos.set([touchX+_this17.offsetX,touchY+_this17.offsetY]);touchMoveCanvasPos.set([touchX+_this17.offsetX,touchY+_this17.offsetY]);switch(_this17._touchState){case WAITING_FOR_ORIGIN_TOUCH_START$1:if(currentNumTouches!==1&&longTouchTimeout!==null){// Two or more fingers down
3052
3055
  cancel();return;}var snapPickResult=scene.pick({canvasPos:touchMoveCanvasPos,snapToVertex:_this17._snapping,snapToEdge:_this17._snapping});if(snapPickResult&&snapPickResult.snapped){pointerWorldPos.set(snapPickResult.worldPos);_this17.pointerCircle.start(snapPickResult.snappedCanvasPos);}else{var pickResult=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(pickResult&&pickResult.worldPos){pointerWorldPos.set(pickResult.worldPos);_this17.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
@@ -3071,12 +3074,12 @@ return;}// Long touch
3071
3074
  if(_this17.pointerLens){_this17.pointerLens.visible=true;_this17.pointerLens.canvasPos=touchStartCanvasPos;_this17.pointerLens.snapped=false;}var snapPickResult=scene.pick({canvasPos:touchMoveCanvasPos,snapToVertex:_this17._snapping,snapToEdge:_this17._snapping});if(snapPickResult&&snapPickResult.snapped){if(_this17.pointerLens){_this17.pointerLens.cursorPos=snapPickResult.snappedCanvasPos;_this17.pointerLens.snapped=true;}_this17.pointerCircle.start(snapPickResult.snappedCanvasPos);pointerWorldPos.set(snapPickResult.worldPos);_this17._currentAngleMeasurement.target.worldPos=snapPickResult.worldPos;_this17._currentAngleMeasurement.target.entity=snapPickResult.entity;_this17._currentAngleMeasurement.originVisible=true;_this17._currentAngleMeasurement.originWireVisible=true;_this17._currentAngleMeasurement.cornerVisible=true;_this17._currentAngleMeasurement.cornerWireVisible=true;_this17._currentAngleMeasurement.targetVisible=true;_this17._currentAngleMeasurement.targetWireVisible=true;_this17._currentAngleMeasurement.angleVisible=true;_this17.angleMeasurementsPlugin.fire("measurementStart",_this17._currentAngleMeasurement);}else{var _pickResult3=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(_pickResult3&&_pickResult3.worldPos){if(_this17.pointerLens){_this17.pointerLens.cursorPos=_pickResult3.canvasPos;_this17.pointerLens.snapped=false;}_this17.pointerCircle.start(_pickResult3.canvasPos);pointerWorldPos.set(_pickResult3.worldPos);_this17._currentAngleMeasurement.target.worldPos=_pickResult3.worldPos;_this17._currentAngleMeasurement.target.entity=_pickResult3.entity;_this17._currentAngleMeasurement.originVisible=true;_this17._currentAngleMeasurement.originWireVisible=true;_this17._currentAngleMeasurement.cornerVisible=true;_this17._currentAngleMeasurement.cornerWireVisible=true;_this17._currentAngleMeasurement.targetVisible=true;_this17._currentAngleMeasurement.targetWireVisible=true;_this17._currentAngleMeasurement.angleVisible=true;plugin.fire("measurementStart",_this17._currentAngleMeasurement);}else{if(_this17.pointerLens){_this17.pointerLens.cursorPos=null;_this17.pointerLens.snapped=false;}}}_this17._touchState=WAITING_FOR_TARGET_LONG_TOUCH_END$1;// console.log("touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_LONG_TOUCH_END")
3072
3075
  disableCameraNavigation();},_this17._longTouchTimeoutMs);_this17._touchState=WAITING_FOR_TARGET_QUICK_TOUCH_END$1;// console.log("touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_QUICK_TOUCH_END")
3073
3076
  }touchId=touch.identifier;break;default:if(longTouchTimeout!==null){clearTimeout(longTouchTimeout);longTouchTimeout=null;}_this17._touchState=TOUCH_CANCELING$1;// console.log("touchstart: this._touchState= default -> TOUCH_CANCELING")
3074
- return;}},{passive:true});canvas.addEventListener("touchmove",function(event){_this17.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+_this17.offsetX,touchY+_this17.offsetY]);var snapPickResult;var pickResult;switch(_this17._touchState){case WAITING_FOR_ORIGIN_LONG_TOUCH_END$1:if(_this17.pointerLens){_this17.pointerLens.canvasPos=touchMoveCanvasPos;}snapPickResult=scene.pick({canvasPos:touchMoveCanvasPos,snapToVertex:_this17._snapping,snapToEdge:_this17._snapping});if(snapPickResult&&snapPickResult.snapped){if(_this17.pointerLens){_this17.pointerLens.snappedCanvasPos=snapPickResult.snappedCanvasPos;_this17.pointerLens.snapped=true;}pointerWorldPos.set(snapPickResult.worldPos);_this17._currentAngleMeasurement.origin.worldPos=snapPickResult.worldPos;}else{pickResult=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(pickResult&&pickResult.worldPos){if(_this17.pointerLens){_this17.pointerLens.cursorPos=pickResult.canvasPos;_this17.pointerLens.snapped=false;}pointerWorldPos.set(pickResult.worldPos);_this17._currentAngleMeasurement.origin.worldPos=pickResult.worldPos;}else{if(_this17.pointerLens){_this17.pointerLens.cursorPos=null;_this17.pointerLens.snapped=false;}}}_this17._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")
3077
+ return;}},{passive:true});canvas.addEventListener("touchmove",function(event){if(!_this17._active){return;}_this17.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+_this17.offsetX,touchY+_this17.offsetY]);var snapPickResult;var pickResult;switch(_this17._touchState){case WAITING_FOR_ORIGIN_LONG_TOUCH_END$1:if(_this17.pointerLens){_this17.pointerLens.canvasPos=touchMoveCanvasPos;}snapPickResult=scene.pick({canvasPos:touchMoveCanvasPos,snapToVertex:_this17._snapping,snapToEdge:_this17._snapping});if(snapPickResult&&snapPickResult.snapped){if(_this17.pointerLens){_this17.pointerLens.snappedCanvasPos=snapPickResult.snappedCanvasPos;_this17.pointerLens.snapped=true;}pointerWorldPos.set(snapPickResult.worldPos);_this17._currentAngleMeasurement.origin.worldPos=snapPickResult.worldPos;}else{pickResult=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(pickResult&&pickResult.worldPos){if(_this17.pointerLens){_this17.pointerLens.cursorPos=pickResult.canvasPos;_this17.pointerLens.snapped=false;}pointerWorldPos.set(pickResult.worldPos);_this17._currentAngleMeasurement.origin.worldPos=pickResult.worldPos;}else{if(_this17.pointerLens){_this17.pointerLens.cursorPos=null;_this17.pointerLens.snapped=false;}}}_this17._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")
3075
3078
  break;case WAITING_FOR_CORNER_LONG_TOUCH_END:if(currentNumTouches!==1&&longTouchTimeout!==null){// Two or more fingers down
3076
3079
  clearTimeout(longTouchTimeout);longTouchTimeout=null;if(_this17.pointerLens){_this17.pointerLens.visible=false;}_this17._touchState=TOUCH_CANCELING$1;// console.log("touchmove: this._touchState= QUICK_TOUCH_FINDING_CORNER -> TOUCH_CANCELING")
3077
3080
  return;}if(_this17.pointerLens){_this17.pointerLens.canvasPos=touchMoveCanvasPos;}snapPickResult=scene.pick({canvasPos:touchMoveCanvasPos,snapToVertex:_this17._snapping,snapToEdge:_this17._snapping});if(snapPickResult&&snapPickResult.worldPos){if(_this17.pointerLens){_this17.pointerLens.cursorPos=snapPickResult.snappedCanvasPos;_this17.pointerLens.snapped=true;}_this17._currentAngleMeasurement.corner.worldPos=snapPickResult.worldPos;_this17._currentAngleMeasurement.originVisible=true;_this17._currentAngleMeasurement.originWireVisible=true;_this17._currentAngleMeasurement.cornerVisible=true;_this17._currentAngleMeasurement.cornerWireVisible=false;_this17._currentAngleMeasurement.targetVisible=false;_this17._currentAngleMeasurement.targetWireVisible=false;_this17._currentAngleMeasurement.angleVisible=false;}else{pickResult=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(pickResult&&pickResult.worldPos){if(_this17.pointerLens){_this17.pointerLens.cursorPos=pickResult.canvasPos;_this17.pointerLens.snapped=false;}_this17._currentAngleMeasurement.corner.worldPos=pickResult.worldPos;_this17._currentAngleMeasurement.originVisible=true;_this17._currentAngleMeasurement.originWireVisible=true;_this17._currentAngleMeasurement.cornerVisible=true;_this17._currentAngleMeasurement.cornerWireVisible=false;_this17._currentAngleMeasurement.targetVisible=false;_this17._currentAngleMeasurement.targetWireVisible=false;_this17._currentAngleMeasurement.angleVisible=false;}}_this17._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
3078
3081
  clearTimeout(longTouchTimeout);longTouchTimeout=null;if(_this17.pointerLens){_this17.pointerLens.visible=false;}_this17._touchState=TOUCH_CANCELING$1;// console.log("touchmove: this._touchState= QUICK_TOUCH_FINDING_TARGET -> TOUCH_CANCELING")
3079
- return;}if(_this17.pointerLens){_this17.pointerLens.canvasPos=touchMoveCanvasPos;}snapPickResult=scene.pick({canvasPos:touchMoveCanvasPos,snapToVertex:_this17._snapping,snapToEdge:_this17._snapping});if(snapPickResult&&snapPickResult.worldPos){if(_this17.pointerLens){_this17.pointerLens.cursorPos=snapPickResult.snappedCanvasPos;_this17.pointerLens.snapped=true;}_this17._currentAngleMeasurement.target.worldPos=snapPickResult.worldPos;_this17._currentAngleMeasurement.originVisible=true;_this17._currentAngleMeasurement.originWireVisible=true;_this17._currentAngleMeasurement.cornerVisible=true;_this17._currentAngleMeasurement.cornerWireVisible=true;_this17._currentAngleMeasurement.targetVisible=true;_this17._currentAngleMeasurement.targetWireVisible=true;_this17._currentAngleMeasurement.angleVisible=true;}else{pickResult=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(pickResult&&pickResult.worldPos){if(_this17.pointerLens){_this17.pointerLens.cursorPos=pickResult.canvasPos;_this17.pointerLens.snapped=false;}_this17._currentAngleMeasurement.target.worldPos=pickResult.worldPos;_this17._currentAngleMeasurement.originVisible=true;_this17._currentAngleMeasurement.originWireVisible=true;_this17._currentAngleMeasurement.cornerVisible=true;_this17._currentAngleMeasurement.cornerWireVisible=true;_this17._currentAngleMeasurement.targetVisible=true;_this17._currentAngleMeasurement.targetWireVisible=true;_this17._currentAngleMeasurement.angleVisible=true;}}_this17._touchState=WAITING_FOR_TARGET_LONG_TOUCH_END$1;break;}},{passive:true});canvas.addEventListener("touchend",this._onCanvasTouchEnd=function(event){_this17.pointerCircle.stop();var numChangedTouches=event.changedTouches.length;if(numChangedTouches!==1){return;}var touch=event.changedTouches[0];var touchX=touch.clientX;var touchY=touch.clientY;if(touch.identifier!==touchId){return;}if(longTouchTimeout){clearTimeout(longTouchTimeout);longTouchTimeout=null;}touchEndCanvasPos.set([touchX,touchY]);switch(_this17._touchState){//起点短按
3082
+ return;}if(_this17.pointerLens){_this17.pointerLens.canvasPos=touchMoveCanvasPos;}snapPickResult=scene.pick({canvasPos:touchMoveCanvasPos,snapToVertex:_this17._snapping,snapToEdge:_this17._snapping});if(snapPickResult&&snapPickResult.worldPos){if(_this17.pointerLens){_this17.pointerLens.cursorPos=snapPickResult.snappedCanvasPos;_this17.pointerLens.snapped=true;}_this17._currentAngleMeasurement.target.worldPos=snapPickResult.worldPos;_this17._currentAngleMeasurement.originVisible=true;_this17._currentAngleMeasurement.originWireVisible=true;_this17._currentAngleMeasurement.cornerVisible=true;_this17._currentAngleMeasurement.cornerWireVisible=true;_this17._currentAngleMeasurement.targetVisible=true;_this17._currentAngleMeasurement.targetWireVisible=true;_this17._currentAngleMeasurement.angleVisible=true;}else{pickResult=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(pickResult&&pickResult.worldPos){if(_this17.pointerLens){_this17.pointerLens.cursorPos=pickResult.canvasPos;_this17.pointerLens.snapped=false;}_this17._currentAngleMeasurement.target.worldPos=pickResult.worldPos;_this17._currentAngleMeasurement.originVisible=true;_this17._currentAngleMeasurement.originWireVisible=true;_this17._currentAngleMeasurement.cornerVisible=true;_this17._currentAngleMeasurement.cornerWireVisible=true;_this17._currentAngleMeasurement.targetVisible=true;_this17._currentAngleMeasurement.targetWireVisible=true;_this17._currentAngleMeasurement.angleVisible=true;}}_this17._touchState=WAITING_FOR_TARGET_LONG_TOUCH_END$1;break;}},{passive:true});canvas.addEventListener("touchend",this._onCanvasTouchEnd=function(event){if(!_this17._active){return;}_this17.pointerCircle.stop();var numChangedTouches=event.changedTouches.length;if(numChangedTouches!==1){return;}var touch=event.changedTouches[0];var touchX=touch.clientX;var touchY=touch.clientY;if(touch.identifier!==touchId){return;}if(longTouchTimeout){clearTimeout(longTouchTimeout);longTouchTimeout=null;}touchEndCanvasPos.set([touchX,touchY]);switch(_this17._touchState){//起点短按
3080
3083
  case WAITING_FOR_ORIGIN_QUICK_TOUCH_END$1:{if(numChangedTouches!==1||touchX>touchStartCanvasPos[0]+touchTolerance||touchX<touchStartCanvasPos[0]-touchTolerance||touchY>touchStartCanvasPos[1]+touchTolerance||touchY<touchStartCanvasPos[1]-touchTolerance){_this17._touchState=WAITING_FOR_ORIGIN_TOUCH_START$1;return;}var pickResult=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(pickResult&&pickResult.worldPos){_this17._currentAngleMeasurement=plugin.createMeasurement({id:math.createUUID(),origin:{worldPos:pickResult.worldPos},corner:{worldPos:pickResult.worldPos},target:{worldPos:pickResult.worldPos},precision:plugin.precision});// this._currentAngleMeasurement.clickable = false;
3081
3084
  _this17._currentAngleMeasurement.originVisible=true;_this17._currentAngleMeasurement.originWireVisible=false;_this17._currentAngleMeasurement.cornerVisible=false;_this17._currentAngleMeasurement.cornerWireVisible=false;_this17._currentAngleMeasurement.targetVisible=false;_this17._currentAngleMeasurement.targetWireVisible=false;_this17._currentAngleMeasurement.angleVisible=false;_this17._touchState=WAITING_FOR_CORNER_TOUCH_START;// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_CORNER_TOUCH_START")
3082
3085
  }else{if(_this17._currentAngleMeasurement){_this17._currentAngleMeasurement.destroy();_this17._currentAngleMeasurement=null;}_this17._touchState=WAITING_FOR_ORIGIN_TOUCH_START$1;// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
@@ -3093,7 +3096,7 @@ case WAITING_FOR_TARGET_QUICK_TOUCH_END$1:{if(numChangedTouches!==1||touchX>touc
3093
3096
  }enableCameraNavigation();break;//终点长按
3094
3097
  case WAITING_FOR_TARGET_LONG_TOUCH_END$1:if(_this17.pointerLens){_this17.pointerLens.visible=false;}if(!_this17._currentAngleMeasurement||!_this17._currentAngleMeasurement.targetVisible){if(_this17._currentAngleMeasurement){_this17._currentAngleMeasurement.destroy();_this17._currentAngleMeasurement=null;}_this17._touchState=WAITING_FOR_ORIGIN_TOUCH_START$1;// console.log("touchend: this._touchState= WAITING_FOR_TARGET_LONG_TOUCH_END (no target found) -> WAITING_FOR_ORIGIN_TOUCH_START")
3095
3098
  }else{_this17._currentAngleMeasurement.clickable=true;_this17.angleMeasurementsPlugin.fire("measurementEnd",_this17._currentAngleMeasurement);_this17._currentAngleMeasurement=null;_this17._touchState=WAITING_FOR_ORIGIN_TOUCH_START$1;// console.log("touchend: this._touchState= WAITING_FOR_TARGET_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
3096
- }enableCameraNavigation();break;}},{passive:true});canvas.addEventListener("touchcancel",this._onCanvasTouchEnd);this._active=true;}/**
3099
+ }enableCameraNavigation();break;}},{passive:true});canvas.addEventListener("touchcancel",this._onCanvasTouchEnd);this._activate=true;}/**
3097
3100
  * Deactivates this AngleMeasurementsTouchControl, making it unresponsive to input.
3098
3101
  *
3099
3102
  * Destroys any {@link AngleMeasurement} under construction.
@@ -3818,51 +3821,51 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.s
3818
3821
  * @interface
3819
3822
  * @abstract
3820
3823
  */var DistanceMeasurementsControl=/*#__PURE__*/function(_Component5){function DistanceMeasurementsControl(){_classCallCheck(this,DistanceMeasurementsControl);return _callSuper(this,DistanceMeasurementsControl,arguments);}_inherits(DistanceMeasurementsControl,_Component5);return _createClass(DistanceMeasurementsControl,[{key:"active",get:/**
3821
- * Gets if this DistanceMeasurementsControl is currently active, where it is responding to input.
3822
- *
3823
- * @returns {boolean} True if this DistanceMeasurementsControl is active.
3824
- * @abstract
3825
- */function get(){}/**
3826
- * Sets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsControl.
3827
- *
3828
- * This is `true` by default.
3829
- *
3830
- * Internally, this deactivates then activates the DistanceMeasurementsControl when changed, which means that
3831
- * it will destroy any DistanceMeasurements currently under construction, and incurs some overhead, since it unbinds
3832
- * and rebinds various input handlers.
3833
- *
3834
- * @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this DistanceMeasurementsControl.
3835
- */},{key:"snapping",get:/**
3836
- * Gets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsControl.
3837
- *
3838
- * This is `true` by default.
3839
- *
3840
- * @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsControl.
3841
- */function get(){return true;}/**
3842
- * Activates this DistanceMeasurementsControl, ready to respond to input.
3843
- *
3844
- * @abstract
3845
- */,set:function set(snapping){}},{key:"activate",value:function activate(){}/**
3846
- * Deactivates this DistanceMeasurementsControl, making it unresponsive to input.
3847
- *
3848
- * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl.
3849
- *
3850
- * @abstract
3851
- */},{key:"deactivate",value:function deactivate(){}/**
3852
- * Resets this DistanceMeasurementsControl.
3853
- *
3854
- * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl.
3855
- *
3856
- * Does nothing if the DistanceMeasurementsControl is not active.
3857
- *
3858
- * @abstract
3859
- */},{key:"reset",value:function reset(){}/**
3860
- * Destroys this DistanceMeasurementsControl.
3861
- *
3862
- * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl.
3863
- *
3864
- * @abstract
3865
- */},{key:"destroy",value:function destroy(){}}]);}(Component);var MOUSE_FIRST_CLICK_EXPECTED=0;/**
3824
+ * Gets if this DistanceMeasurementsControl is currently active, where it is responding to input.
3825
+ *
3826
+ * @returns {boolean} True if this DistanceMeasurementsControl is active.
3827
+ * @abstract
3828
+ */function get(){},set:function set(active){}/**
3829
+ * Sets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsControl.
3830
+ *
3831
+ * This is `true` by default.
3832
+ *
3833
+ * Internally, this deactivates then activates the DistanceMeasurementsControl when changed, which means that
3834
+ * it will destroy any DistanceMeasurements currently under construction, and incurs some overhead, since it unbinds
3835
+ * and rebinds various input handlers.
3836
+ *
3837
+ * @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this DistanceMeasurementsControl.
3838
+ */},{key:"snapping",get:/**
3839
+ * Gets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsControl.
3840
+ *
3841
+ * This is `true` by default.
3842
+ *
3843
+ * @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsControl.
3844
+ */function get(){return true;}/**
3845
+ * Activates this DistanceMeasurementsControl, ready to respond to input.
3846
+ *
3847
+ * @abstract
3848
+ */,set:function set(snapping){}},{key:"activate",value:function activate(){}/**
3849
+ * Deactivates this DistanceMeasurementsControl, making it unresponsive to input.
3850
+ *
3851
+ * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl.
3852
+ *
3853
+ * @abstract
3854
+ */},{key:"deactivate",value:function deactivate(){}/**
3855
+ * Resets this DistanceMeasurementsControl.
3856
+ *
3857
+ * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl.
3858
+ *
3859
+ * Does nothing if the DistanceMeasurementsControl is not active.
3860
+ *
3861
+ * @abstract
3862
+ */},{key:"reset",value:function reset(){}/**
3863
+ * Destroys this DistanceMeasurementsControl.
3864
+ *
3865
+ * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsControl.
3866
+ *
3867
+ * @abstract
3868
+ */},{key:"destroy",value:function destroy(){}}]);}(Component);var MOUSE_FIRST_CLICK_EXPECTED=0;/**
3866
3869
  * Creates {@link DistanceMeasurement}s in a {@link DistanceMeasurementsPlugin} from mouse input.
3867
3870
  *
3868
3871
  * ## Usage
@@ -3907,7 +3910,7 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.s
3907
3910
  * @param {boolean} [cfg.snapping=true] Whether to initially enable snap-to-vertex and snap-to-edge for this DistanceMeasurementsMouseControl.
3908
3911
  * @param {_offsetX} [cfg._offsetX] _offsetX of the mouse
3909
3912
  * @param {_offsetY} [cfg._offsetY] _offsetY of the mouse
3910
- */function DistanceMeasurementsMouseControl(distanceMeasurementsPlugin){var _this23;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,DistanceMeasurementsMouseControl);_this23=_callSuper(this,DistanceMeasurementsMouseControl,[distanceMeasurementsPlugin.viewer.scene]);_this23.cfg=cfg;_this23.pointerLens=cfg.pointerLens;_this23._active=false;_this23._currentDistanceMeasurement=null;_this23._currentDistanceMeasurementInitState={wireVisible:null,axisVisible:null,xAxisVisible:null,yaxisVisible:null,zAxisVisible:null,targetVisible:null};_this23._initMarkerDiv();_this23._onCameraControlHoverSnapOrSurface=null;_this23._onCameraControlHoverSnapOrSurfaceOff=null;_this23._onMouseDown=null;_this23._onMouseUp=null;_this23._onCanvasTouchStart=null;_this23._onCanvasTouchEnd=null;_this23._snapping=cfg.snapping!==false;_this23._mouseState=MOUSE_FIRST_CLICK_EXPECTED;_this23._attachPlugin(distanceMeasurementsPlugin,cfg);_this23._offsetX=cfg._offsetX|0;_this23._offsetY=cfg._offsetY|0;return _this23;}_inherits(DistanceMeasurementsMouseControl,_DistanceMeasurements);return _createClass(DistanceMeasurementsMouseControl,[{key:"_initMarkerDiv",value:function _initMarkerDiv(){var markerDiv=document.createElement("div");markerDiv.setAttribute("id","myDistancePivotMarker");var canvas=this.scene.canvas.canvas;canvas.parentNode.insertBefore(markerDiv,canvas);markerDiv.style.background="black";markerDiv.style.border="2px solid blue";markerDiv.style.borderRadius="10px";markerDiv.style.width="5px";markerDiv.style.height="5px";markerDiv.style.margin="-200px -200px";markerDiv.style.zIndex="100";markerDiv.style.position="absolute";markerDiv.style.pointerEvents="none";this._markerDiv=markerDiv;}},{key:"_destroyMarkerDiv",value:function _destroyMarkerDiv(){if(this._markerDiv){this._markerDiv.parentNode.removeChild(this._markerDiv);this._markerDiv=null;}}},{key:"_attachPlugin",value:function _attachPlugin(distanceMeasurementsPlugin){var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};/**
3913
+ */function DistanceMeasurementsMouseControl(distanceMeasurementsPlugin){var _this23;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,DistanceMeasurementsMouseControl);_this23=_callSuper(this,DistanceMeasurementsMouseControl,[distanceMeasurementsPlugin.viewer.scene]);_this23.cfg=cfg;_this23.pointerLens=cfg.pointerLens;_this23._active=false;_this23._activate=false;_this23._currentDistanceMeasurement=null;_this23._currentDistanceMeasurementInitState={wireVisible:null,axisVisible:null,xAxisVisible:null,yaxisVisible:null,zAxisVisible:null,targetVisible:null};_this23._initMarkerDiv();_this23._onCameraControlHoverSnapOrSurface=null;_this23._onCameraControlHoverSnapOrSurfaceOff=null;_this23._onMouseDown=null;_this23._onMouseUp=null;_this23._onCanvasTouchStart=null;_this23._onCanvasTouchEnd=null;_this23._snapping=cfg.snapping!==false;_this23._mouseState=MOUSE_FIRST_CLICK_EXPECTED;_this23._attachPlugin(distanceMeasurementsPlugin,cfg);_this23._offsetX=cfg._offsetX|0;_this23._offsetY=cfg._offsetY|0;return _this23;}_inherits(DistanceMeasurementsMouseControl,_DistanceMeasurements);return _createClass(DistanceMeasurementsMouseControl,[{key:"_initMarkerDiv",value:function _initMarkerDiv(){var markerDiv=document.createElement("div");markerDiv.setAttribute("id","myDistancePivotMarker");var canvas=this.scene.canvas.canvas;canvas.parentNode.insertBefore(markerDiv,canvas);markerDiv.style.background="black";markerDiv.style.border="2px solid blue";markerDiv.style.borderRadius="10px";markerDiv.style.width="5px";markerDiv.style.height="5px";markerDiv.style.margin="-200px -200px";markerDiv.style.zIndex="100";markerDiv.style.position="absolute";markerDiv.style.pointerEvents="none";this._markerDiv=markerDiv;}},{key:"_destroyMarkerDiv",value:function _destroyMarkerDiv(){if(this._markerDiv){this._markerDiv.parentNode.removeChild(this._markerDiv);this._markerDiv=null;}}},{key:"_attachPlugin",value:function _attachPlugin(distanceMeasurementsPlugin){var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};/**
3911
3914
  * The {@link DistanceMeasurementsPlugin} that owns this DistanceMeasurementsMouseControl.
3912
3915
  * @type {DistanceMeasurementsPlugin}
3913
3916
  */this.distanceMeasurementsPlugin=distanceMeasurementsPlugin;/**
@@ -3925,7 +3928,7 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.s
3925
3928
  * Gets if this DistanceMeasurementsMouseControl is currently active, where it is responding to input.
3926
3929
  *
3927
3930
  * @returns {boolean} True if this DistanceMeasurementsMouseControl is active.
3928
- */,set:function set(offsetY){this._offsetY=offsetY;}},{key:"active",get:function get(){return this._active;}/**
3931
+ */,set:function set(offsetY){this._offsetY=offsetY;}},{key:"active",get:function get(){return this._active;},set:function set(active){this._active=active;}/**
3929
3932
  * Sets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
3930
3933
  *
3931
3934
  * This is `true` by default.
@@ -3943,7 +3946,7 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.s
3943
3946
  * @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
3944
3947
  */function get(){return this._snapping;}/**
3945
3948
  * Activates this DistanceMeasurementsMouseControl, ready to respond to input.
3946
- */,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;}if(!this._markerDiv){this._initMarkerDiv();}this.fire("activated",true);var distanceMeasurementsPlugin=this.distanceMeasurementsPlugin;var hover=false;distanceMeasurementsPlugin.on("mouseOver",function(e){hover=true;});distanceMeasurementsPlugin.on("mouseLeave",function(e){hover=false;});distanceMeasurementsPlugin.on("measureDelete",function(e){hover=false;});var scene=this.scene;var cameraControl=distanceMeasurementsPlugin.viewer.cameraControl;var canvas=scene.canvas.canvas;scene.input;var mouseHovering=false;var pointerWorldPos=math.vec3();var pointerCanvasPos=math.vec2();var pointerDownCanvasX;var pointerDownCanvasY;var clickTolerance=20;var hoveredEntity=null;this._mouseState=MOUSE_FIRST_CLICK_EXPECTED;this._onCameraControlHoverSnapOrSurface=cameraControl.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",function(event){if(hover)return;var canvasPos=event.snappedCanvasPos||event.canvasPos;mouseHovering=true;pointerWorldPos.set(event.worldPos);pointerCanvasPos.set(event.canvasPos);if(_this24._mouseState===MOUSE_FIRST_CLICK_EXPECTED){canvas.getBoundingClientRect();var scrollLeft=window.pageXOffset||document.documentElement.scrollLeft;var scrollTop=window.pageYOffset||document.documentElement.scrollTop;var canvasLeftEdge=scrollLeft;var canvasTopEdge=scrollTop;_this24._markerDiv.style.marginLeft="".concat(_this24._offsetX+canvasLeftEdge+canvasPos[0]-5,"px");_this24._markerDiv.style.marginTop="".concat(_this24._offsetY+canvasTopEdge+canvasPos[1]-5,"px");_this24._markerDiv.style.background="pink";if(event.snappedToVertex||event.snappedToEdge){if(_this24.pointerLens){_this24.pointerLens.visible=true;_this24.pointerLens.canvasPos=event.canvasPos;_this24.pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;_this24.pointerLens.snapped=true;}_this24._markerDiv.style.background="greenyellow";_this24._markerDiv.style.border="2px solid green";}else{if(_this24.pointerLens){_this24.pointerLens.visible=true;_this24.pointerLens.canvasPos=event.canvasPos;_this24.pointerLens.snappedCanvasPos=event.canvasPos;_this24.pointerLens.snapped=false;}_this24._markerDiv.style.background="pink";_this24._markerDiv.style.border="2px solid red";}hoveredEntity=event.entity;}else{_this24._markerDiv.style.marginLeft="-10000px";_this24._markerDiv.style.marginTop="-10000px";}canvas.style.cursor="pointer";if(_this24._currentDistanceMeasurement){_this24._currentDistanceMeasurement.wireVisible=_this24._currentDistanceMeasurementInitState.wireVisible;_this24._currentDistanceMeasurement.axisVisible=_this24._currentDistanceMeasurementInitState.axisVisible&&_this24.distanceMeasurementsPlugin.defaultAxisVisible;_this24._currentDistanceMeasurement.xAxisVisible=_this24._currentDistanceMeasurementInitState.xAxisVisible&&_this24.distanceMeasurementsPlugin.defaultXAxisVisible;_this24._currentDistanceMeasurement.yAxisVisible=_this24._currentDistanceMeasurementInitState.yAxisVisible&&_this24.distanceMeasurementsPlugin.defaultYAxisVisible;_this24._currentDistanceMeasurement.zAxisVisible=_this24._currentDistanceMeasurementInitState.zAxisVisible&&_this24.distanceMeasurementsPlugin.defaultZAxisVisible;_this24._currentDistanceMeasurement.targetVisible=_this24._currentDistanceMeasurementInitState.targetVisible;_this24._currentDistanceMeasurement.target.worldPos=pointerWorldPos.slice();_this24._markerDiv.style.marginLeft="-10000px";_this24._markerDiv.style.marginTop="-10000px";}});canvas.addEventListener("mousedown",this._onMouseDown=function(e){if(e.which!==1){return;}pointerDownCanvasX=e.clientX;pointerDownCanvasY=e.clientY;});canvas.addEventListener("mouseup",this._onMouseUp=function(e){if(hover)return;if(e.which!==1){return;}if(e.clientX>pointerDownCanvasX+clickTolerance||e.clientX<pointerDownCanvasX-clickTolerance||e.clientY>pointerDownCanvasY+clickTolerance||e.clientY<pointerDownCanvasY-clickTolerance){return;}if(_this24._currentDistanceMeasurement){if(mouseHovering){_this24._currentDistanceMeasurement.target.entity=hoveredEntity;hoveredEntity=null;_this24._currentDistanceMeasurement.clickable=true;_this24.distanceMeasurementsPlugin.fire("measurementEnd",_this24._currentDistanceMeasurement);_this24._currentDistanceMeasurement=null;}else{_this24._currentDistanceMeasurement.destroy();_this24.distanceMeasurementsPlugin.fire("measurementCancel",_this24._currentDistanceMeasurement);_this24._currentDistanceMeasurement=null;hoveredEntity=null;}}else{if(mouseHovering){_this24._currentDistanceMeasurement=distanceMeasurementsPlugin.createMeasurement({id:math.createUUID(),origin:{worldPos:pointerWorldPos.slice()},target:{worldPos:pointerWorldPos.slice()},precision:distanceMeasurementsPlugin.precision,approximate:true});_this24._currentDistanceMeasurementInitState.axisVisible=_this24._currentDistanceMeasurement.axisVisible&&_this24.distanceMeasurementsPlugin.defaultAxisVisible;_this24._currentDistanceMeasurementInitState.xAxisVisible=_this24._currentDistanceMeasurement.xAxisVisible&&_this24.distanceMeasurementsPlugin.defaultXAxisVisible;_this24._currentDistanceMeasurementInitState.yAxisVisible=_this24._currentDistanceMeasurement.yAxisVisible&&_this24.distanceMeasurementsPlugin.defaultYAxisVisible;_this24._currentDistanceMeasurementInitState.zAxisVisible=_this24._currentDistanceMeasurement.zAxisVisible&&_this24.distanceMeasurementsPlugin.defaultZAxisVisible;_this24._currentDistanceMeasurementInitState.wireVisible=_this24._currentDistanceMeasurement.wireVisible;_this24._currentDistanceMeasurementInitState.targetVisible=_this24._currentDistanceMeasurement.targetVisible;_this24._currentDistanceMeasurement.clickable=false;_this24._currentDistanceMeasurement.origin.entity=hoveredEntity;hoveredEntity=null;_this24.fire("measurementStart",_this24._currentDistanceMeasurement);}}});this._onCameraControlHoverSnapOrSurfaceOff=cameraControl.on(this._snapping?"hoverSnapOrSurfaceOff":"hoverOff",function(event){if(_this24.pointerLens){_this24.pointerLens.visible=true;_this24.pointerLens.canvasPos=event.canvasPos;_this24.pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;}mouseHovering=false;_this24._markerDiv.style.marginLeft="-100px";_this24._markerDiv.style.marginTop="-100px";if(_this24._currentDistanceMeasurement){_this24._currentDistanceMeasurement.wireVisible=false;_this24._currentDistanceMeasurement.targetVisible=false;_this24._currentDistanceMeasurement.axisVisible=false;}canvas.style.cursor="default";});this._active=true;}/**
3949
+ */,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._activate){return;}if(!this._markerDiv){this._initMarkerDiv();}this.fire("activated",true);var distanceMeasurementsPlugin=this.distanceMeasurementsPlugin;var hover=false;distanceMeasurementsPlugin.on("mouseOver",function(e){if(!_this24._active){return;}hover=true;});distanceMeasurementsPlugin.on("mouseLeave",function(e){if(!_this24._active){return;}hover=false;});distanceMeasurementsPlugin.on("measureDelete",function(e){if(!_this24._active){return;}hover=false;});var scene=this.scene;var cameraControl=distanceMeasurementsPlugin.viewer.cameraControl;var canvas=scene.canvas.canvas;scene.input;var mouseHovering=false;var pointerWorldPos=math.vec3();var pointerCanvasPos=math.vec2();var pointerDownCanvasX;var pointerDownCanvasY;var clickTolerance=20;var hoveredEntity=null;this._mouseState=MOUSE_FIRST_CLICK_EXPECTED;this._onCameraControlHoverSnapOrSurface=cameraControl.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",function(event){if(!_this24._active){return;}if(hover)return;var canvasPos=event.snappedCanvasPos||event.canvasPos;mouseHovering=true;pointerWorldPos.set(event.worldPos);pointerCanvasPos.set(event.canvasPos);if(_this24._mouseState===MOUSE_FIRST_CLICK_EXPECTED){canvas.getBoundingClientRect();var scrollLeft=window.pageXOffset||document.documentElement.scrollLeft;var scrollTop=window.pageYOffset||document.documentElement.scrollTop;var canvasLeftEdge=scrollLeft;var canvasTopEdge=scrollTop;_this24._markerDiv.style.marginLeft="".concat(_this24._offsetX+canvasLeftEdge+canvasPos[0]-5,"px");_this24._markerDiv.style.marginTop="".concat(_this24._offsetY+canvasTopEdge+canvasPos[1]-5,"px");_this24._markerDiv.style.background="pink";if(event.snappedToVertex||event.snappedToEdge){if(_this24.pointerLens){_this24.pointerLens.visible=true;_this24.pointerLens.canvasPos=event.canvasPos;_this24.pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;_this24.pointerLens.snapped=true;}_this24._markerDiv.style.background="greenyellow";_this24._markerDiv.style.border="2px solid green";}else{if(_this24.pointerLens){_this24.pointerLens.visible=true;_this24.pointerLens.canvasPos=event.canvasPos;_this24.pointerLens.snappedCanvasPos=event.canvasPos;_this24.pointerLens.snapped=false;}_this24._markerDiv.style.background="pink";_this24._markerDiv.style.border="2px solid red";}hoveredEntity=event.entity;}else{_this24._markerDiv.style.marginLeft="-10000px";_this24._markerDiv.style.marginTop="-10000px";}canvas.style.cursor="pointer";if(_this24._currentDistanceMeasurement){_this24._currentDistanceMeasurement.wireVisible=_this24._currentDistanceMeasurementInitState.wireVisible;_this24._currentDistanceMeasurement.axisVisible=_this24._currentDistanceMeasurementInitState.axisVisible&&_this24.distanceMeasurementsPlugin.defaultAxisVisible;_this24._currentDistanceMeasurement.xAxisVisible=_this24._currentDistanceMeasurementInitState.xAxisVisible&&_this24.distanceMeasurementsPlugin.defaultXAxisVisible;_this24._currentDistanceMeasurement.yAxisVisible=_this24._currentDistanceMeasurementInitState.yAxisVisible&&_this24.distanceMeasurementsPlugin.defaultYAxisVisible;_this24._currentDistanceMeasurement.zAxisVisible=_this24._currentDistanceMeasurementInitState.zAxisVisible&&_this24.distanceMeasurementsPlugin.defaultZAxisVisible;_this24._currentDistanceMeasurement.targetVisible=_this24._currentDistanceMeasurementInitState.targetVisible;_this24._currentDistanceMeasurement.target.worldPos=pointerWorldPos.slice();_this24._markerDiv.style.marginLeft="-10000px";_this24._markerDiv.style.marginTop="-10000px";}});canvas.addEventListener("mousedown",this._onMouseDown=function(e){if(!_this24._active){return;}if(e.which!==1){return;}pointerDownCanvasX=e.clientX;pointerDownCanvasY=e.clientY;});canvas.addEventListener("mouseup",this._onMouseUp=function(e){if(!_this24._active){return;}if(hover)return;if(e.which!==1){return;}if(e.clientX>pointerDownCanvasX+clickTolerance||e.clientX<pointerDownCanvasX-clickTolerance||e.clientY>pointerDownCanvasY+clickTolerance||e.clientY<pointerDownCanvasY-clickTolerance){return;}if(_this24._currentDistanceMeasurement){if(mouseHovering){_this24._currentDistanceMeasurement.target.entity=hoveredEntity;hoveredEntity=null;_this24._currentDistanceMeasurement.clickable=true;_this24.distanceMeasurementsPlugin.fire("measurementEnd",_this24._currentDistanceMeasurement);_this24._currentDistanceMeasurement=null;}else{_this24._currentDistanceMeasurement.destroy();_this24.distanceMeasurementsPlugin.fire("measurementCancel",_this24._currentDistanceMeasurement);_this24._currentDistanceMeasurement=null;hoveredEntity=null;}}else{if(mouseHovering){_this24._currentDistanceMeasurement=distanceMeasurementsPlugin.createMeasurement({id:math.createUUID(),origin:{worldPos:pointerWorldPos.slice()},target:{worldPos:pointerWorldPos.slice()},precision:distanceMeasurementsPlugin.precision,approximate:true});_this24._currentDistanceMeasurementInitState.axisVisible=_this24._currentDistanceMeasurement.axisVisible&&_this24.distanceMeasurementsPlugin.defaultAxisVisible;_this24._currentDistanceMeasurementInitState.xAxisVisible=_this24._currentDistanceMeasurement.xAxisVisible&&_this24.distanceMeasurementsPlugin.defaultXAxisVisible;_this24._currentDistanceMeasurementInitState.yAxisVisible=_this24._currentDistanceMeasurement.yAxisVisible&&_this24.distanceMeasurementsPlugin.defaultYAxisVisible;_this24._currentDistanceMeasurementInitState.zAxisVisible=_this24._currentDistanceMeasurement.zAxisVisible&&_this24.distanceMeasurementsPlugin.defaultZAxisVisible;_this24._currentDistanceMeasurementInitState.wireVisible=_this24._currentDistanceMeasurement.wireVisible;_this24._currentDistanceMeasurementInitState.targetVisible=_this24._currentDistanceMeasurement.targetVisible;_this24._currentDistanceMeasurement.clickable=false;_this24._currentDistanceMeasurement.origin.entity=hoveredEntity;hoveredEntity=null;_this24.fire("measurementStart",_this24._currentDistanceMeasurement);}}});this._onCameraControlHoverSnapOrSurfaceOff=cameraControl.on(this._snapping?"hoverSnapOrSurfaceOff":"hoverOff",function(event){if(!_this24._active){return;}if(_this24.pointerLens){_this24.pointerLens.visible=true;_this24.pointerLens.canvasPos=event.canvasPos;_this24.pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;}mouseHovering=false;_this24._markerDiv.style.marginLeft="-100px";_this24._markerDiv.style.marginTop="-100px";if(_this24._currentDistanceMeasurement){_this24._currentDistanceMeasurement.wireVisible=false;_this24._currentDistanceMeasurement.targetVisible=false;_this24._currentDistanceMeasurement.axisVisible=false;}canvas.style.cursor="default";});this._activate=true;}/**
3947
3950
  * Deactivates this DistanceMeasurementsMouseControl, making it unresponsive to input.
3948
3951
  *
3949
3952
  * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.
@@ -4304,6 +4307,9 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.s
4304
4307
  *
4305
4308
  * @param {Boolean} labelsShown Whether or not to show the labels.
4306
4309
  */},{key:"setLabelsShown",value:function setLabelsShown(labelsShown){for(var _i36=0,_Object$entries2=Object.entries(this.measurements);_i36<_Object$entries2.length;_i36++){var _Object$entries2$_i=_slicedToArray(_Object$entries2[_i36],2),key=_Object$entries2$_i[0],measurement=_Object$entries2$_i[1];measurement.labelShown=labelsShown;}}/**
4310
+ * 控制所有测量对象显示隐藏
4311
+ * @param {*} visible
4312
+ */},{key:"setMeasurementsShown",value:function setMeasurementsShown(visible){for(var key in this.measurements){this.measurements[key].visible=visible;}}/**
4307
4313
  * Shows all or hides the axis wires of each {@link DistanceMeasurement}.
4308
4314
  *
4309
4315
  * @param {Boolean} labelsShown Whether or not to show the axis wires.
@@ -4331,7 +4337,7 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.s
4331
4337
  * @param {_offsetX} [cfg._offsetX] _offsetX of the mouse
4332
4338
  * @param {_offsetY} [cfg._offsetY] _offsetY of the mouse
4333
4339
  */function DistanceMeasurementsTouchControl(distanceMeasurementsPlugin){var _this27;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,DistanceMeasurementsTouchControl);_this27=_callSuper(this,DistanceMeasurementsTouchControl,[distanceMeasurementsPlugin.viewer.scene]);_this27.pointerLens=cfg.pointerLens;// this.PointerLens = new PointerLens(distanceMeasurementsPlugin.viewer, { active: true });
4334
- _this27.pointerCircle=new PointerCircle(distanceMeasurementsPlugin.viewer,{id:"distanceMeasure_Circle"});_this27._active=false;_this27._initMarkerDiv();_this27._currentDistanceMeasurement=null;_this27._currentDistanceMeasurementInitState={wireVisible:null,axisVisible:null,xAxisVisible:null,yaxisVisible:null,zAxisVisible:null,targetVisible:null};_this27._onCanvasTouchStart=null;_this27._onCanvasTouchEnd=null;_this27._longTouchTimeoutMs=300;_this27._snapping=cfg.snapping!==false;_this27._snapToEdge=cfg.snapping!==false;_this27._snapToVertex=cfg.snapping!==false;_this27._touchState=WAITING_FOR_ORIGIN_TOUCH_START;_this27._attachPlugin(distanceMeasurementsPlugin,cfg);_this27._offsetX=cfg._offsetX|0;_this27._offsetY=cfg._offsetY|0;return _this27;}_inherits(DistanceMeasurementsTouchControl,_DistanceMeasurements2);return _createClass(DistanceMeasurementsTouchControl,[{key:"_initMarkerDiv",value:function _initMarkerDiv(){var markerDiv=document.createElement("div");markerDiv.setAttribute("id","myDistanceMeasureTouchMarker");var canvas=this.scene.canvas.canvas;canvas.parentNode.insertBefore(markerDiv,canvas);markerDiv.style.background="black";markerDiv.style.border="2px solid blue";markerDiv.style.borderRadius="10px";markerDiv.style.width="5px";markerDiv.style.height="5px";markerDiv.style.margin="-200px -200px";markerDiv.style.zIndex="100";markerDiv.style.position="absolute";markerDiv.style.pointerEvents="none";this.markerDiv=markerDiv;}},{key:"_destroyMarkerDiv",value:function _destroyMarkerDiv(){if(this.markerDiv){this.markerDiv.parentNode.removeChild(this.markerDiv);this.markerDiv=null;}}},{key:"_attachPlugin",value:function _attachPlugin(distanceMeasurementsPlugin){/**
4340
+ _this27.pointerCircle=new PointerCircle(distanceMeasurementsPlugin.viewer,{id:"distanceMeasure_Circle"});_this27._active=false;_this27._activate=false;_this27._initMarkerDiv();_this27._currentDistanceMeasurement=null;_this27._currentDistanceMeasurementInitState={wireVisible:null,axisVisible:null,xAxisVisible:null,yaxisVisible:null,zAxisVisible:null,targetVisible:null};_this27._onCanvasTouchStart=null;_this27._onCanvasTouchEnd=null;_this27._longTouchTimeoutMs=300;_this27._snapping=cfg.snapping!==false;_this27._snapToEdge=cfg.snapping!==false;_this27._snapToVertex=cfg.snapping!==false;_this27._touchState=WAITING_FOR_ORIGIN_TOUCH_START;_this27._attachPlugin(distanceMeasurementsPlugin,cfg);_this27._offsetX=cfg._offsetX|0;_this27._offsetY=cfg._offsetY|0;return _this27;}_inherits(DistanceMeasurementsTouchControl,_DistanceMeasurements2);return _createClass(DistanceMeasurementsTouchControl,[{key:"_initMarkerDiv",value:function _initMarkerDiv(){var markerDiv=document.createElement("div");markerDiv.setAttribute("id","myDistanceMeasureTouchMarker");var canvas=this.scene.canvas.canvas;canvas.parentNode.insertBefore(markerDiv,canvas);markerDiv.style.background="black";markerDiv.style.border="2px solid blue";markerDiv.style.borderRadius="10px";markerDiv.style.width="5px";markerDiv.style.height="5px";markerDiv.style.margin="-200px -200px";markerDiv.style.zIndex="100";markerDiv.style.position="absolute";markerDiv.style.pointerEvents="none";this.markerDiv=markerDiv;}},{key:"_destroyMarkerDiv",value:function _destroyMarkerDiv(){if(this.markerDiv){this.markerDiv.parentNode.removeChild(this.markerDiv);this.markerDiv=null;}}},{key:"_attachPlugin",value:function _attachPlugin(distanceMeasurementsPlugin){/**
4335
4341
  * The {@link DistanceMeasurementsPlugin} that owns this DistanceMeasurementsTouchControl.
4336
4342
  * @type {DistanceMeasurementsPlugin}
4337
4343
  */this.distanceMeasurementsPlugin=distanceMeasurementsPlugin;/**
@@ -4348,7 +4354,7 @@ _this27.pointerCircle=new PointerCircle(distanceMeasurementsPlugin.viewer,{id:"d
4348
4354
  */function get(){return this._offsetY;}/** Gets if this DistanceMeasurementsTouchControl is currently active, where it is responding to input.
4349
4355
  *
4350
4356
  * @returns {Boolean}
4351
- */,set:function set(offsetY){this._offsetY=offsetY;}},{key:"active",get:function get(){return this._active;}/**
4357
+ */,set:function set(offsetY){this._offsetY=offsetY;}},{key:"active",get:function get(){return this._active;},set:function set(active){this._active=active;}/**
4352
4358
  * Sets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.
4353
4359
  *
4354
4360
  * This is `true` by default.
@@ -4366,7 +4372,7 @@ _this27.pointerCircle=new PointerCircle(distanceMeasurementsPlugin.viewer,{id:"d
4366
4372
  * @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.
4367
4373
  */function get(){return this._snapping;}/**
4368
4374
  * Activates this DistanceMeasurementsTouchControl, ready to respond to input.
4369
- */,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 _this28=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(){_this28.plugin.viewer.cameraControl.active=false;};var enableCameraNavigation=function enableCameraNavigation(){_this28.plugin.viewer.cameraControl.active=true;};var cancel=function cancel(){if(longTouchTimeout){clearTimeout(longTouchTimeout);longTouchTimeout=null;}if(_this28._currentDistanceMeasurement){_this28._currentDistanceMeasurement.destroy();_this28._currentDistanceMeasurement=null;}enableCameraNavigation();_this28._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+_this28.offsetX,touchY+_this28.offsetY]);touchMoveCanvasPos.set([touchX+_this28.offsetX,touchY+_this28.offsetY]);switch(_this28._touchState){case WAITING_FOR_ORIGIN_TOUCH_START:if(currentNumTouches!==1&&longTouchTimeout!==null){// Two or more fingers down
4375
+ */,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 _this28=this;if(this._activate){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(){_this28.plugin.viewer.cameraControl.active=false;};var enableCameraNavigation=function enableCameraNavigation(){_this28.plugin.viewer.cameraControl.active=true;};var cancel=function cancel(){if(longTouchTimeout){clearTimeout(longTouchTimeout);longTouchTimeout=null;}if(_this28._currentDistanceMeasurement){_this28._currentDistanceMeasurement.destroy();_this28._currentDistanceMeasurement=null;}enableCameraNavigation();_this28._touchState=WAITING_FOR_ORIGIN_TOUCH_START;};canvas.addEventListener("touchstart",this._onCanvasTouchStart=function(event){if(!_this28._active){return;}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+_this28.offsetX,touchY+_this28.offsetY]);touchMoveCanvasPos.set([touchX+_this28.offsetX,touchY+_this28.offsetY]);switch(_this28._touchState){case WAITING_FOR_ORIGIN_TOUCH_START:if(currentNumTouches!==1&&longTouchTimeout!==null){// Two or more fingers down
4370
4376
  cancel();return;}var snapPickResult=scene.pick({canvasPos:touchMoveCanvasPos,snapping:_this28._snapping,snapToEdge:_this28._snapping});if(snapPickResult&&snapPickResult.snapped){pointerWorldPos.set(snapPickResult.worldPos);_this28.pointerCircle.start(snapPickResult.snappedCanvasPos);}else{var pickResult=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(pickResult&&pickResult.worldPos){pointerWorldPos.set(pickResult.worldPos);_this28.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
4371
4377
  }// Long touch
4372
4378
  if(_this28.pointerLens){_this28.pointerLens.visible=true;_this28.pointerLens.canvasPos=touchStartCanvasPos;_this28.pointerLens.cursorPos=touchStartCanvasPos;}if(_this28.pointerLens){_this28.pointerLens.canvasPos=touchMoveCanvasPos;_this28.pointerLens.snapped=false;}if(_this28.pointerLens){_this28.pointerLens.cursorPos=snapPickResult.canvasPos;_this28.pointerLens.snapped=true;}// pointerWorldPos.set(snapPickResult.snappedWorldPos);
@@ -4383,14 +4389,14 @@ return;}// Long touch
4383
4389
  if(_this28.pointerLens){_this28.pointerLens.visible=true;_this28.pointerLens.canvasPos=touchStartCanvasPos;_this28.pointerLens.snapped=false;}var snapPickResult=scene.pick({canvasPos:touchMoveCanvasPos,snapToVertex:_this28._snapping,snapToEdge:_this28._snapping});if(snapPickResult&&snapPickResult.snapped){if(_this28.pointerLens){_this28.pointerLens.cursorPos=snapPickResult.snappedCanvasPos;_this28.pointerLens.snapped=true;}_this28.pointerCircle.start(snapPickResult.snappedCanvasPos);pointerWorldPos.set(snapPickResult.worldPos);_this28._currentDistanceMeasurement.target.worldPos=snapPickResult.worldPos;_this28._currentDistanceMeasurement.target.entity=snapPickResult.entity;_this28._currentDistanceMeasurement.targetVisible=true;_this28._currentDistanceMeasurement.wireVisible=true;_this28._currentDistanceMeasurement.labelsVisible=true;_this28.distanceMeasurementsPlugin.fire("measurementStart",_this28._currentDistanceMeasurement);}else{var _pickResult6=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(_pickResult6&&_pickResult6.worldPos){if(_this28.pointerLens){_this28.pointerLens.cursorPos=_pickResult6.canvasPos;_this28.pointerLens.snapped=false;}_this28.pointerCircle.start(_pickResult6.canvasPos);pointerWorldPos.set(_pickResult6.worldPos);_this28._currentDistanceMeasurement.target.worldPos=_pickResult6.worldPos;_this28._currentDistanceMeasurement.target.entity=_pickResult6.entity;_this28._currentDistanceMeasurement.targetVisible=true;_this28._currentDistanceMeasurement.wireVisible=true;_this28._currentDistanceMeasurement.labelsVisible=true;_this28.distanceMeasurementsPlugin.fire("measurementStart",_this28._currentDistanceMeasurement);}else{if(_this28.pointerLens){_this28.pointerLens.cursorPos=null;_this28.pointerLens.snapped=false;}}}_this28._touchState=WAITING_FOR_TARGET_LONG_TOUCH_END;// console.log("touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_LONG_TOUCH_END")
4384
4390
  disableCameraNavigation();},_this28._longTouchTimeoutMs);_this28._touchState=WAITING_FOR_TARGET_QUICK_TOUCH_END;// console.log("touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_QUICK_TOUCH_END")
4385
4391
  }touchId=touch.identifier;break;default:if(longTouchTimeout!==null){clearTimeout(longTouchTimeout);longTouchTimeout=null;}_this28._touchState=TOUCH_CANCELING;// console.log("touchstart: this._touchState= default -> TOUCH_CANCELING")
4386
- return;}},{passive:true});canvas.addEventListener("touchmove",function(event){_this28.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+_this28.offsetX,touchY+_this28.offsetY]);var snapPickResult;var pickResult;switch(_this28._touchState){case WAITING_FOR_ORIGIN_LONG_TOUCH_END:if(_this28.pointerLens){_this28.pointerLens.canvasPos=touchMoveCanvasPos;}snapPickResult=scene.pick({canvasPos:touchMoveCanvasPos,snapToVertex:_this28._snapping,snapToEdge:_this28._snapping});if(snapPickResult&&snapPickResult.snapped){if(_this28.pointerLens){_this28.pointerLens.snappedCanvasPos=snapPickResult.snappedCanvasPos;_this28.pointerLens.snapped=true;}pointerWorldPos.set(snapPickResult.worldPos);if(!_this28._currentDistanceMeasurement){_this28._currentDistanceMeasurement=plugin.createMeasurement({id:math.createUUID(),origin:{worldPos:snapPickResult.worldPos,entity:snapPickResult.entity},target:{worldPos:snapPickResult.worldPos,entity:snapPickResult.entity},precision:plugin.precision});_this28._currentDistanceMeasurement.labelsVisible=false;_this28._currentDistanceMeasurement.xAxisVisible=false;_this28._currentDistanceMeasurement.yAxisVisible=false;_this28._currentDistanceMeasurement.zAxisVisible=false;_this28._currentDistanceMeasurement.wireVisible=false;_this28._currentDistanceMeasurement.originVisible=true;_this28._currentDistanceMeasurement.targetVisible=false;_this28._currentDistanceMeasurement.clickable=false;}else{_this28._currentDistanceMeasurement.origin.worldPos=snapPickResult.worldPos;}_this28.distanceMeasurementsPlugin.fire("measurementStart",_this28._currentDistanceMeasurement);}else{pickResult=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(pickResult&&pickResult.worldPos){if(_this28.pointerLens){_this28.pointerLens.cursorPos=pickResult.canvasPos;_this28.pointerLens.snapped=false;}pointerWorldPos.set(pickResult.worldPos);if(!_this28._currentDistanceMeasurement){_this28._currentDistanceMeasurement=plugin.createMeasurement({id:math.createUUID(),origin:{worldPos:pickResult.worldPos,entity:pickResult.entity},target:{worldPos:pickResult.worldPos,entity:pickResult.entity},precision:plugin.precision});_this28._currentDistanceMeasurement.labelsVisible=false;_this28._currentDistanceMeasurement.xAxisVisible=false;_this28._currentDistanceMeasurement.yAxisVisible=false;_this28._currentDistanceMeasurement.zAxisVisible=false;_this28._currentDistanceMeasurement.wireVisible=false;_this28._currentDistanceMeasurement.originVisible=true;_this28._currentDistanceMeasurement.targetVisible=false;_this28._currentDistanceMeasurement.clickable=false;}else{_this28._currentDistanceMeasurement.origin.worldPos=pickResult.worldPos;}_this28.distanceMeasurementsPlugin.fire("measurementStart",_this28._currentDistanceMeasurement);}else{if(_this28.pointerLens){_this28.pointerLens.cursorPos=null;_this28.pointerLens.snapped=false;}}}_this28._touchState=WAITING_FOR_ORIGIN_LONG_TOUCH_END;// console.log("touchmove: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_LONG_TOUCH_END")
4392
+ return;}},{passive:true});canvas.addEventListener("touchmove",function(event){if(!_this28._active){return;}_this28.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+_this28.offsetX,touchY+_this28.offsetY]);var snapPickResult;var pickResult;switch(_this28._touchState){case WAITING_FOR_ORIGIN_LONG_TOUCH_END:if(_this28.pointerLens){_this28.pointerLens.canvasPos=touchMoveCanvasPos;}snapPickResult=scene.pick({canvasPos:touchMoveCanvasPos,snapToVertex:_this28._snapping,snapToEdge:_this28._snapping});if(snapPickResult&&snapPickResult.snapped){if(_this28.pointerLens){_this28.pointerLens.snappedCanvasPos=snapPickResult.snappedCanvasPos;_this28.pointerLens.snapped=true;}pointerWorldPos.set(snapPickResult.worldPos);if(!_this28._currentDistanceMeasurement){_this28._currentDistanceMeasurement=plugin.createMeasurement({id:math.createUUID(),origin:{worldPos:snapPickResult.worldPos,entity:snapPickResult.entity},target:{worldPos:snapPickResult.worldPos,entity:snapPickResult.entity},precision:plugin.precision});_this28._currentDistanceMeasurement.labelsVisible=false;_this28._currentDistanceMeasurement.xAxisVisible=false;_this28._currentDistanceMeasurement.yAxisVisible=false;_this28._currentDistanceMeasurement.zAxisVisible=false;_this28._currentDistanceMeasurement.wireVisible=false;_this28._currentDistanceMeasurement.originVisible=true;_this28._currentDistanceMeasurement.targetVisible=false;_this28._currentDistanceMeasurement.clickable=false;}else{_this28._currentDistanceMeasurement.origin.worldPos=snapPickResult.worldPos;}_this28.distanceMeasurementsPlugin.fire("measurementStart",_this28._currentDistanceMeasurement);}else{pickResult=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(pickResult&&pickResult.worldPos){if(_this28.pointerLens){_this28.pointerLens.cursorPos=pickResult.canvasPos;_this28.pointerLens.snapped=false;}pointerWorldPos.set(pickResult.worldPos);if(!_this28._currentDistanceMeasurement){_this28._currentDistanceMeasurement=plugin.createMeasurement({id:math.createUUID(),origin:{worldPos:pickResult.worldPos,entity:pickResult.entity},target:{worldPos:pickResult.worldPos,entity:pickResult.entity},precision:plugin.precision});_this28._currentDistanceMeasurement.labelsVisible=false;_this28._currentDistanceMeasurement.xAxisVisible=false;_this28._currentDistanceMeasurement.yAxisVisible=false;_this28._currentDistanceMeasurement.zAxisVisible=false;_this28._currentDistanceMeasurement.wireVisible=false;_this28._currentDistanceMeasurement.originVisible=true;_this28._currentDistanceMeasurement.targetVisible=false;_this28._currentDistanceMeasurement.clickable=false;}else{_this28._currentDistanceMeasurement.origin.worldPos=pickResult.worldPos;}_this28.distanceMeasurementsPlugin.fire("measurementStart",_this28._currentDistanceMeasurement);}else{if(_this28.pointerLens){_this28.pointerLens.cursorPos=null;_this28.pointerLens.snapped=false;}}}_this28._touchState=WAITING_FOR_ORIGIN_LONG_TOUCH_END;// console.log("touchmove: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_LONG_TOUCH_END")
4387
4393
  break;// case WAITING_FOR_TARGET_TOUCH_START:
4388
4394
  // this._touchState = WAITING_FOR_TARGET_TOUCH_START;
4389
4395
  // console.log("touchmove: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_TOUCH_START")
4390
4396
  // break;
4391
4397
  case WAITING_FOR_TARGET_LONG_TOUCH_END:if(currentNumTouches!==1&&longTouchTimeout!==null){// Two or more fingers down
4392
4398
  clearTimeout(longTouchTimeout);longTouchTimeout=null;if(_this28.pointerLens){_this28.pointerLens.visible=false;}_this28._touchState=TOUCH_CANCELING;// console.log("touchmove: this._touchState= QUICK_TOUCH_FINDING_TARGET -> TOUCH_CANCELING")
4393
- return;}if(_this28.pointerLens){_this28.pointerLens.canvasPos=touchMoveCanvasPos;}snapPickResult=scene.pick({canvasPos:touchMoveCanvasPos,snapToVertex:_this28._snapping,snapToEdge:_this28._snapping});if(snapPickResult&&snapPickResult.worldPos){if(_this28.pointerLens){_this28.pointerLens.cursorPos=snapPickResult.snappedCanvasPos;_this28.pointerLens.snapped=true;}_this28._currentDistanceMeasurement.target.worldPos=snapPickResult.worldPos;_this28._currentDistanceMeasurement.target.entity=snapPickResult.entity;_this28._currentDistanceMeasurement.targetVisible=true;_this28._currentDistanceMeasurement.wireVisible=true;_this28._currentDistanceMeasurement.labelsVisible=true;}else{pickResult=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(pickResult&&pickResult.worldPos){if(_this28.pointerLens){_this28.pointerLens.cursorPos=pickResult.canvasPos;_this28.pointerLens.snapped=false;}_this28._currentDistanceMeasurement.target.worldPos=pickResult.worldPos;_this28._currentDistanceMeasurement.target.entity=pickResult.entity;_this28._currentDistanceMeasurement.targetVisible=true;_this28._currentDistanceMeasurement.wireVisible=true;_this28._currentDistanceMeasurement.labelsVisible=true;}}_this28._touchState=WAITING_FOR_TARGET_LONG_TOUCH_END;break;}},{passive:true});canvas.addEventListener("touchend",this._onCanvasTouchEnd=function(event){_this28.pointerCircle.stop();var numChangedTouches=event.changedTouches.length;if(numChangedTouches!==1){return;}var touch=event.changedTouches[0];var touchX=touch.clientX;var touchY=touch.clientY;if(touch.identifier!==touchId){return;}if(longTouchTimeout){clearTimeout(longTouchTimeout);longTouchTimeout=null;}touchEndCanvasPos.set([touchX,touchY]);switch(_this28._touchState){//等待起点短按
4399
+ return;}if(_this28.pointerLens){_this28.pointerLens.canvasPos=touchMoveCanvasPos;}snapPickResult=scene.pick({canvasPos:touchMoveCanvasPos,snapToVertex:_this28._snapping,snapToEdge:_this28._snapping});if(snapPickResult&&snapPickResult.worldPos){if(_this28.pointerLens){_this28.pointerLens.cursorPos=snapPickResult.snappedCanvasPos;_this28.pointerLens.snapped=true;}_this28._currentDistanceMeasurement.target.worldPos=snapPickResult.worldPos;_this28._currentDistanceMeasurement.target.entity=snapPickResult.entity;_this28._currentDistanceMeasurement.targetVisible=true;_this28._currentDistanceMeasurement.wireVisible=true;_this28._currentDistanceMeasurement.labelsVisible=true;}else{pickResult=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(pickResult&&pickResult.worldPos){if(_this28.pointerLens){_this28.pointerLens.cursorPos=pickResult.canvasPos;_this28.pointerLens.snapped=false;}_this28._currentDistanceMeasurement.target.worldPos=pickResult.worldPos;_this28._currentDistanceMeasurement.target.entity=pickResult.entity;_this28._currentDistanceMeasurement.targetVisible=true;_this28._currentDistanceMeasurement.wireVisible=true;_this28._currentDistanceMeasurement.labelsVisible=true;}}_this28._touchState=WAITING_FOR_TARGET_LONG_TOUCH_END;break;}},{passive:true});canvas.addEventListener("touchend",this._onCanvasTouchEnd=function(event){if(!_this28._active){return;}_this28.pointerCircle.stop();var numChangedTouches=event.changedTouches.length;if(numChangedTouches!==1){return;}var touch=event.changedTouches[0];var touchX=touch.clientX;var touchY=touch.clientY;if(touch.identifier!==touchId){return;}if(longTouchTimeout){clearTimeout(longTouchTimeout);longTouchTimeout=null;}touchEndCanvasPos.set([touchX,touchY]);switch(_this28._touchState){//等待起点短按
4394
4400
  case WAITING_FOR_ORIGIN_QUICK_TOUCH_END:{if(numChangedTouches!==1||touchX>touchStartCanvasPos[0]+touchTolerance||touchX<touchStartCanvasPos[0]-touchTolerance||touchY>touchStartCanvasPos[1]+touchTolerance||touchY<touchStartCanvasPos[1]-touchTolerance){_this28._touchState=WAITING_FOR_ORIGIN_TOUCH_START;return;}var pickResult=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(pickResult&&pickResult.worldPos){_this28._currentDistanceMeasurement=plugin.createMeasurement({id:math.createUUID(),origin:{worldPos:pickResult.worldPos,entity:pickResult.entity},target:{worldPos:pickResult.worldPos,entity:pickResult.entity},precision:plugin.precision});_this28._currentDistanceMeasurement.labelsVisible=false;_this28._currentDistanceMeasurement.xAxisVisible=false;_this28._currentDistanceMeasurement.yAxisVisible=false;_this28._currentDistanceMeasurement.zAxisVisible=false;_this28._currentDistanceMeasurement.wireVisible=false;_this28._currentDistanceMeasurement.originVisible=true;_this28._currentDistanceMeasurement.targetVisible=false;// this._currentDistanceMeasurement.clickable = false;
4395
4401
  _this28._touchState=WAITING_FOR_TARGET_TOUCH_START;_this28.distanceMeasurementsPlugin.fire("measurementStart",_this28._currentDistanceMeasurement);// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
4396
4402
  }else{if(_this28._currentDistanceMeasurement){_this28._currentDistanceMeasurement.destroy();}_this28._touchState=WAITING_FOR_ORIGIN_TOUCH_START;// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
@@ -4402,7 +4408,7 @@ case WAITING_FOR_TARGET_QUICK_TOUCH_END:{if(numChangedTouches!==1||touchX>touchS
4402
4408
  }enableCameraNavigation();break;//终点长按
4403
4409
  case WAITING_FOR_TARGET_LONG_TOUCH_END:if(_this28.pointerLens){_this28.pointerLens.visible=false;}if(!_this28._currentDistanceMeasurement||!_this28._currentDistanceMeasurement.targetVisible){if(_this28._currentDistanceMeasurement){_this28._currentDistanceMeasurement.destroy();_this28._currentDistanceMeasurement=null;}_this28._touchState=WAITING_FOR_ORIGIN_TOUCH_START;// console.log("touchend: this._touchState= WAITING_FOR_TARGET_LONG_TOUCH_END (no target found) -> WAITING_FOR_ORIGIN_TOUCH_START")
4404
4410
  }else{_this28._currentDistanceMeasurement.clickable=true;_this28.distanceMeasurementsPlugin.fire("measurementEnd",_this28._currentDistanceMeasurement);_this28._currentDistanceMeasurement=null;_this28._touchState=WAITING_FOR_ORIGIN_TOUCH_START;// console.log("touchend: this._touchState= WAITING_FOR_TARGET_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
4405
- }enableCameraNavigation();break;}},{passive:true});canvas.addEventListener("touchcancel",this._onCanvasTouchEnd);this._active=true;}/**
4411
+ }enableCameraNavigation();break;}},{passive:true});canvas.addEventListener("touchcancel",this._onCanvasTouchEnd);this._activate=true;}/**
4406
4412
  * Deactivates this DistanceMeasurementsTouchControl, making it unresponsive to input.
4407
4413
  *
4408
4414
  * Destroys any {@link DistanceMeasurement} under construction.
@@ -8163,7 +8169,7 @@ if(this._normalMap){hash.push("/nm");if(this._normalMap.hasMatrix){hash.push("/m
8163
8169
  * @type {String}
8164
8170
  */function get(){return this._state.frontface?"ccw":"cw";}/**
8165
8171
  * Destroys this PhongMaterial.
8166
- */,set:function set(value){value=value!=="cw";if(this._state.frontface===value){return;}this._state.frontface=value;this.glRedraw();}},{key:"destroy",value:function destroy(){_superPropGet(PhongMaterial,"destroy",this,3)([]);this._state.destroy();}}]);}(Material);var PRESETS$3={"default":{fill:true,fillColor:[0.4,0.4,0.4],fillAlpha:0.2,edges:true,edgeColor:[0.2,0.2,0.2],edgeAlpha:0.5,edgeWidth:1},defaultWhiteBG:{fill:true,fillColor:[1,1,1],fillAlpha:0.6,edgeColor:[0.2,0.2,0.2],edgeAlpha:1.0,edgeWidth:1},defaultLightBG:{fill:true,fillColor:[0.4,0.4,0.4],fillAlpha:0.2,edges:true,edgeColor:[0.2,0.2,0.2],edgeAlpha:0.5,edgeWidth:1},defaultDarkBG:{fill:true,fillColor:[0.4,0.4,0.4],fillAlpha:0.2,edges:true,edgeColor:[0.5,0.5,0.5],edgeAlpha:0.5,edgeWidth:1},phosphorous:{fill:true,fillColor:[0.0,0.0,0.0],fillAlpha:0.4,edges:true,edgeColor:[0.9,0.9,0.9],edgeAlpha:0.5,edgeWidth:2},sunset:{fill:true,fillColor:[0.9,0.9,0.6],fillAlpha:0.2,edges:true,edgeColor:[0.9,0.9,0.9],edgeAlpha:0.5,edgeWidth:1},vectorscope:{fill:true,fillColor:[0.0,0.0,0.0],fillAlpha:0.7,edges:true,edgeColor:[0.2,1.0,0.2],edgeAlpha:1,edgeWidth:2},battlezone:{fill:true,fillColor:[0.0,0.0,0.0],fillAlpha:1.0,edges:true,edgeColor:[0.2,1.0,0.2],edgeAlpha:1,edgeWidth:3},xraylightblue:{fill:true,fillColor:[0.2,0.3,0.4],fillAlpha:0.2,edges:true,edgeColor:[0.1,0.2,0.3],edgeAlpha:1.0,edgeWidth:1},blueHighlight:{fill:true,fillColor:[0.6,0.7,0.8],fillAlpha:0.2,edges:true,edgeColor:[1.0,1.0,1.0],edgeAlpha:1.0,edgeWidth:1},greenSelected:{fill:true,fillColor:[0.0,1.0,0.0],fillAlpha:0.5,edges:true,edgeColor:[1.0,1.0,1.0],edgeAlpha:1.0,edgeWidth:1},gamegrid:{fill:true,fillColor:[0.2,0.2,0.7],fillAlpha:0.9,edges:true,edgeColor:[0.4,0.4,1.6],edgeAlpha:0.8,edgeWidth:3}};/**
8172
+ */,set:function set(value){value=value!=="cw";if(this._state.frontface===value){return;}this._state.frontface=value;this.glRedraw();}},{key:"destroy",value:function destroy(){_superPropGet(PhongMaterial,"destroy",this,3)([]);this._state.destroy();}}]);}(Material);var PRESETS$3={"default":{fill:true,fillColor:[0.4,0.4,0.4],fillAlpha:0.2,edges:true,edgeColor:[0.2,0.2,0.2],edgeAlpha:0.5,edgeWidth:1},defaultWhiteBG:{fill:true,fillColor:[1,1,1],fillAlpha:0.6,edgeColor:[0.2,0.2,0.2],edgeAlpha:1.0,edgeWidth:1},defaultLightBG:{fill:true,fillColor:[0.4,0.4,0.4],fillAlpha:0.2,edges:true,edgeColor:[0.2,0.2,0.2],edgeAlpha:0.5,edgeWidth:1},defaultDarkBG:{fill:true,fillColor:[0.4,0.4,0.4],fillAlpha:0.2,edges:true,edgeColor:[0.5,0.5,0.5],edgeAlpha:0.5,edgeWidth:1},phosphorous:{fill:true,fillColor:[0.0,0.0,0.0],fillAlpha:0.4,edges:true,edgeColor:[0.9,0.9,0.9],edgeAlpha:0.5,edgeWidth:2},sunset:{fill:true,fillColor:[0.9,0.9,0.6],fillAlpha:0.2,edges:true,edgeColor:[0.9,0.9,0.9],edgeAlpha:0.5,edgeWidth:1},vectorscope:{fill:true,fillColor:[0.0,0.0,0.0],fillAlpha:0.7,edges:true,edgeColor:[0.2,1.0,0.2],edgeAlpha:1,edgeWidth:2},battlezone:{fill:true,fillColor:[0.0,0.0,0.0],fillAlpha:1.0,edges:true,edgeColor:[0.2,1.0,0.2],edgeAlpha:1,edgeWidth:3},xraylightblue:{fill:true,fillColor:[0.2,0.3,0.4],fillAlpha:0.2,edges:true,edgeColor:[0.1,0.2,0.3],edgeAlpha:1.0,edgeWidth:1},blueHighlight:{fill:true,fillColor:[0.6,0.7,0.8],fillAlpha:0.2,edges:true,edgeColor:[1.0,1.0,1.0],edgeAlpha:1.0,edgeWidth:1},greenSelected:{fill:true,fillColor:[0.0,1.0,0.0],fillAlpha:0.5,edges:true,edgeColor:[1.0,1.0,1.0],edgeAlpha:1.0,edgeWidth:1},blueSelected:{fill:true,fillColor:[0.2,0.6,0.9],fillAlpha:0.3,edges:false,edgeColor:[1.0,1.0,1.0],edgeAlpha:1.0,edgeWidth:1},gamegrid:{fill:true,fillColor:[0.2,0.2,0.7],fillAlpha:0.9,edges:true,edgeColor:[0.4,0.4,1.6],edgeAlpha:0.8,edgeWidth:3}};/**
8167
8173
  * Configures the appearance of {@link Entity}s when they are xrayed, highlighted or selected.
8168
8174
  *
8169
8175
  * * XRay an {@link Entity} by setting {@link Entity#xrayed} ````true````.
@@ -10108,7 +10114,7 @@ dontClear:true});}/**
10108
10114
  * {@link Mesh}s are highlighted while {@link Mesh#highlighted} is ````true````.
10109
10115
  *
10110
10116
  * @type {EmphasisMaterial}
10111
- */},{key:"selectedMaterial",get:function get(){return this.components["default.selectedMaterial"]||new EmphasisMaterial(this,{id:"default.selectedMaterial",preset:"greenSelected",dontClear:true});}/**
10117
+ */},{key:"selectedMaterial",get:function get(){return this.components["default.selectedMaterial"]||new EmphasisMaterial(this,{id:"default.selectedMaterial",preset:"blueSelected",dontClear:true});}/**
10112
10118
  * Gets the default {@link EdgeMaterial} for this Scene.
10113
10119
  *
10114
10120
  * Has {@link EdgeMaterial#id} set to "default.edgeMaterial".
@@ -11644,224 +11650,224 @@ if(p===UnsignedInt248Type){return gl.UNSIGNED_INT_24_8;}if(p===RepeatWrapping){r
11644
11650
  if(props.format!==undefined){this.format=props.format;}if(props.internalFormat!==undefined){this.internalFormat=props.internalFormat;}if(props.encoding!==undefined){this.encoding=props.encoding;}if(props.type!==undefined){this.type=props.type;}if(props.flipY!==undefined){this.flipY=props.flipY;}if(props.premultiplyAlpha!==undefined){this.premultiplyAlpha=props.premultiplyAlpha;}if(props.unpackAlignment!==undefined){this.unpackAlignment=props.unpackAlignment;}if(props.minFilter!==undefined){this.minFilter=props.minFilter;}if(props.magFilter!==undefined){this.magFilter=props.magFilter;}if(props.wrapS!==undefined){this.wrapS=props.wrapS;}if(props.wrapT!==undefined){this.wrapT=props.wrapT;}if(props.wrapR!==undefined){this.wrapR=props.wrapR;}gl.activeTexture(gl.TEXTURE0+0);gl.bindTexture(this.target,this.texture);var supportsMips=mipmaps.length>1;gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL,this.flipY);gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha);gl.pixelStorei(gl.UNPACK_ALIGNMENT,this.unpackAlignment);gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,gl.NONE);var wrapS=convertConstant(gl,this.wrapS);if(wrapS){gl.texParameteri(this.target,gl.TEXTURE_WRAP_S,wrapS);}var wrapT=convertConstant(gl,this.wrapT);if(wrapT){gl.texParameteri(this.target,gl.TEXTURE_WRAP_T,wrapT);}if(this.type===gl.TEXTURE_3D||this.type===gl.TEXTURE_2D_ARRAY){var wrapR=convertConstant(gl,this.wrapR);if(wrapR){gl.texParameteri(this.target,gl.TEXTURE_WRAP_R,wrapR);}gl.texParameteri(this.type,gl.TEXTURE_WRAP_R,wrapR);}if(supportsMips){gl.texParameteri(this.target,gl.TEXTURE_MIN_FILTER,filterFallback(gl,this.minFilter));gl.texParameteri(this.target,gl.TEXTURE_MAG_FILTER,filterFallback(gl,this.magFilter));}else{gl.texParameteri(this.target,gl.TEXTURE_MIN_FILTER,convertConstant(gl,this.minFilter));gl.texParameteri(this.target,gl.TEXTURE_MAG_FILTER,convertConstant(gl,this.magFilter));}var glFormat=convertConstant(gl,this.format,this.encoding);var glType=convertConstant(gl,this.type);var glInternalFormat=getInternalFormat(gl,this.internalFormat,glFormat,glType,this.encoding,false);gl.texStorage2D(gl.TEXTURE_2D,levels,glInternalFormat,mipmaps[0].width,mipmaps[0].height);for(var _i127=0,len=mipmaps.length;_i127<len;_i127++){var mipmap=mipmaps[_i127];if(this.format!==RGBAFormat){if(glFormat!==null){gl.compressedTexSubImage2D(gl.TEXTURE_2D,_i127,0,0,mipmap.width,mipmap.height,glFormat,mipmap.data);}else{console.warn('Attempt to load unsupported compressed texture format in .setCompressedData()');}}else{gl.texSubImage2D(gl.TEXTURE_2D,_i127,0,0,mipmap.width,mipmap.height,glFormat,glType,mipmap.data);}}// if (generateMipMap) {
11645
11651
  // // gl.generateMipmap(this.target); // Only for roughness textures?
11646
11652
  // }
11647
- gl.bindTexture(this.target,null);}},{key:"setProps",value:function setProps(props){var gl=this.gl;gl.bindTexture(this.target,this.texture);this._uploadProps(props);gl.bindTexture(this.target,null);}},{key:"_uploadProps",value:function _uploadProps(props){var gl=this.gl;if(props.format!==undefined){this.format=props.format;}if(props.internalFormat!==undefined){this.internalFormat=props.internalFormat;}if(props.encoding!==undefined){this.encoding=props.encoding;}if(props.type!==undefined){this.type=props.type;}if(props.minFilter!==undefined){var minFilter=convertConstant(gl,props.minFilter);if(minFilter){this.minFilter=props.minFilter;gl.texParameteri(this.target,gl.TEXTURE_MIN_FILTER,minFilter);if(minFilter===gl.NEAREST_MIPMAP_NEAREST||minFilter===gl.LINEAR_MIPMAP_NEAREST||minFilter===gl.NEAREST_MIPMAP_LINEAR||minFilter===gl.LINEAR_MIPMAP_LINEAR){gl.generateMipmap(this.target);}}}if(props.magFilter!==undefined){var magFilter=convertConstant(gl,props.magFilter);if(magFilter){this.magFilter=props.magFilter;gl.texParameteri(this.target,gl.TEXTURE_MAG_FILTER,magFilter);}}if(props.wrapS!==undefined){var wrapS=convertConstant(gl,props.wrapS);if(wrapS){this.wrapS=props.wrapS;gl.texParameteri(this.target,gl.TEXTURE_WRAP_S,wrapS);}}if(props.wrapT!==undefined){var wrapT=convertConstant(gl,props.wrapT);if(wrapT){this.wrapT=props.wrapT;gl.texParameteri(this.target,gl.TEXTURE_WRAP_T,wrapT);}}}},{key:"bind",value:function bind(unit){if(!this.allocated){return;}if(this.texture){var _gl2=this.gl;_gl2.activeTexture(_gl2["TEXTURE"+unit]);_gl2.bindTexture(this.target,this.texture);return true;}return false;}},{key:"unbind",value:function unbind(unit){if(!this.allocated){return;}if(this.texture){var _gl3=this.gl;_gl3.activeTexture(_gl3["TEXTURE"+unit]);_gl3.bindTexture(this.target,null);}}},{key:"destroy",value:function destroy(){if(!this.allocated){return;}if(this.texture){this.gl.deleteTexture(this.texture);this.texture=null;}}}]);}();function getInternalFormat(gl,internalFormatName,glFormat,glType,encoding){var isVideoTexture=arguments.length>5&&arguments[5]!==undefined?arguments[5]:false;if(internalFormatName!==null){if(gl[internalFormatName]!==undefined){return gl[internalFormatName];}console.warn('Attempt to use non-existing WebGL internal format \''+internalFormatName+'\'');}var internalFormat=glFormat;if(glFormat===gl.RED){if(glType===gl.FLOAT)internalFormat=gl.R32F;if(glType===gl.HALF_FLOAT)internalFormat=gl.R16F;if(glType===gl.UNSIGNED_BYTE)internalFormat=gl.R8;}if(glFormat===gl.RG){if(glType===gl.FLOAT)internalFormat=gl.RG32F;if(glType===gl.HALF_FLOAT)internalFormat=gl.RG16F;if(glType===gl.UNSIGNED_BYTE)internalFormat=gl.RG8;}if(glFormat===gl.RGBA){if(glType===gl.FLOAT)internalFormat=gl.RGBA32F;if(glType===gl.HALF_FLOAT)internalFormat=gl.RGBA16F;if(glType===gl.UNSIGNED_BYTE)internalFormat=encoding===sRGBEncoding&&isVideoTexture===false?gl.SRGB8_ALPHA8:gl.RGBA8;if(glType===gl.UNSIGNED_SHORT_4_4_4_4)internalFormat=gl.RGBA4;if(glType===gl.UNSIGNED_SHORT_5_5_5_1)internalFormat=gl.RGB5_A1;}if(internalFormat===gl.R16F||internalFormat===gl.R32F||internalFormat===gl.RG16F||internalFormat===gl.RG32F||internalFormat===gl.RGBA16F||internalFormat===gl.RGBA32F){getExtension(gl,'EXT_color_buffer_float');}return internalFormat;}function filterFallback(gl,f){if(f===NearestFilter||f===NearestMipmapNearestFilter||f===NearestMipmapLinearFilter){return gl.NEAREST;}return gl.LINEAR;}function ensureImageSizePowerOfTwo$1(image){if(!isPowerOfTwo$1(image.width)||!isPowerOfTwo$1(image.height)){var _canvas3=document.createElement("canvas");_canvas3.width=nextHighestPowerOfTwo$1(image.width);_canvas3.height=nextHighestPowerOfTwo$1(image.height);var ctx=_canvas3.getContext("2d");ctx.drawImage(image,0,0,image.width,image.height,0,0,_canvas3.width,_canvas3.height);image=_canvas3;}return image;}function isPowerOfTwo$1(x){return(x&x-1)===0;}function nextHighestPowerOfTwo$1(x){--x;for(var _i128=1;_i128<32;_i128<<=1){x=x|x>>_i128;}return x+1;}/**
11648
- * @desc A 2D texture map.
11649
- *
11650
- * * Textures are attached to {@link Material}s, which are attached to {@link Mesh}es.
11651
- * * To create a Texture from an image file, set {@link Texture#src} to the image file path.
11652
- * * To create a Texture from an HTMLImageElement, set the Texture's {@link Texture#image} to the HTMLImageElement.
11653
- *
11654
- * ## Usage
11655
- *
11656
- * In this example we have a Mesh with a {@link PhongMaterial} which applies diffuse {@link Texture}, and a {@link buildTorusGeometry} which builds a {@link ReadableGeometry}.
11657
- *
11658
- * Note that xeokit will ignore {@link PhongMaterial#diffuse} and {@link PhongMaterial#specular}, since we override those
11659
- * with {@link PhongMaterial#diffuseMap} and {@link PhongMaterial#specularMap}. The {@link Texture} pixel colors directly
11660
- * provide the diffuse and specular components for each fragment across the {@link ReadableGeometry} surface.
11661
- *
11662
- * [[Run this example](/examples/#materials_Texture)]
11663
- *
11664
- * ```` javascript
11665
- * import {Viewer, Mesh, buildTorusGeometry,
11666
- * ReadableGeometry, PhongMaterial, Texture} from "xeokit-sdk.es.js";
11667
- *
11668
- * const viewer = new Viewer({
11669
- * canvasId: "myCanvas"
11670
- * });
11671
- *
11672
- * viewer.camera.eye = [0, 0, 5];
11673
- * viewer.camera.look = [0, 0, 0];
11674
- * viewer.camera.up = [0, 1, 0];
11675
- *
11676
- * new Mesh(viewer.scene, {
11677
- * geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry({
11678
- * center: [0, 0, 0],
11679
- * radius: 1.5,
11680
- * tube: 0.5,
11681
- * radialSegments: 32,
11682
- * tubeSegments: 24,
11683
- * arc: Math.PI * 2.0
11684
- * }),
11685
- * material: new PhongMaterial(viewer.scene, {
11686
- * ambient: [0.9, 0.3, 0.9],
11687
- * shininess: 30,
11688
- * diffuseMap: new Texture(viewer.scene, {
11689
- * src: "textures/diffuse/uvGrid2.jpg"
11690
- * })
11691
- * })
11692
- * });
11693
- *````
11694
- */var Texture=/*#__PURE__*/function(_Component23){/**
11695
- * @constructor
11696
- * @param {Component} owner Owner component. When destroyed, the owner will destroy this Texture as well.
11697
- * @param {*} [cfg] Configs
11698
- * @param {String} [cfg.id] Optional ID for this Texture, unique among all components in the parent scene, generated automatically when omitted.
11699
- * @param {String} [cfg.src=null] Path to image file to load into this Texture. See the {@link Texture#src} property for more info.
11700
- * @param {HTMLImageElement} [cfg.image=null] HTML Image object to load into this Texture. See the {@link Texture#image} property for more info.
11701
- * @param {Number} [cfg.minFilter=LinearMipmapLinearFilter] How the texture is sampled when a texel covers less than one pixel.
11702
- * Supported values are {@link LinearMipmapLinearFilter}, {@link LinearMipMapNearestFilter}, {@link NearestMipMapNearestFilter}, {@link NearestMipMapLinearFilter} and {@link LinearMipMapLinearFilter}.
11703
- * @param {Number} [cfg.magFilter=LinearFilter] How the texture is sampled when a texel covers more than one pixel. Supported values are {@link LinearFilter} and {@link NearestFilter}.
11704
- * @param {Number} [cfg.wrapS=RepeatWrapping] Wrap parameter for texture coordinate *S*. Supported values are {@link ClampToEdgeWrapping}, {@link MirroredRepeatWrapping} and {@link RepeatWrapping}.
11705
- * @param {Number} [cfg.wrapT=RepeatWrapping] Wrap parameter for texture coordinate *T*. Supported values are {@link ClampToEdgeWrapping}, {@link MirroredRepeatWrapping} and {@link RepeatWrapping}..
11706
- * @param {Boolean} [cfg.flipY=false] Flips this Texture's source data along its vertical axis when ````true````.
11707
- * @param {Number} [cfg.encoding=LinearEncoding] Encoding format. Supported values are {@link LinearEncoding} and {@link sRGBEncoding}.
11708
- * @param {Number[]} [cfg.translate=[0,0]] 2D translation vector that will be added to texture's *S* and *T* coordinates.
11709
- * @param {Number[]} [cfg.scale=[1,1]] 2D scaling vector that will be applied to texture's *S* and *T* coordinates.
11710
- * @param {Number} [cfg.rotate=0] Rotation, in degrees, that will be applied to texture's *S* and *T* coordinates.
11653
+ gl.bindTexture(this.target,null);}},{key:"setProps",value:function setProps(props){var gl=this.gl;gl.bindTexture(this.target,this.texture);this._uploadProps(props);gl.bindTexture(this.target,null);}},{key:"_uploadProps",value:function _uploadProps(props){var gl=this.gl;if(props.format!==undefined){this.format=props.format;}if(props.internalFormat!==undefined){this.internalFormat=props.internalFormat;}if(props.encoding!==undefined){this.encoding=props.encoding;}if(props.type!==undefined){this.type=props.type;}if(props.minFilter!==undefined){var minFilter=convertConstant(gl,props.minFilter);if(minFilter){this.minFilter=props.minFilter;gl.texParameteri(this.target,gl.TEXTURE_MIN_FILTER,minFilter);if(minFilter===gl.NEAREST_MIPMAP_NEAREST||minFilter===gl.LINEAR_MIPMAP_NEAREST||minFilter===gl.NEAREST_MIPMAP_LINEAR||minFilter===gl.LINEAR_MIPMAP_LINEAR){gl.generateMipmap(this.target);}}}if(props.magFilter!==undefined){var magFilter=convertConstant(gl,props.magFilter);if(magFilter){this.magFilter=props.magFilter;gl.texParameteri(this.target,gl.TEXTURE_MAG_FILTER,magFilter);}}if(props.wrapS!==undefined){var wrapS=convertConstant(gl,props.wrapS);if(wrapS){this.wrapS=props.wrapS;gl.texParameteri(this.target,gl.TEXTURE_WRAP_S,wrapS);}}if(props.wrapT!==undefined){var wrapT=convertConstant(gl,props.wrapT);if(wrapT){this.wrapT=props.wrapT;gl.texParameteri(this.target,gl.TEXTURE_WRAP_T,wrapT);}}}},{key:"bind",value:function bind(unit){if(!this.allocated){return;}if(this.texture){var _gl2=this.gl;_gl2.activeTexture(_gl2["TEXTURE"+unit]);_gl2.bindTexture(this.target,this.texture);return true;}return false;}},{key:"unbind",value:function unbind(unit){if(!this.allocated){return;}if(this.texture){var _gl3=this.gl;_gl3.activeTexture(_gl3["TEXTURE"+unit]);_gl3.bindTexture(this.target,null);}}},{key:"destroy",value:function destroy(){if(!this.allocated){return;}if(this.texture){this.gl.deleteTexture(this.texture);this.texture=null;}}}]);}();function getInternalFormat(gl,internalFormatName,glFormat,glType,encoding){var isVideoTexture=arguments.length>5&&arguments[5]!==undefined?arguments[5]:false;if(internalFormatName!==null){if(gl[internalFormatName]!==undefined){return gl[internalFormatName];}console.warn('Attempt to use non-existing WebGL internal format \''+internalFormatName+'\'');}var internalFormat=glFormat;if(glFormat===gl.RED){if(glType===gl.FLOAT)internalFormat=gl.R32F;if(glType===gl.HALF_FLOAT)internalFormat=gl.R16F;if(glType===gl.UNSIGNED_BYTE)internalFormat=gl.R8;}if(glFormat===gl.RG){if(glType===gl.FLOAT)internalFormat=gl.RG32F;if(glType===gl.HALF_FLOAT)internalFormat=gl.RG16F;if(glType===gl.UNSIGNED_BYTE)internalFormat=gl.RG8;}if(glFormat===gl.RGBA){if(glType===gl.FLOAT)internalFormat=gl.RGBA32F;if(glType===gl.HALF_FLOAT)internalFormat=gl.RGBA16F;if(glType===gl.UNSIGNED_BYTE)internalFormat=encoding===sRGBEncoding&&isVideoTexture===false?gl.SRGB8_ALPHA8:gl.RGBA8;if(glType===gl.UNSIGNED_SHORT_4_4_4_4)internalFormat=gl.RGBA4;if(glType===gl.UNSIGNED_SHORT_5_5_5_1)internalFormat=gl.RGB5_A1;}if(internalFormat===gl.R16F||internalFormat===gl.R32F||internalFormat===gl.RG16F||internalFormat===gl.RG32F||internalFormat===gl.RGBA16F||internalFormat===gl.RGBA32F){getExtension(gl,'EXT_color_buffer_float');}return internalFormat;}function filterFallback(gl,f){if(f===NearestFilter||f===NearestMipmapNearestFilter||f===NearestMipmapLinearFilter){return gl.NEAREST;}return gl.LINEAR;}function ensureImageSizePowerOfTwo$1(image){if(!isPowerOfTwo$1(image.width)||!isPowerOfTwo$1(image.height)){var _canvas3=document.createElement("canvas");_canvas3.width=nextHighestPowerOfTwo$1(image.width);_canvas3.height=nextHighestPowerOfTwo$1(image.height);var ctx=_canvas3.getContext("2d");ctx.drawImage(image,0,0,image.width,image.height,0,0,_canvas3.width,_canvas3.height);image=_canvas3;}return image;}function isPowerOfTwo$1(x){return(x&x-1)===0;}function nextHighestPowerOfTwo$1(x){--x;for(var _i128=1;_i128<32;_i128<<=1){x=x|x>>_i128;}return x+1;}/**
11654
+ * @desc A 2D texture map.
11655
+ *
11656
+ * * Textures are attached to {@link Material}s, which are attached to {@link Mesh}es.
11657
+ * * To create a Texture from an image file, set {@link Texture#src} to the image file path.
11658
+ * * To create a Texture from an HTMLImageElement, set the Texture's {@link Texture#image} to the HTMLImageElement.
11659
+ *
11660
+ * ## Usage
11661
+ *
11662
+ * In this example we have a Mesh with a {@link PhongMaterial} which applies diffuse {@link Texture}, and a {@link buildTorusGeometry} which builds a {@link ReadableGeometry}.
11663
+ *
11664
+ * Note that xeokit will ignore {@link PhongMaterial#diffuse} and {@link PhongMaterial#specular}, since we override those
11665
+ * with {@link PhongMaterial#diffuseMap} and {@link PhongMaterial#specularMap}. The {@link Texture} pixel colors directly
11666
+ * provide the diffuse and specular components for each fragment across the {@link ReadableGeometry} surface.
11667
+ *
11668
+ * [[Run this example](/examples/#materials_Texture)]
11669
+ *
11670
+ * ```` javascript
11671
+ * import {Viewer, Mesh, buildTorusGeometry,
11672
+ * ReadableGeometry, PhongMaterial, Texture} from "xeokit-sdk.es.js";
11673
+ *
11674
+ * const viewer = new Viewer({
11675
+ * canvasId: "myCanvas"
11676
+ * });
11677
+ *
11678
+ * viewer.camera.eye = [0, 0, 5];
11679
+ * viewer.camera.look = [0, 0, 0];
11680
+ * viewer.camera.up = [0, 1, 0];
11681
+ *
11682
+ * new Mesh(viewer.scene, {
11683
+ * geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry({
11684
+ * center: [0, 0, 0],
11685
+ * radius: 1.5,
11686
+ * tube: 0.5,
11687
+ * radialSegments: 32,
11688
+ * tubeSegments: 24,
11689
+ * arc: Math.PI * 2.0
11690
+ * }),
11691
+ * material: new PhongMaterial(viewer.scene, {
11692
+ * ambient: [0.9, 0.3, 0.9],
11693
+ * shininess: 30,
11694
+ * diffuseMap: new Texture(viewer.scene, {
11695
+ * src: "textures/diffuse/uvGrid2.jpg"
11696
+ * })
11697
+ * })
11698
+ * });
11699
+ *````
11700
+ */var Texture=/*#__PURE__*/function(_Component23){/**
11701
+ * @constructor
11702
+ * @param {Component} owner Owner component. When destroyed, the owner will destroy this Texture as well.
11703
+ * @param {*} [cfg] Configs
11704
+ * @param {String} [cfg.id] Optional ID for this Texture, unique among all components in the parent scene, generated automatically when omitted.
11705
+ * @param {String} [cfg.src=null] Path to image file to load into this Texture. See the {@link Texture#src} property for more info.
11706
+ * @param {HTMLImageElement} [cfg.image=null] HTML Image object to load into this Texture. See the {@link Texture#image} property for more info.
11707
+ * @param {Number} [cfg.minFilter=LinearMipmapLinearFilter] How the texture is sampled when a texel covers less than one pixel.
11708
+ * Supported values are {@link LinearMipmapLinearFilter}, {@link LinearMipMapNearestFilter}, {@link NearestMipMapNearestFilter}, {@link NearestMipMapLinearFilter} and {@link LinearMipMapLinearFilter}.
11709
+ * @param {Number} [cfg.magFilter=LinearFilter] How the texture is sampled when a texel covers more than one pixel. Supported values are {@link LinearFilter} and {@link NearestFilter}.
11710
+ * @param {Number} [cfg.wrapS=RepeatWrapping] Wrap parameter for texture coordinate *S*. Supported values are {@link ClampToEdgeWrapping}, {@link MirroredRepeatWrapping} and {@link RepeatWrapping}.
11711
+ * @param {Number} [cfg.wrapT=RepeatWrapping] Wrap parameter for texture coordinate *T*. Supported values are {@link ClampToEdgeWrapping}, {@link MirroredRepeatWrapping} and {@link RepeatWrapping}..
11712
+ * @param {Boolean} [cfg.flipY=false] Flips this Texture's source data along its vertical axis when ````true````.
11713
+ * @param {Number} [cfg.encoding=LinearEncoding] Encoding format. Supported values are {@link LinearEncoding} and {@link sRGBEncoding}.
11714
+ * @param {Number[]} [cfg.translate=[0,0]] 2D translation vector that will be added to texture's *S* and *T* coordinates.
11715
+ * @param {Number[]} [cfg.scale=[1,1]] 2D scaling vector that will be applied to texture's *S* and *T* coordinates.
11716
+ * @param {Number} [cfg.rotate=0] Rotation, in degrees, that will be applied to texture's *S* and *T* coordinates.
11711
11717
  */function Texture(owner){var _this59;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Texture);_this59=_callSuper(this,Texture,[owner,cfg]);_this59._state=new RenderState({texture:new Texture2D({gl:_this59.scene.canvas.gl}),matrix:math.identityMat4(),hasMatrix:cfg.translate&&(cfg.translate[0]!==0||cfg.translate[1]!==0)||!!cfg.rotate||cfg.scale&&(cfg.scale[0]!==0||cfg.scale[1]!==0),minFilter:_this59._checkMinFilter(cfg.minFilter||1008),magFilter:_this59._checkMagFilter(cfg.magFilter||1006),wrapS:_this59._checkWrapS(cfg.wrapS||1000),wrapT:_this59._checkWrapT(cfg.wrapT||1000),flipY:_this59._checkFlipY(cfg.flipY||1000),encoding:_this59._checkEncoding(cfg.encoding)});// Data source
11712
11718
  _this59._src=null;_this59._image=null;// Transformation
11713
11719
  _this59._translate=math.vec2([0,0]);_this59._scale=math.vec2([1,1]);_this59._rotate=math.vec2([0,0]);_this59._matrixDirty=false;// Transform
11714
11720
  _this59.translate=cfg.translate;_this59.scale=cfg.scale;_this59.rotate=cfg.rotate;// Data source
11715
11721
  if(cfg.src){_this59.src=cfg.src;// Image file
11716
11722
  }else if(cfg.image){_this59.image=cfg.image;// Image object
11717
- }stats.memory.textures++;return _this59;}_inherits(Texture,_Component23);return _createClass(Texture,[{key:"type",get:/**
11718
- @private
11719
- */function get(){return"Texture";}},{key:"_checkMinFilter",value:function _checkMinFilter(value){value=value||LinearMipMapLinearFilter;if(value!==LinearFilter&&value!==LinearMipMapNearestFilter&&value!==LinearMipMapLinearFilter&&value!==NearestMipMapLinearFilter&&value!==NearestMipMapNearestFilter){this.error("Unsupported value for 'minFilter' - supported values are LinearFilter, LinearMipMapNearestFilter, NearestMipMapNearestFilter, "+"NearestMipMapLinearFilter and LinearMipMapLinearFilter. Defaulting to LinearMipMapLinearFilter.");value=LinearMipMapLinearFilter;}return value;}},{key:"_checkMagFilter",value:function _checkMagFilter(value){value=value||LinearFilter;if(value!==LinearFilter&&value!==NearestFilter){this.error("Unsupported value for 'magFilter' - supported values are LinearFilter and NearestFilter. Defaulting to LinearFilter.");value=LinearFilter;}return value;}},{key:"_checkWrapS",value:function _checkWrapS(value){value=value||RepeatWrapping;if(value!==ClampToEdgeWrapping&&value!==MirroredRepeatWrapping&&value!==RepeatWrapping){this.error("Unsupported value for 'wrapS' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping.");value=RepeatWrapping;}return value;}},{key:"_checkWrapT",value:function _checkWrapT(value){value=value||RepeatWrapping;if(value!==ClampToEdgeWrapping&&value!==MirroredRepeatWrapping&&value!==RepeatWrapping){this.error("Unsupported value for 'wrapT' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping.");value=RepeatWrapping;}return value;}},{key:"_checkFlipY",value:function _checkFlipY(value){return!!value;}},{key:"_checkEncoding",value:function _checkEncoding(value){value=value||LinearEncoding;if(value!==LinearEncoding&&value!==sRGBEncoding){this.error("Unsupported value for 'encoding' - supported values are LinearEncoding and sRGBEncoding. Defaulting to LinearEncoding.");value=LinearEncoding;}return value;}},{key:"_webglContextRestored",value:function _webglContextRestored(){this._state.texture=new Texture2D({gl:this.scene.canvas.gl});if(this._image){this.image=this._image;}else if(this._src){this.src=this._src;}}},{key:"_update",value:function _update(){var state=this._state;if(this._matrixDirty){var _matrix;var t;if(this._translate[0]!==0||this._translate[1]!==0){_matrix=math.translationMat4v([this._translate[0],this._translate[1],0],this._state.matrix);}if(this._scale[0]!==1||this._scale[1]!==1){t=math.scalingMat4v([this._scale[0],this._scale[1],1]);_matrix=_matrix?math.mulMat4(_matrix,t):t;}if(this._rotate!==0){t=math.rotationMat4v(this._rotate*0.0174532925,[0,0,1]);_matrix=_matrix?math.mulMat4(_matrix,t):t;}if(_matrix){state.matrix=_matrix;}this._matrixDirty=false;}this.glRedraw();}/**
11720
- * Sets an HTML DOM Image object to source this Texture from.
11721
- *
11722
- * Sets {@link Texture#src} null.
11723
- *
11724
- * @type {HTMLImageElement}
11725
- */},{key:"image",get:/**
11726
- * Gets HTML DOM Image object this Texture is sourced from, if any.
11727
- *
11728
- * Returns null if not set.
11729
- *
11730
- * @type {HTMLImageElement}
11731
- */function get(){return this._image;}/**
11732
- * Sets path to an image file to source this Texture from.
11733
- *
11734
- * Sets {@link Texture#image} null.
11735
- *
11736
- * @type {String}
11737
- */,set:function set(value){this._image=ensureImageSizePowerOfTwo$1(value);this._image.crossOrigin="Anonymous";this._state.texture.setImage(this._image,this._state);this._src=null;this.glRedraw();}},{key:"src",get:/**
11738
- * Gets path to the image file this Texture from, if any.
11739
- *
11740
- * Returns null if not set.
11741
- *
11742
- * @type {String}
11743
- */function get(){return this._src;}/**
11744
- * Sets the 2D translation vector added to this Texture's *S* and *T* UV coordinates.
11745
- *
11746
- * Default value is ````[0, 0]````.
11747
- *
11748
- * @type {Number[]}
11749
- */,set:function set(src){this.scene.loading++;this.scene.canvas.spinner.processes++;var self=this;var image=new Image();image.onload=function(){image=ensureImageSizePowerOfTwo$1(image);self._state.texture.setImage(image,self._state);self.scene.loading--;self.glRedraw();self.scene.canvas.spinner.processes--;};image.src=src;this._src=src;this._image=null;}},{key:"translate",get:/**
11750
- * Gets the 2D translation vector added to this Texture's *S* and *T* UV coordinates.
11751
- *
11752
- * Default value is ````[0, 0]````.
11753
- *
11754
- * @type {Number[]}
11755
- */function get(){return this._translate;}/**
11756
- * Sets the 2D scaling vector that will be applied to this Texture's *S* and *T* UV coordinates.
11757
- *
11758
- * Default value is ````[1, 1]````.
11759
- *
11760
- * @type {Number[]}
11761
- */,set:function set(value){this._translate.set(value||[0,0]);this._matrixDirty=true;this._needUpdate();}},{key:"scale",get:/**
11762
- * Gets the 2D scaling vector that will be applied to this Texture's *S* and *T* UV coordinates.
11763
- *
11764
- * Default value is ````[1, 1]````.
11765
- *
11766
- * @type {Number[]}
11767
- */function get(){return this._scale;}/**
11768
- * Sets the rotation angles, in degrees, that will be applied to this Texture's *S* and *T* UV coordinates.
11769
- *
11770
- * Default value is ````0````.
11771
- *
11772
- * @type {Number}
11773
- */,set:function set(value){this._scale.set(value||[1,1]);this._matrixDirty=true;this._needUpdate();}},{key:"rotate",get:/**
11774
- * Gets the rotation angles, in degrees, that will be applied to this Texture's *S* and *T* UV coordinates.
11775
- *
11776
- * Default value is ````0````.
11777
- *
11778
- * @type {Number}
11779
- */function get(){return this._rotate;}/**
11780
- * Gets how this Texture is sampled when a texel covers less than one pixel.
11781
- *
11782
- * Options are:
11783
- *
11784
- * * NearestFilter - Uses the value of the texture element that is nearest
11785
- * (in Manhattan distance) to the center of the pixel being textured.
11786
- *
11787
- * * LinearFilter - Uses the weighted average of the four texture elements that are
11788
- * closest to the center of the pixel being textured.
11789
- *
11790
- * * NearestMipMapNearestFilter - Chooses the mipmap that most closely matches the
11791
- * size of the pixel being textured and uses the "nearest" criterion (the texture
11792
- * element nearest to the center of the pixel) to produce a texture value.
11793
- *
11794
- * * LinearMipMapNearestFilter - Chooses the mipmap that most closely matches the size of
11795
- * the pixel being textured and uses the "linear" criterion (a weighted average of the
11796
- * four texture elements that are closest to the center of the pixel) to produce a
11797
- * texture value.
11798
- *
11799
- * * NearestMipMapLinearFilter - Chooses the two mipmaps that most closely
11800
- * match the size of the pixel being textured and uses the "nearest" criterion
11801
- * (the texture element nearest to the center of the pixel) to produce a texture
11802
- * value from each mipmap. The final texture value is a weighted average of those two
11803
- * values.
11804
- *
11805
- * * LinearMipMapLinearFilter - (default) - Chooses the two mipmaps that most closely match the size
11806
- * of the pixel being textured and uses the "linear" criterion (a weighted average
11807
- * of the four texture elements that are closest to the center of the pixel) to
11808
- * produce a texture value from each mipmap. The final texture value is a weighted
11809
- * average of those two values.
11810
- *
11811
- * Default value is LinearMipMapLinearFilter.
11812
- *
11813
- * @type {Number}
11814
- */,set:function set(value){value=value||0;if(this._rotate===value){return;}this._rotate=value;this._matrixDirty=true;this._needUpdate();}},{key:"minFilter",get:function get(){return this._state.minFilter;}/**
11815
- * Gets how this Texture is sampled when a texel covers more than one pixel.
11816
- *
11817
- * * NearestFilter - Uses the value of the texture element that is nearest
11818
- * (in Manhattan distance) to the center of the pixel being textured.
11819
- * * LinearFilter - (default) - Uses the weighted average of the four texture elements that are
11820
- * closest to the center of the pixel being textured.
11821
- *
11822
- * Default value is LinearMipMapLinearFilter.
11823
- *
11824
- * @type {Number}
11825
- */},{key:"magFilter",get:function get(){return this._state.magFilter;}/**
11826
- * Gets the wrap parameter for this Texture's *S* coordinate.
11827
- *
11828
- * Values can be:
11829
- *
11830
- * * ClampToEdgeWrapping - causes *S* coordinates to be clamped to the size of the texture.
11831
- * * MirroredRepeatWrapping - causes the *S* coordinate to be set to the fractional part of the texture coordinate
11832
- * if the integer part of *S* is even; if the integer part of *S* is odd, then the *S* texture coordinate is
11833
- * set to *1 - frac ⁡ S* , where *frac ⁡ S* represents the fractional part of *S*.
11834
- * * RepeatWrapping - (default) - causes the integer part of the *S* coordinate to be ignored; xeokit uses only the
11835
- * fractional part, thereby creating a repeating pattern.
11836
- *
11837
- * Default value is RepeatWrapping.
11838
- *
11839
- * @type {Number}
11840
- */},{key:"wrapS",get:function get(){return this._state.wrapS;}/**
11841
- * Gets the wrap parameter for this Texture's *T* coordinate.
11842
- *
11843
- * Values can be:
11844
- *
11845
- * * ClampToEdgeWrapping - causes *S* coordinates to be clamped to the size of the texture.
11846
- * * MirroredRepeatWrapping - causes the *S* coordinate to be set to the fractional part of the texture coordinate
11847
- * if the integer part of *S* is even; if the integer part of *S* is odd, then the *S* texture coordinate is
11848
- * set to *1 - frac ⁡ S* , where *frac ⁡ S* represents the fractional part of *S*.
11849
- * * RepeatWrapping - (default) - causes the integer part of the *S* coordinate to be ignored; xeokit uses only the
11850
- * fractional part, thereby creating a repeating pattern.
11851
- *
11852
- * Default value is RepeatWrapping.
11853
- *
11854
- * @type {Number}
11855
- */},{key:"wrapT",get:function get(){return this._state.wrapT;}/**
11856
- * Gets if this Texture's source data is flipped along its vertical axis.
11857
- *
11858
- * @type {Number}
11859
- */},{key:"flipY",get:function get(){return this._state.flipY;}/**
11860
- * Gets the Texture's encoding format.
11861
- *
11862
- * @type {Number}
11863
- */},{key:"encoding",get:function get(){return this._state.encoding;}/**
11864
- * Destroys this Texture
11723
+ }stats.memory.textures++;return _this59;}_inherits(Texture,_Component23);return _createClass(Texture,[{key:"type",get:/**
11724
+ @private
11725
+ */function get(){return"Texture";}},{key:"_checkMinFilter",value:function _checkMinFilter(value){value=value||LinearMipMapLinearFilter;if(value!==LinearFilter&&value!==LinearMipMapNearestFilter&&value!==LinearMipMapLinearFilter&&value!==NearestMipMapLinearFilter&&value!==NearestMipMapNearestFilter){this.error("Unsupported value for 'minFilter' - supported values are LinearFilter, LinearMipMapNearestFilter, NearestMipMapNearestFilter, "+"NearestMipMapLinearFilter and LinearMipMapLinearFilter. Defaulting to LinearMipMapLinearFilter.");value=LinearMipMapLinearFilter;}return value;}},{key:"_checkMagFilter",value:function _checkMagFilter(value){value=value||LinearFilter;if(value!==LinearFilter&&value!==NearestFilter){this.error("Unsupported value for 'magFilter' - supported values are LinearFilter and NearestFilter. Defaulting to LinearFilter.");value=LinearFilter;}return value;}},{key:"_checkWrapS",value:function _checkWrapS(value){value=value||RepeatWrapping;if(value!==ClampToEdgeWrapping&&value!==MirroredRepeatWrapping&&value!==RepeatWrapping){this.error("Unsupported value for 'wrapS' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping.");value=RepeatWrapping;}return value;}},{key:"_checkWrapT",value:function _checkWrapT(value){value=value||RepeatWrapping;if(value!==ClampToEdgeWrapping&&value!==MirroredRepeatWrapping&&value!==RepeatWrapping){this.error("Unsupported value for 'wrapT' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping.");value=RepeatWrapping;}return value;}},{key:"_checkFlipY",value:function _checkFlipY(value){return!!value;}},{key:"_checkEncoding",value:function _checkEncoding(value){value=value||LinearEncoding;if(value!==LinearEncoding&&value!==sRGBEncoding){this.error("Unsupported value for 'encoding' - supported values are LinearEncoding and sRGBEncoding. Defaulting to LinearEncoding.");value=LinearEncoding;}return value;}},{key:"_webglContextRestored",value:function _webglContextRestored(){this._state.texture=new Texture2D({gl:this.scene.canvas.gl});if(this._image){this.image=this._image;}else if(this._src){this.src=this._src;}}},{key:"_update",value:function _update(){var state=this._state;if(this._matrixDirty){var _matrix;var t;if(this._translate[0]!==0||this._translate[1]!==0){_matrix=math.translationMat4v([this._translate[0],this._translate[1],0],this._state.matrix);}if(this._scale[0]!==1||this._scale[1]!==1){t=math.scalingMat4v([this._scale[0],this._scale[1],1]);_matrix=_matrix?math.mulMat4(_matrix,t):t;}if(this._rotate!==0){t=math.rotationMat4v(this._rotate*0.0174532925,[0,0,1]);_matrix=_matrix?math.mulMat4(_matrix,t):t;}if(_matrix){state.matrix=_matrix;}this._matrixDirty=false;}this.glRedraw();}/**
11726
+ * Sets an HTML DOM Image object to source this Texture from.
11727
+ *
11728
+ * Sets {@link Texture#src} null.
11729
+ *
11730
+ * @type {HTMLImageElement}
11731
+ */},{key:"image",get:/**
11732
+ * Gets HTML DOM Image object this Texture is sourced from, if any.
11733
+ *
11734
+ * Returns null if not set.
11735
+ *
11736
+ * @type {HTMLImageElement}
11737
+ */function get(){return this._image;}/**
11738
+ * Sets path to an image file to source this Texture from.
11739
+ *
11740
+ * Sets {@link Texture#image} null.
11741
+ *
11742
+ * @type {String}
11743
+ */,set:function set(value){this._image=ensureImageSizePowerOfTwo$1(value);this._image.crossOrigin="Anonymous";this._state.texture.setImage(this._image,this._state);this._src=null;this.glRedraw();}},{key:"src",get:/**
11744
+ * Gets path to the image file this Texture from, if any.
11745
+ *
11746
+ * Returns null if not set.
11747
+ *
11748
+ * @type {String}
11749
+ */function get(){return this._src;}/**
11750
+ * Sets the 2D translation vector added to this Texture's *S* and *T* UV coordinates.
11751
+ *
11752
+ * Default value is ````[0, 0]````.
11753
+ *
11754
+ * @type {Number[]}
11755
+ */,set:function set(src){this.scene.loading++;this.scene.canvas.spinner.processes++;var self=this;var image=new Image();image.onload=function(){image=ensureImageSizePowerOfTwo$1(image);self._state.texture.setImage(image,self._state);self.scene.loading--;self.glRedraw();self.scene.canvas.spinner.processes--;};image.src=src;this._src=src;this._image=null;}},{key:"translate",get:/**
11756
+ * Gets the 2D translation vector added to this Texture's *S* and *T* UV coordinates.
11757
+ *
11758
+ * Default value is ````[0, 0]````.
11759
+ *
11760
+ * @type {Number[]}
11761
+ */function get(){return this._translate;}/**
11762
+ * Sets the 2D scaling vector that will be applied to this Texture's *S* and *T* UV coordinates.
11763
+ *
11764
+ * Default value is ````[1, 1]````.
11765
+ *
11766
+ * @type {Number[]}
11767
+ */,set:function set(value){this._translate.set(value||[0,0]);this._matrixDirty=true;this._needUpdate();}},{key:"scale",get:/**
11768
+ * Gets the 2D scaling vector that will be applied to this Texture's *S* and *T* UV coordinates.
11769
+ *
11770
+ * Default value is ````[1, 1]````.
11771
+ *
11772
+ * @type {Number[]}
11773
+ */function get(){return this._scale;}/**
11774
+ * Sets the rotation angles, in degrees, that will be applied to this Texture's *S* and *T* UV coordinates.
11775
+ *
11776
+ * Default value is ````0````.
11777
+ *
11778
+ * @type {Number}
11779
+ */,set:function set(value){this._scale.set(value||[1,1]);this._matrixDirty=true;this._needUpdate();}},{key:"rotate",get:/**
11780
+ * Gets the rotation angles, in degrees, that will be applied to this Texture's *S* and *T* UV coordinates.
11781
+ *
11782
+ * Default value is ````0````.
11783
+ *
11784
+ * @type {Number}
11785
+ */function get(){return this._rotate;}/**
11786
+ * Gets how this Texture is sampled when a texel covers less than one pixel.
11787
+ *
11788
+ * Options are:
11789
+ *
11790
+ * * NearestFilter - Uses the value of the texture element that is nearest
11791
+ * (in Manhattan distance) to the center of the pixel being textured.
11792
+ *
11793
+ * * LinearFilter - Uses the weighted average of the four texture elements that are
11794
+ * closest to the center of the pixel being textured.
11795
+ *
11796
+ * * NearestMipMapNearestFilter - Chooses the mipmap that most closely matches the
11797
+ * size of the pixel being textured and uses the "nearest" criterion (the texture
11798
+ * element nearest to the center of the pixel) to produce a texture value.
11799
+ *
11800
+ * * LinearMipMapNearestFilter - Chooses the mipmap that most closely matches the size of
11801
+ * the pixel being textured and uses the "linear" criterion (a weighted average of the
11802
+ * four texture elements that are closest to the center of the pixel) to produce a
11803
+ * texture value.
11804
+ *
11805
+ * * NearestMipMapLinearFilter - Chooses the two mipmaps that most closely
11806
+ * match the size of the pixel being textured and uses the "nearest" criterion
11807
+ * (the texture element nearest to the center of the pixel) to produce a texture
11808
+ * value from each mipmap. The final texture value is a weighted average of those two
11809
+ * values.
11810
+ *
11811
+ * * LinearMipMapLinearFilter - (default) - Chooses the two mipmaps that most closely match the size
11812
+ * of the pixel being textured and uses the "linear" criterion (a weighted average
11813
+ * of the four texture elements that are closest to the center of the pixel) to
11814
+ * produce a texture value from each mipmap. The final texture value is a weighted
11815
+ * average of those two values.
11816
+ *
11817
+ * Default value is LinearMipMapLinearFilter.
11818
+ *
11819
+ * @type {Number}
11820
+ */,set:function set(value){value=value||0;if(this._rotate===value){return;}this._rotate=value;this._matrixDirty=true;this._needUpdate();}},{key:"minFilter",get:function get(){return this._state.minFilter;}/**
11821
+ * Gets how this Texture is sampled when a texel covers more than one pixel.
11822
+ *
11823
+ * * NearestFilter - Uses the value of the texture element that is nearest
11824
+ * (in Manhattan distance) to the center of the pixel being textured.
11825
+ * * LinearFilter - (default) - Uses the weighted average of the four texture elements that are
11826
+ * closest to the center of the pixel being textured.
11827
+ *
11828
+ * Default value is LinearMipMapLinearFilter.
11829
+ *
11830
+ * @type {Number}
11831
+ */},{key:"magFilter",get:function get(){return this._state.magFilter;}/**
11832
+ * Gets the wrap parameter for this Texture's *S* coordinate.
11833
+ *
11834
+ * Values can be:
11835
+ *
11836
+ * * ClampToEdgeWrapping - causes *S* coordinates to be clamped to the size of the texture.
11837
+ * * MirroredRepeatWrapping - causes the *S* coordinate to be set to the fractional part of the texture coordinate
11838
+ * if the integer part of *S* is even; if the integer part of *S* is odd, then the *S* texture coordinate is
11839
+ * set to *1 - frac ⁡ S* , where *frac ⁡ S* represents the fractional part of *S*.
11840
+ * * RepeatWrapping - (default) - causes the integer part of the *S* coordinate to be ignored; xeokit uses only the
11841
+ * fractional part, thereby creating a repeating pattern.
11842
+ *
11843
+ * Default value is RepeatWrapping.
11844
+ *
11845
+ * @type {Number}
11846
+ */},{key:"wrapS",get:function get(){return this._state.wrapS;}/**
11847
+ * Gets the wrap parameter for this Texture's *T* coordinate.
11848
+ *
11849
+ * Values can be:
11850
+ *
11851
+ * * ClampToEdgeWrapping - causes *S* coordinates to be clamped to the size of the texture.
11852
+ * * MirroredRepeatWrapping - causes the *S* coordinate to be set to the fractional part of the texture coordinate
11853
+ * if the integer part of *S* is even; if the integer part of *S* is odd, then the *S* texture coordinate is
11854
+ * set to *1 - frac ⁡ S* , where *frac ⁡ S* represents the fractional part of *S*.
11855
+ * * RepeatWrapping - (default) - causes the integer part of the *S* coordinate to be ignored; xeokit uses only the
11856
+ * fractional part, thereby creating a repeating pattern.
11857
+ *
11858
+ * Default value is RepeatWrapping.
11859
+ *
11860
+ * @type {Number}
11861
+ */},{key:"wrapT",get:function get(){return this._state.wrapT;}/**
11862
+ * Gets if this Texture's source data is flipped along its vertical axis.
11863
+ *
11864
+ * @type {Number}
11865
+ */},{key:"flipY",get:function get(){return this._state.flipY;}/**
11866
+ * Gets the Texture's encoding format.
11867
+ *
11868
+ * @type {Number}
11869
+ */},{key:"encoding",get:function get(){return this._state.encoding;}/**
11870
+ * Destroys this Texture
11865
11871
  */},{key:"destroy",value:function destroy(){_superPropGet(Texture,"destroy",this,3)([]);if(this._state.texture){this._state.texture.destroy();}this._state.destroy();stats.memory.textures--;}}]);}(Component);/**
11866
11872
  * @desc Creates a cylinder-shaped {@link Geometry}.
11867
11873
  *
@@ -13529,7 +13535,7 @@ this.setVisible(cfg.overviewVisible);}/** Called by SectionPlanesPlugin#createSe
13529
13535
  * @param {String} [cfg.id="SectionPlanes"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
13530
13536
  * @param {String} [cfg.overviewCanvasId] ID of a canvas element to display the overview.
13531
13537
  * @param {String} [cfg.overviewVisible=true] Initial visibility of the overview canvas.
13532
- */function SectionPlanesPlugin(viewer){var _this73;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SectionPlanesPlugin);_this73=_callSuper(this,SectionPlanesPlugin,["SectionPlanes",viewer]);_this73._freeControls=[];_this73._sectionPlanes=viewer.scene.sectionPlanes;_this73._controls={};_this73._currentControl=null;_this73._shownControlId=null;if(cfg.overviewCanvasId!==null&&cfg.overviewCanvasId!==undefined){var overviewCanvas=document.getElementById(cfg.overviewCanvasId);if(!overviewCanvas){_this73.warn("Can't find overview canvas: '"+cfg.overviewCanvasId+"' - will create plugin without overview");}else{_this73._overview=new Overview(_this73,{overviewCanvas:overviewCanvas,visible:cfg.overviewVisible,onHoverEnterPlane:function onHoverEnterPlane(id){_this73._overview.setPlaneHighlighted(id,true);},onHoverLeavePlane:function onHoverLeavePlane(id){_this73._overview.setPlaneHighlighted(id,false);},onClickedPlane:function onClickedPlane(id){if(_this73.getShownControl()===id){_this73.hideControl();return;}_this73.showControl(id);var sectionPlane=_this73.sectionPlanes[id];var sectionPlanePos=sectionPlane.pos;tempAABB$1.set(_this73.viewer.scene.aabb);math.getAABB3Center(tempAABB$1,tempVec3$3);tempAABB$1[0]+=sectionPlanePos[0]-tempVec3$3[0];tempAABB$1[1]+=sectionPlanePos[1]-tempVec3$3[1];tempAABB$1[2]+=sectionPlanePos[2]-tempVec3$3[2];tempAABB$1[3]+=sectionPlanePos[0]-tempVec3$3[0];tempAABB$1[4]+=sectionPlanePos[1]-tempVec3$3[1];tempAABB$1[5]+=sectionPlanePos[2]-tempVec3$3[2];_this73.viewer.cameraFlight.flyTo({aabb:tempAABB$1,fitFOV:65});},onClickedNothing:function onClickedNothing(){_this73.hideControl();}});}}_this73._onSceneSectionPlaneCreated=viewer.scene.on("sectionPlaneCreated",function(sectionPlane){// SectionPlane created, either via SectionPlanesPlugin#createSectionPlane(), or by directly
13538
+ */function SectionPlanesPlugin(viewer){var _this73;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SectionPlanesPlugin);_this73=_callSuper(this,SectionPlanesPlugin,["SectionPlanes",viewer]);_this73._freeControls=[];_this73._sectionPlanes=viewer.scene.sectionPlanes;_this73._controls={};_this73._currentControl=null;_this73._shownControlId=null;_this73._shownControlIds=[];if(cfg.overviewCanvasId!==null&&cfg.overviewCanvasId!==undefined){var overviewCanvas=document.getElementById(cfg.overviewCanvasId);if(!overviewCanvas){_this73.warn("Can't find overview canvas: '"+cfg.overviewCanvasId+"' - will create plugin without overview");}else{_this73._overview=new Overview(_this73,{overviewCanvas:overviewCanvas,visible:cfg.overviewVisible,onHoverEnterPlane:function onHoverEnterPlane(id){_this73._overview.setPlaneHighlighted(id,true);},onHoverLeavePlane:function onHoverLeavePlane(id){_this73._overview.setPlaneHighlighted(id,false);},onClickedPlane:function onClickedPlane(id){if(_this73.getShownControl()===id){_this73.hideControl();return;}_this73.showControl(id);var sectionPlane=_this73.sectionPlanes[id];var sectionPlanePos=sectionPlane.pos;tempAABB$1.set(_this73.viewer.scene.aabb);math.getAABB3Center(tempAABB$1,tempVec3$3);tempAABB$1[0]+=sectionPlanePos[0]-tempVec3$3[0];tempAABB$1[1]+=sectionPlanePos[1]-tempVec3$3[1];tempAABB$1[2]+=sectionPlanePos[2]-tempVec3$3[2];tempAABB$1[3]+=sectionPlanePos[0]-tempVec3$3[0];tempAABB$1[4]+=sectionPlanePos[1]-tempVec3$3[1];tempAABB$1[5]+=sectionPlanePos[2]-tempVec3$3[2];_this73.viewer.cameraFlight.flyTo({aabb:tempAABB$1,fitFOV:65});},onClickedNothing:function onClickedNothing(){_this73.hideControl();}});}}_this73._onSceneSectionPlaneCreated=viewer.scene.on("sectionPlaneCreated",function(sectionPlane){// SectionPlane created, either via SectionPlanesPlugin#createSectionPlane(), or by directly
13533
13539
  // instantiating a SectionPlane independently of SectionPlanesPlugin, which can be done
13534
13540
  // by BCFViewpointsPlugin#loadViewpoint().
13535
13541
  _this73._sectionPlaneCreated(sectionPlane);});_this73._onSceneSectionBoxCreated=viewer.scene.on("sectionBoxCreated",function(sectionBox){_this73._sectionBoxCreated(sectionBox);});return _this73;}/**
@@ -13558,7 +13564,7 @@ _this73._sectionPlaneCreated(sectionPlane);});_this73._onSceneSectionBoxCreated=
13558
13564
  */},{key:"createSectionPlane",value:function createSectionPlane(){var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id!==undefined&&params.id!==null&&this.viewer.scene.components[params.id]){this.error("Viewer component with this ID already exists: "+params.id);delete params.id;}// Note that SectionPlane constructor fires "sectionPlaneCreated" on the Scene,
13559
13565
  // which SectionPlanesPlugin handles and calls #_sectionPlaneCreated to create gizmo and add to overview canvas.
13560
13566
  var sectionPlane=new SectionPlane(this.viewer.scene,{id:params.id,pos:params.pos,dir:params.dir,active:true});return sectionPlane;}//剖切面创建后,创建一个控制器
13561
- },{key:"_sectionPlaneCreated",value:function _sectionPlaneCreated(sectionPlane){var _this74=this;var newControl;switch(this._sectionWay){case"plane":newControl=new ClippingPlane(this,this._controlsConfig);break;default:newControl=new Control$1(this);break;}var control=this._freeControls.length>0?this._freeControls.pop():newControl;control._setSectionPlane(sectionPlane);control.setVisible(true);this._currentControl=control;this._controls[sectionPlane.id]=control;if(this._overview){this._overview.addSectionPlane(sectionPlane);}sectionPlane.once("destroyed",function(){_this74._sectionPlaneDestroyed(sectionPlane);});}//剖切盒创建后,创建一个控制器
13567
+ },{key:"_sectionPlaneCreated",value:function _sectionPlaneCreated(sectionPlane){var _this74=this;var newControl;switch(this._sectionWay){case"plane":newControl=new ClippingPlane(this,this._controlsConfig);break;default:newControl=new Control$1(this);break;}var control=this._freeControls.length>0?this._freeControls.pop():newControl;control._setSectionPlane(sectionPlane);control.setVisible(true);sectionPlane.control=control;this._currentControl=control;this._controls[sectionPlane.id]=control;if(this._overview){this._overview.addSectionPlane(sectionPlane);}sectionPlane.once("destroyed",function(){_this74._sectionPlaneDestroyed(sectionPlane);});}//剖切盒创建后,创建一个控制器
13562
13568
  },{key:"_sectionBoxCreated",value:function _sectionBoxCreated(sectionBox){var _this75=this;var newControl;newControl=new ClippingBox(this,this._controlsConfig);var control=this._freeControls.length>0?this._freeControls.pop():newControl;control._setSectionBox(sectionBox);control.setVisible(true);this._currentControl=control;this._controls[sectionBox.id]=control;if(this._overview){this._overview.setSectionBox(sectionBox);}sectionBox.once("destroyed",function(){_this75._sectionPlaneDestroyed(sectionBox);});}/**
13563
13569
  * 设置是否是触屏模式
13564
13570
  * @param {boolean} touch
@@ -13591,7 +13597,7 @@ var sectionPlane=new SectionPlane(this.viewer.scene,{id:params.id,pos:params.pos
13591
13597
  * Shows the 3D editing gizmo for a {@link SectionPlane}.
13592
13598
  *
13593
13599
  * @param {String} id ID of the {@link SectionPlane}.
13594
- */},{key:"showControl",value:function showControl(id){var control=this._controls[id];if(!control){this.error("Control not found: "+id);return;}this.hideControl();control.setVisible(true);if(this._overview){this._overview.setPlaneSelected(id,true);}this._shownControlId=id;}/**
13600
+ */},{key:"showControl",value:function showControl(id){var control=this._controls[id];if(!control){this.error("Control not found: "+id);return;}control.setVisible(true);if(this._overview){this._overview.setPlaneSelected(id,true);}this._shownControlId=id;this._shownControlIds=[id];}/**
13595
13601
  * 设置剖切对象的尺寸
13596
13602
  * @param {*} size
13597
13603
  */},{key:"setControlsSize",value:function setControlsSize(size){for(var id in this._controls){this._controls[id].controlSize=size;}}/**
@@ -13605,13 +13611,13 @@ var sectionPlane=new SectionPlane(this.viewer.scene,{id:params.id,pos:params.pos
13605
13611
  * Returns ````null```` when the editing gizmo is not shown.
13606
13612
  *
13607
13613
  * @returns {String} ID of the the {@link SectionPlane} that the 3D editing gizmo is shown for, if shown, else ````null````.
13608
- */},{key:"getShownControl",value:function getShownControl(){return this._shownControlId;}/**
13614
+ */},{key:"getShownControl",value:function getShownControl(){return this._shownControlId;}},{key:"getShownControls",value:function getShownControls(){return this._shownControlIds;}},{key:"showAllControl",value:function showAllControl(){for(var id in this._controls){if(this._controls.hasOwnProperty(id)){this._shownControlIds.push(id);this._controls[id].setVisible(false);if(this._overview){this._overview.setPlaneSelected(id,false);}}}}/**
13609
13615
  * Hides the 3D {@link SectionPlane} editing gizmo if shown.
13610
- */},{key:"hideControl",value:function hideControl(){for(var id in this._controls){if(this._controls.hasOwnProperty(id)){this._controls[id].setVisible(false);if(this._overview){this._overview.setPlaneSelected(id,false);}}}this._shownControlId=null;}/**
13616
+ */},{key:"hideControl",value:function hideControl(){for(var id in this._controls){if(this._controls.hasOwnProperty(id)){this._controls[id].setVisible(false);if(this._overview){this._overview.setPlaneSelected(id,false);}}}this._shownControlId=null;this._shownControlIds=[];}/**
13611
13617
  * Destroys a {@link SectionPlane} created by this SectionPlanesPlugin.
13612
13618
  *
13613
13619
  * @param {String} id ID of the {@link SectionPlane}.
13614
- */},{key:"destroySectionPlane",value:function destroySectionPlane(id){var sectionPlane=this.viewer.scene.sectionPlanes[id];if(!sectionPlane){this.error("SectionPlane not found: "+id);return;}this._sectionPlaneDestroyed(sectionPlane);sectionPlane.destroy();if(id===this._shownControlId){this._shownControlId=null;}}},{key:"_sectionPlaneDestroyed",value:function _sectionPlaneDestroyed(sectionPlane){if(this._overview){this._overview.removeSectionPlane(sectionPlane);}var control=this._controls[sectionPlane.id];if(!control){return;}control.setVisible(false);control._setSectionPlane(null);delete this._controls[sectionPlane.id];this._freeControls.push(control);}/**
13620
+ */},{key:"destroySectionPlane",value:function destroySectionPlane(id){var sectionPlane=this.viewer.scene.sectionPlanes[id];if(!sectionPlane){this.error("SectionPlane not found: "+id);return;}this._sectionPlaneDestroyed(sectionPlane);sectionPlane.destroy();if(id===this._shownControlId){this._shownControlId=null;this._shownControlIds=[];}}},{key:"_sectionPlaneDestroyed",value:function _sectionPlaneDestroyed(sectionPlane){if(this._overview){this._overview.removeSectionPlane(sectionPlane);}var control=this._controls[sectionPlane.id];if(!control){return;}control.setVisible(false);control._setSectionPlane(null);delete this._controls[sectionPlane.id];this._freeControls.push(control);}/**
13615
13621
  * Destroys all {@link SectionPlane}s created by this SectionPlanesPlugin.
13616
13622
  */},{key:"clear",value:function clear(){var ids=Object.keys(this._sectionPlanes);for(var i=0,len=ids.length;i<len;i++){this.destroySectionPlane(ids[i]);}}/**
13617
13623
  * @private
@@ -14206,7 +14212,7 @@ primitive:"triangles",positions:[1,1,1,-1,1,1,-1,-1,1,1,-1,1,// v0-v1-v2-v3 fron
14206
14212
  -1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,// v7-v4-v3-v2 bottom
14207
14213
  1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1// v4-v7-v6-v5 back
14208
14214
  ],uv:[0.5,0.6666,0.25,0.6666,0.25,0.3333,0.5,0.3333,0.5,0.6666,0.5,0.3333,0.75,0.3333,0.75,0.6666,0.5,0.6666,0.5,1,0.25,1,0.25,0.6666,0.25,0.6666,0.0,0.6666,0.0,0.3333,0.25,0.3333,0.25,0,0.5,0,0.5,0.3333,0.25,0.3333,0.75,0.3333,1.0,0.3333,1.0,0.6666,0.75,0.6666],indices:[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]}),background:true,scale:[2000,2000,2000],// Overridden when we initialize the 'size' property, below
14209
- rotation:[0,-90,0],material:new PhongMaterial(_this78,{ambient:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],emissive:[1,1,1],emissiveMap:new Texture(_this78,{scale:cfg.scale,src:cfg.src,flipY:true,wrapS:1000,wrapT:1000,encoding:cfg.encoding||"sRGB"}),backfaces:true// Show interior faces of our skybox geometry
14215
+ rotation:[0,-90,0],material:new PhongMaterial(_this78,{ambient:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],emissive:[1,1,1],emissiveMap:new Texture(_this78,{scale:cfg.scale,src:cfg.src,image:cfg.image,flipY:true,wrapS:1000,wrapT:1000,encoding:cfg.encoding||"sRGB"}),backfaces:true// Show interior faces of our skybox geometry
14210
14216
  }),// stationary: true,
14211
14217
  visible:false,pickable:false,clippable:false,collidable:false});_this78.size=cfg.size;// Sets 'xyz' property on the Mesh's Scale transform
14212
14218
  _this78.active=cfg.active;return _this78;}/**
@@ -14296,18 +14302,18 @@ _this78.active=cfg.active;return _this78;}/**
14296
14302
  @param {Object} params Skybox configuration.
14297
14303
  @param {Boolean} [params.active=true] Whether the skybox plane is initially active. Only skyboxes while this is true.
14298
14304
  @returns {Skybox} The new skybox.
14299
- */},{key:"createSkybox",value:function createSkybox(id,params){if(this.viewer.scene.components[id]){this.error("Component with this ID already exists: "+id);return this;}var skybox=new Skybox(this.viewer.scene,{id:id,size:params.size,scale:params.scale,src:params.src,active:params.active,encoding:3000});this.skyboxes[id]=skybox;return skybox;}},{key:"setSkyBoxActiveById",value:function setSkyBoxActiveById(id,active){this.skyboxes[id].active=active;}/**
14305
+ */},{key:"createSkybox",value:function createSkybox(id,params){if(this.viewer.scene.components[id]){this.error("Component with this ID already exists: "+id);return this;}if(!params.src&&!params.image){this.error("No legal skybox image or src: "+id);return this;}if(params.src){var skybox=new Skybox(this.viewer.scene,{id:id,size:params.size,scale:params.scale,src:params.src,active:params.active,encoding:3000});this.skyboxes[id]=skybox;return skybox;}else if(params.image){var skybox=new Skybox(this.viewer.scene,{id:id,size:params.size,scale:params.scale,image:params.image,active:params.active,encoding:3000});this.skyboxes[id]=skybox;return skybox;}}},{key:"setSkyBoxActiveById",value:function setSkyBoxActiveById(id,active){this.skyboxes[id].active=active;}/**
14300
14306
  * 设置开启天空盒
14301
14307
  */},{key:"active",get:function get(){return this._active;},set:function set(active){this._active=active;for(var _i158=0;_i158<this.skyboxes.length;_i158++)this.skyboxes[_i158].active=active;}},{key:"getSkyBoxById",value:function getSkyBoxById(id){return this.skyboxes[id];}/**
14302
14308
  Destroys a skybox.
14303
14309
  @param id
14304
14310
  */},{key:"destroySkybox",value:function destroySkybox(id){var skybox=this.skyboxes[id];if(!skybox){this.error("Skybox not found: "+id);return;}skybox.destroy();}/**
14305
14311
  Destroys all skyboxes.
14306
- */},{key:"clear",value:function clear(){var ids=Object.keys(this.viewer.scene.skyboxes);for(var i=0,len=ids.length;i<len;i++){this.destroySkybox(ids[i]);}}/**
14312
+ */},{key:"clear",value:function clear(){var ids=Object.keys(this.skyboxes);for(var i=0,len=ids.length;i<len;i++){this.destroySkybox(ids[i]);}}/**
14307
14313
  * Destroys this plugin.
14308
14314
  *
14309
14315
  * Clears skyboxes from the Viewer first.
14310
- */},{key:"destroy",value:function destroy(){this.clear();_superPropGet(SkyboxesPlugin,"clear",this,3)([]);}}]);}(Plugin);var treeViews=[];/**
14316
+ */},{key:"destroy",value:function destroy(){this.clear();}}]);}(Plugin);var treeViews=[];/**
14311
14317
  * @desc A {@link Viewer} plugin that provides an HTML tree view to navigate the IFC elements in models.
14312
14318
  * <br>
14313
14319
  *
@@ -24666,7 +24672,8 @@ mouseDownLeft=false;mouseDownMiddle=false;mouseDownRight=false;break;}});this.ca
24666
24672
  getCanvasPosFromEvent$3(e,canvasPos);var x=canvasPos[0];var y=canvasPos[1];if(Math.abs(x-lastXDown)<3&&Math.abs(y-lastYDown)<3){controllers.cameraControl.fire("rightClick",{// For context menus
24667
24673
  pagePos:[Math.round(e.pageX),Math.round(e.pageY)],canvasPos:canvasPos,event:e},true);}break;}_this123.canvas.style.removeProperty("cursor");});this.canvas.addEventListener("mouseenter",this._mouseEnterHandler=function(){if(!(configs.active&&configs.pointerEnabled)){return;}});var maxElapsed=1/20;var minElapsed=1/60;var secsNowLast=null;var enableMove=true;this._scene.on("collideWithEntity",function(collideWithEntity){enableMove=!collideWithEntity;});this.canvas.addEventListener("wheel",this._mouseWheelHandler=function(e){e.preventDefault();if(!(configs.active&&configs.pointerEnabled)){return;}if(e.deltaY<0&&!enableMove)return;var secsNow=performance.now()/1000.0;var secsElapsed=secsNowLast!==null?secsNow-secsNowLast:0;secsNowLast=secsNow;if(secsElapsed>maxElapsed){secsElapsed=maxElapsed;}if(secsElapsed<minElapsed){secsElapsed=minElapsed;}var delta=Math.max(-1,Math.min(1,-e.deltaY*40));if(delta===0){return;}var normalizedDelta=delta/Math.abs(delta);updates.dollyDelta+=-normalizedDelta*secsElapsed*configs.mouseWheelDollyRate;if(mouseMovedOnCanvasSinceLastWheel){states.followPointerDirty=true;mouseMovedOnCanvasSinceLastWheel=false;}});}return _createClass(MousePanRotateDollyHandler,[{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){if(this.canvas!=null){this.canvas.removeEventListener("mousedown",this._mouseDownHandler);this.canvas.removeEventListener("mousemove",this._canvasMouseMoveHandler);this.canvas.removeEventListener("mouseup",this._mouseUpHandler);this.canvas.removeEventListener("mouseenter",this._mouseEnterHandler);this.canvas.removeEventListener("wheel",this._mouseWheelHandler);}document.removeEventListener("keydown",this._documentKeyDownHandler);document.removeEventListener("keyup",this._documentKeyUpHandler);document.removeEventListener("mousemove",this._documentMouseMoveHandler);document.removeEventListener("mouseup",this._documentMouseUpHandler);}}]);}();var center=math.vec3();var tempVec3a=math.vec3();var tempVec3b=math.vec3();var tempVec3c=math.vec3();var tempVec3d=math.vec3();var tempCameraTarget={eye:math.vec3(),look:math.vec3(),up:math.vec3()};/**
24668
24674
  * @private
24669
- */var KeyboardAxisViewHandler=/*#__PURE__*/function(){function KeyboardAxisViewHandler(scene,controllers,configs,states){_classCallCheck(this,KeyboardAxisViewHandler);this._scene=scene;this.input=scene.input;var cameraControl=controllers.cameraControl;var camera=scene.camera;this._onSceneKeyDown=scene.input.on("keydown",function(){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}if(!states.mouseover){return;}var axisViewRight=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_RIGHT);var axisViewBack=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_BACK);var axisViewLeft=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_LEFT);var axisViewFront=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_FRONT);var axisViewTop=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_TOP);var axisViewBottom=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_BOTTOM);if(!axisViewRight&&!axisViewBack&&!axisViewLeft&&!axisViewFront&&!axisViewTop&&!axisViewBottom){return;}var aabb=scene.aabb;var diag=math.getAABB3Diag(aabb);math.getAABB3Center(aabb,center);var perspectiveDist=Math.abs(diag/Math.tan(controllers.cameraFlight.fitFOV*math.DEGTORAD));var orthoScale=diag*1.1;tempCameraTarget.orthoScale=orthoScale;if(axisViewRight){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldRight,perspectiveDist,tempVec3a),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(camera.worldUp);}else if(axisViewBack){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldForward,perspectiveDist,tempVec3a),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(camera.worldUp);}else if(axisViewLeft){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldRight,-perspectiveDist,tempVec3a),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(camera.worldUp);}else if(axisViewFront){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldForward,-perspectiveDist,tempVec3a),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(camera.worldUp);}else if(axisViewTop){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldUp,perspectiveDist,tempVec3a),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(math.normalizeVec3(math.mulVec3Scalar(camera.worldForward,1,tempVec3b),tempVec3c));}else if(axisViewBottom){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldUp,-perspectiveDist,tempVec3a),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(math.normalizeVec3(math.mulVec3Scalar(camera.worldForward,-1,tempVec3b)));}if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.setPivotPos(center);}if(controllers.cameraFlight.duration>0){controllers.cameraFlight.flyTo(tempCameraTarget,function(){if(controllers.pivotController.getPivoting()&&configs.followPointer){controllers.pivotController.showPivot();}});}else{controllers.cameraFlight.jumpTo(tempCameraTarget);if(controllers.pivotController.getPivoting()&&configs.followPointer){controllers.pivotController.showPivot();}}});}return _createClass(KeyboardAxisViewHandler,[{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){this.input.off(this._onSceneKeyDown);}}]);}();/**
24675
+ */var KeyboardAxisViewHandler=/*#__PURE__*/function(){function KeyboardAxisViewHandler(scene,controllers,configs,states){_classCallCheck(this,KeyboardAxisViewHandler);this._scene=scene;this.input=scene.input;var cameraControl=controllers.cameraControl;var camera=scene.camera;this._onSceneKeyDown=scene.input.on("keydown",function(){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}if(!states.mouseover){return;}var axisViewRight=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_RIGHT);var axisViewBack=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_BACK);var axisViewLeft=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_LEFT);var axisViewFront=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_FRONT);var axisViewTop=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_TOP);var axisViewBottom=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_BOTTOM);if(!axisViewRight&&!axisViewBack&&!axisViewLeft&&!axisViewFront&&!axisViewTop&&!axisViewBottom){return;}var aabb=scene.aabb;var diag=math.getAABB3Diag(aabb);math.getAABB3Center(aabb,center);var perspectiveDist=Math.abs(diag/Math.tan(controllers.cameraFlight.fitFOV*math.DEGTORAD));var orthoScale=diag*1.1;tempCameraTarget.orthoScale=orthoScale;// 点击键盘切换相机方向
24676
+ if(axisViewRight){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldRight,perspectiveDist,tempVec3a),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(camera.worldUp);}else if(axisViewBack){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldForward,perspectiveDist,tempVec3a),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(camera.worldUp);}else if(axisViewLeft){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldRight,-perspectiveDist,tempVec3a),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(camera.worldUp);}else if(axisViewFront){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldForward,-perspectiveDist,tempVec3a),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(camera.worldUp);}else if(axisViewTop){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldUp,perspectiveDist,tempVec3a),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(math.normalizeVec3(math.mulVec3Scalar(camera.worldForward,1,tempVec3b),tempVec3c));}else if(axisViewBottom){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldUp,-perspectiveDist,tempVec3a),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(math.normalizeVec3(math.mulVec3Scalar(camera.worldForward,-1,tempVec3b)));}if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.setPivotPos(center);}if(controllers.cameraFlight.duration>0){controllers.cameraFlight.flyTo(tempCameraTarget,function(){if(controllers.pivotController.getPivoting()&&configs.followPointer){controllers.pivotController.showPivot();}});}else{controllers.cameraFlight.jumpTo(tempCameraTarget);if(controllers.pivotController.getPivoting()&&configs.followPointer){controllers.pivotController.showPivot();}}});}return _createClass(KeyboardAxisViewHandler,[{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){this.input.off(this._onSceneKeyDown);}}]);}();/**
24670
24677
  * @private
24671
24678
  */var MousePickHandler=/*#__PURE__*/function(){function MousePickHandler(scene,controllers,configs,states,updates){var _this124=this;_classCallCheck(this,MousePickHandler);this._scene=scene;var pickController=controllers.pickController;var pivotController=controllers.pivotController;var cameraControl=controllers.cameraControl;this._clicks=0;this._timeout=null;this._lastPickedEntityId=null;var leftDown=false;var rightDown=false;this.canvas=this._scene.canvas.canvas;var tickifiedMouseMoveFn=scene.tickify(this._canvasMouseMoveHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}if(leftDown||rightDown){return;}var hoverSubs=cameraControl.hasSubs("hover");var hoverEnterSubs=cameraControl.hasSubs("hoverEnter");var hoverOutSubs=cameraControl.hasSubs("hoverOut");var hoverOffSubs=cameraControl.hasSubs("hoverOff");var hoverSurfaceSubs=cameraControl.hasSubs("hoverSurface");var hoverSnapOrSurfaceSubs=cameraControl.hasSubs("hoverSnapOrSurface");if(hoverSubs||hoverEnterSubs||hoverOutSubs||hoverOffSubs||hoverSurfaceSubs||hoverSnapOrSurfaceSubs){pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickEntity=true;pickController.schedulePickSurface=hoverSurfaceSubs;pickController.scheduleSnapOrPick=hoverSnapOrSurfaceSubs;pickController.update();if(pickController.pickResult){if(pickController.pickResult.entity){var pickedEntityId=pickController.pickResult.entity.id;if(_this124._lastPickedEntityId!==pickedEntityId){if(_this124._lastPickedEntityId!==undefined){cameraControl.fire("hoverOut",{// Hovered off an entity
24672
24679
  entity:scene.objects[_this124._lastPickedEntityId]},true);}cameraControl.fire("hoverEnter",pickController.pickResult,true);// Hovering over a new entity
@@ -24731,14 +24738,18 @@ pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePick
24731
24738
  // }
24732
24739
  },false);}return _createClass(MousePickHandler,[{key:"reset",value:function reset(){this._clicks=0;this._lastPickedEntityId=null;if(this._timeout){window.clearTimeout(this._timeout);this._timeout=null;}}},{key:"destroy",value:function destroy(){if(this.canvas!=null){this.canvas.removeEventListener("mousemove",this._canvasMouseMoveHandler);this.canvas.removeEventListener("mousedown",this._canvasMouseDownHandler);this.canvas.removeEventListener("dblclick",this._canvasDblClickHandler);this.canvas.removeEventListener("mouseup",this._canvasMouseUpHandler);}document.removeEventListener("mouseup",this._documentMouseUpHandler);if(this._timeout){window.clearTimeout(this._timeout);this._timeout=null;}}}]);}();/**
24733
24740
  * @private
24734
- */var KeyboardPanRotateDollyHandler=/*#__PURE__*/function(){function KeyboardPanRotateDollyHandler(scene,controllers,configs,states,updates){_classCallCheck(this,KeyboardPanRotateDollyHandler);this._scene=scene;this._updates=updates;var input=scene.input;this.input=input;var keyDownMap=[];var canvas=scene.canvas.canvas;var mouseMovedSinceLastKeyboardDolly=true;this._onSceneMouseMove=input.on("mousemove",function(){mouseMovedSinceLastKeyboardDolly=true;});this._onSceneKeyDown=input.on("keydown",function(keyCode){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}if(!states.mouseover){return;}keyDownMap[keyCode]=true;if(keyCode===input.KEY_SHIFT){canvas.style.cursor="move";}});this._onSceneKeyUp=input.on("keyup",function(keyCode){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}keyDownMap[keyCode]=false;if(keyCode===input.KEY_SHIFT){canvas.style.cursor=null;}if(controllers.pivotController.getPivoting()){controllers.pivotController.endPivot();}});var enableForward=true;this._scene.on("collideWithEntity",function(collideWithEntity){enableForward=!collideWithEntity;});this._onTick=scene.on("tick",function(e){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}if(!states.mouseover){return;}var cameraControl=controllers.cameraControl;var elapsedSecs=e.deltaTime/1000.0;//-------------------------------------------------------------------------------------------------
24741
+ */var KeyboardPanRotateDollyHandler=/*#__PURE__*/function(){function KeyboardPanRotateDollyHandler(scene,controllers,configs,states,updates,moveRate){var _this125=this;_classCallCheck(this,KeyboardPanRotateDollyHandler);this._scene=scene;this._updates=updates;var input=scene.input;this.input=input;var keyDownMap=[];this._movespeed=moveRate?moveRate:1;var canvas=scene.canvas.canvas;var enableSetSpeedUp=false;var enableSetSpeedDown=false;var mouseMovedSinceLastKeyboardDolly=true;this._onSceneMouseMove=input.on("mousemove",function(){mouseMovedSinceLastKeyboardDolly=true;});this._onSceneKeyDown=input.on("keydown",function(keyCode){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}if(!states.mouseover){return;}keyDownMap[keyCode]=true;if(keyCode===input.KEY_SHIFT){canvas.style.cursor="move";}if(keyCode===input.KEY_ADD){enableSetSpeedUp=true;}if(keyCode===input.KEY_SUBTRACT){enableSetSpeedDown=true;}});this._onSceneKeyUp=input.on("keyup",function(keyCode){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}keyDownMap[keyCode]=false;if(keyCode===input.KEY_SHIFT){canvas.style.cursor=null;}if(controllers.pivotController.getPivoting()){controllers.pivotController.endPivot();}if(keyCode===input.KEY_ADD){enableSetSpeedUp=false;}if(keyCode===input.KEY_SUBTRACT){enableSetSpeedDown=false;}});//碰撞停止
24742
+ var enableForward=true;this._scene.on("collideWithEntity",function(collideWithEntity){enableForward=!collideWithEntity;});this._onTick=scene.on("tick",function(e){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}if(!states.mouseover){return;}var cameraControl=controllers.cameraControl;var elapsedSecs=e.deltaTime/1000.0;//-------------------------------------------------------------------------------------------------
24735
24743
  // Keyboard rotation
24736
24744
  //-------------------------------------------------------------------------------------------------
24737
- if(!configs.planView){var rotateYPos=cameraControl._isKeyDownForAction(cameraControl.ROTATE_Y_POS,keyDownMap);var rotateYNeg=cameraControl._isKeyDownForAction(cameraControl.ROTATE_Y_NEG,keyDownMap);var rotateXPos=cameraControl._isKeyDownForAction(cameraControl.ROTATE_X_POS,keyDownMap);var rotateXNeg=cameraControl._isKeyDownForAction(cameraControl.ROTATE_X_NEG,keyDownMap);var orbitDelta=elapsedSecs*configs.keyboardRotationRate;if(rotateYPos||rotateYNeg||rotateXPos||rotateXNeg){if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}if(rotateYPos){updates.rotateDeltaY+=orbitDelta;}else if(rotateYNeg){updates.rotateDeltaY-=orbitDelta;}if(rotateXPos){updates.rotateDeltaX+=orbitDelta;}else if(rotateXNeg){updates.rotateDeltaX-=orbitDelta;}if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}}}//-------------------------------------------------------------------------------------------------
24745
+ if(!configs.planView){var rotateYPos=cameraControl._isKeyDownForAction(cameraControl.ROTATE_Y_POS,keyDownMap);var rotateYNeg=cameraControl._isKeyDownForAction(cameraControl.ROTATE_Y_NEG,keyDownMap);var rotateXPos=cameraControl._isKeyDownForAction(cameraControl.ROTATE_X_POS,keyDownMap);var rotateXNeg=cameraControl._isKeyDownForAction(cameraControl.ROTATE_X_NEG,keyDownMap);var orbitDelta=elapsedSecs*configs.keyboardRotationRate;if(rotateYPos||rotateYNeg||rotateXPos||rotateXNeg){if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}if(rotateYPos){updates.rotateDeltaY+=orbitDelta*_this125._movespeed;}else if(rotateYNeg){updates.rotateDeltaY-=orbitDelta*_this125._movespeed;}if(rotateXPos){updates.rotateDeltaX+=orbitDelta*_this125._movespeed;}else if(rotateXNeg){updates.rotateDeltaX-=orbitDelta*_this125._movespeed;}if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}}}//-------------------------------------------------------------------------------------------------
24738
24746
  // Keyboard panning
24739
24747
  //-------------------------------------------------------------------------------------------------
24740
- if(!keyDownMap[input.KEY_CTRL]&&!keyDownMap[input.KEY_ALT]){var dollyBackwards=cameraControl._isKeyDownForAction(cameraControl.DOLLY_BACKWARDS,keyDownMap);var dollyForwards=cameraControl._isKeyDownForAction(cameraControl.DOLLY_FORWARDS,keyDownMap);if(dollyBackwards||dollyForwards){var dollyDelta=elapsedSecs*configs.keyboardDollyRate;if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}if(dollyForwards){if(!enableForward)return;updates.dollyDelta-=dollyDelta;}else if(dollyBackwards){updates.dollyDelta+=dollyDelta;}if(mouseMovedSinceLastKeyboardDolly){states.followPointerDirty=true;mouseMovedSinceLastKeyboardDolly=false;}}}var panForwards=cameraControl._isKeyDownForAction(cameraControl.PAN_FORWARDS,keyDownMap);var panBackwards=cameraControl._isKeyDownForAction(cameraControl.PAN_BACKWARDS,keyDownMap);var panLeft=cameraControl._isKeyDownForAction(cameraControl.PAN_LEFT,keyDownMap);var panRight=cameraControl._isKeyDownForAction(cameraControl.PAN_RIGHT,keyDownMap);var panUp=cameraControl._isKeyDownForAction(cameraControl.PAN_UP,keyDownMap);var panDown=cameraControl._isKeyDownForAction(cameraControl.PAN_DOWN,keyDownMap);var panDelta=(keyDownMap[input.KEY_ALT]?0.3:1.0)*elapsedSecs*configs.keyboardPanRate;// ALT for slower pan rate
24741
- if(panForwards||panBackwards||panLeft||panRight||panUp||panDown){if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}if(panDown){updates.panDeltaY+=panDelta;}else if(panUp){updates.panDeltaY+=-panDelta;}if(panRight){updates.panDeltaX+=-panDelta;}else if(panLeft){updates.panDeltaX+=panDelta;}if(panBackwards){updates.panDeltaZ+=panDelta;}else if(panForwards){updates.panDeltaZ+=-panDelta;}}});}return _createClass(KeyboardPanRotateDollyHandler,[{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){this._scene.off(this._onTick);this.input.off(this._onSceneMouseMove);this.input.off(this._onSceneKeyDown);this.input.off(this._onSceneKeyUp);}}]);}();var SCALE_DOLLY_EACH_FRAME=1;// Recalculate dolly speed for eye->target distance on each Nth frame
24748
+ if(!keyDownMap[input.KEY_CTRL]&&!keyDownMap[input.KEY_ALT]){var dollyBackwards=cameraControl._isKeyDownForAction(cameraControl.DOLLY_BACKWARDS,keyDownMap);var dollyForwards=cameraControl._isKeyDownForAction(cameraControl.DOLLY_FORWARDS,keyDownMap);if(dollyBackwards||dollyForwards){var dollyDelta=elapsedSecs*configs.keyboardDollyRate;if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}if(dollyForwards){if(!enableForward)return;updates.dollyDelta-=dollyDelta*_this125._movespeed;}else if(dollyBackwards){updates.dollyDelta+=dollyDelta*_this125._movespeed;}if(mouseMovedSinceLastKeyboardDolly){states.followPointerDirty=true;mouseMovedSinceLastKeyboardDolly=false;}}}// 调整移动速度
24749
+ var speedUP=cameraControl._isKeyDownForAction(cameraControl.SPEED_UP,keyDownMap);var speedDown=cameraControl._isKeyDownForAction(cameraControl.SPEED_DOWN,keyDownMap);if(speedUP||speedDown){if(enableSetSpeedUp){if(_this125._movespeed<2){console.log(111);_this125._movespeed+=0.5;}enableSetSpeedUp=false;}if(enableSetSpeedDown){if(_this125._movespeed>0.5){console.log(222);_this125._movespeed-=0.5;}enableSetSpeedDown=false;}}//判断是否能用
24750
+ var panForwards=cameraControl._isKeyDownForAction(cameraControl.PAN_FORWARDS,keyDownMap);var panBackwards=cameraControl._isKeyDownForAction(cameraControl.PAN_BACKWARDS,keyDownMap);var panLeft=cameraControl._isKeyDownForAction(cameraControl.PAN_LEFT,keyDownMap);var panRight=cameraControl._isKeyDownForAction(cameraControl.PAN_RIGHT,keyDownMap);var panUp=cameraControl._isKeyDownForAction(cameraControl.PAN_UP,keyDownMap);var panDown=cameraControl._isKeyDownForAction(cameraControl.SPEED_UP,keyDownMap);// const panDelta = (keyDownMap[input.KEY_ALT] ? 0.3 : 1.0) * elapsedSecs * configs.keyboardPanRate; // ALT for slower pan rate
24751
+ var panDelta=_this125._movespeed*elapsedSecs*configs.keyboardPanRate;// ALT for slower pan rate
24752
+ if(panForwards||panBackwards||panLeft||panRight||panUp||panDown){if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}if(panDown){updates.panDeltaZ+=panDelta;}else if(panUp){updates.panDeltaZ+=-panDelta;}if(panRight){updates.panDeltaX+=-panDelta;}else if(panLeft){updates.panDeltaX+=panDelta;}if(panBackwards){updates.panDeltaY+=panDelta;}else if(panForwards){updates.panDeltaY+=-panDelta;}}});}return _createClass(KeyboardPanRotateDollyHandler,[{key:"movespeed",get:function get(){return this._movespeed;},set:function set(value){this._movespeed=value;}},{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){this._scene.off(this._onTick);this.input.off(this._onSceneMouseMove);this.input.off(this._onSceneKeyDown);this.input.off(this._onSceneKeyUp);}}]);}();var SCALE_DOLLY_EACH_FRAME=1;// Recalculate dolly speed for eye->target distance on each Nth frame
24742
24753
  var EPSILON=0.001;var tempVec3=math.vec3();/**
24743
24754
  * Handles camera updates on each "tick" that were scheduled by the various controllers.
24744
24755
  *
@@ -24775,7 +24786,7 @@ if(Math.abs(updates.panDeltaX)<EPSILON){updates.panDeltaX=0;}if(Math.abs(updates
24775
24786
  if(dollyDeltaForDist!==0){if(dollyDeltaForDist<0){cursorType="zoom-in";}else{cursorType="zoom-out";}if(configs.firstPerson){var _verticalEye;var _verticalLook;if(configs.constrainVertical){if(camera.xUp){_verticalEye=camera.eye[0];_verticalLook=camera.look[0];}else if(camera.yUp){_verticalEye=camera.eye[1];_verticalLook=camera.look[1];}else if(camera.zUp){_verticalEye=camera.eye[2];_verticalLook=camera.look[2];}}if(configs.followPointer){var dolliedThroughSurface=panController.dollyToCanvasPos(followPointerWorldPos,states.pointerCanvasPos,-dollyDeltaForDist);if(dolliedThroughSurface){states.followPointerDirty=true;}}else{camera.pan([0,0,dollyDeltaForDist]);camera.ortho.scale=camera.ortho.scale-dollyDeltaForDist;}if(configs.constrainVertical){var _eye=camera.eye;var _look=camera.look;if(camera.xUp){_eye[0]=_verticalEye;_look[0]=_verticalLook;}else if(camera.yUp){_eye[1]=_verticalEye;_look[1]=_verticalLook;}else if(camera.zUp){_eye[2]=_verticalEye;_look[2]=_verticalLook;}camera.eye=_eye;camera.look=_look;}}else if(configs.planView){if(configs.followPointer){var _dolliedThroughSurface=panController.dollyToCanvasPos(followPointerWorldPos,states.pointerCanvasPos,-dollyDeltaForDist);if(_dolliedThroughSurface){states.followPointerDirty=true;}}else{camera.ortho.scale=camera.ortho.scale+dollyDeltaForDist;camera.zoom(dollyDeltaForDist);}}else{// Orbiting
24776
24787
  if(configs.followPointer){var _dolliedThroughSurface2=panController.dollyToCanvasPos(followPointerWorldPos,states.pointerCanvasPos,-dollyDeltaForDist);if(_dolliedThroughSurface2){states.followPointerDirty=true;}}else{camera.ortho.scale=camera.ortho.scale+dollyDeltaForDist;camera.zoom(dollyDeltaForDist);}}updates.dollyDelta*=configs.dollyInertia;}pickController.fireEvents();document.body.style.cursor=cursorType;});}return _createClass(CameraUpdater,[{key:"destroy",value:function destroy(){this._scene.off(this._onTick);}}]);}();/**
24777
24788
  * @private
24778
- */var MouseMiscHandler=/*#__PURE__*/function(){function MouseMiscHandler(scene,controllers,configs,states,updates){var _this125=this;_classCallCheck(this,MouseMiscHandler);this._scene=scene;this.canvas=this._scene.canvas.canvas;this.canvas.addEventListener("mouseenter",this._mouseEnterHandler=function(){states.mouseover=true;});this.canvas.addEventListener("mouseleave",this._mouseLeaveHandler=function(){states.mouseover=false;_this125.canvas.style.cursor=null;});document.addEventListener("mousemove",this._mouseMoveHandler=function(e){getCanvasPosFromEvent$2(e,_this125.canvas,states.pointerCanvasPos);});this.canvas.addEventListener("mousedown",this._mouseDownHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}getCanvasPosFromEvent$2(e,_this125.canvas,states.pointerCanvasPos);states.mouseover=true;});this.canvas.addEventListener("mouseup",this._mouseUpHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}});}return _createClass(MouseMiscHandler,[{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){//网络问题导致的模型加载失败等情况时,如果切换模型,会找不到canvas
24789
+ */var MouseMiscHandler=/*#__PURE__*/function(){function MouseMiscHandler(scene,controllers,configs,states,updates){var _this126=this;_classCallCheck(this,MouseMiscHandler);this._scene=scene;this.canvas=this._scene.canvas.canvas;this.canvas.addEventListener("mouseenter",this._mouseEnterHandler=function(){states.mouseover=true;});this.canvas.addEventListener("mouseleave",this._mouseLeaveHandler=function(){states.mouseover=false;_this126.canvas.style.cursor=null;});document.addEventListener("mousemove",this._mouseMoveHandler=function(e){getCanvasPosFromEvent$2(e,_this126.canvas,states.pointerCanvasPos);});this.canvas.addEventListener("mousedown",this._mouseDownHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}getCanvasPosFromEvent$2(e,_this126.canvas,states.pointerCanvasPos);states.mouseover=true;});this.canvas.addEventListener("mouseup",this._mouseUpHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}});}return _createClass(MouseMiscHandler,[{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){//网络问题导致的模型加载失败等情况时,如果切换模型,会找不到canvas
24779
24790
  //因此暂时在此加判断
24780
24791
  if(this.canvas!=null){this.canvas.removeEventListener("mouseenter",this._mouseEnterHandler);this.canvas.removeEventListener("mouseleave",this._mouseLeaveHandler);this.canvas.removeEventListener("mousedown",this._mouseDownHandler);this.canvas.removeEventListener("mouseup",this._mouseUpHandler);}document.removeEventListener("mousemove",this._mouseMoveHandler);}}]);}();function getCanvasPosFromEvent$2(event,canvas,canvasPos){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;}else{var _canvas$getBoundingCl=canvas.getBoundingClientRect(),x=_canvas$getBoundingCl.x,y=_canvas$getBoundingCl.y;canvasPos[0]=event.clientX-x;canvasPos[1]=event.clientY-y;}return canvasPos;}var getCanvasPosFromEvent$1=function getCanvasPosFromEvent$1(event,canvasPos){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;}else{var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;}return canvasPos;};/**
24781
24792
  * @private
@@ -25287,81 +25298,81 @@ cameraControl.fire("touchPickedNothing");}lastTapTime=currentTime;}tapStartTime=
25287
25298
  */var CameraControl=/*#__PURE__*/function(_Component38){/**
25288
25299
  * @private
25289
25300
  * @constructor
25290
- */function CameraControl(owner){var _this126;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CameraControl);_this126=_callSuper(this,CameraControl,[owner,cfg]);/**
25301
+ */function CameraControl(owner){var _this127;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CameraControl);_this127=_callSuper(this,CameraControl,[owner,cfg]);/**
25291
25302
  * Identifies the XX action.
25292
25303
  * @final
25293
25304
  * @type {Number}
25294
- */_this126.PAN_LEFT=0;/**
25305
+ */_this127.PAN_LEFT=0;/**
25295
25306
  * Identifies the XX action.
25296
25307
  * @final
25297
25308
  * @type {Number}
25298
- */_this126.PAN_RIGHT=1;/**
25309
+ */_this127.PAN_RIGHT=1;/**
25299
25310
  * Identifies the XX action.
25300
25311
  * @final
25301
25312
  * @type {Number}
25302
- */_this126.PAN_UP=2;/**
25313
+ */_this127.PAN_UP=2;/**
25303
25314
  * Identifies the XX action.
25304
25315
  * @final
25305
25316
  * @type {Number}
25306
- */_this126.PAN_DOWN=3;/**
25317
+ */_this127.PAN_DOWN=3;/**
25307
25318
  * Identifies the XX action.
25308
25319
  * @final
25309
25320
  * @type {Number}
25310
- */_this126.PAN_FORWARDS=4;/**
25321
+ */_this127.PAN_FORWARDS=4;/**
25311
25322
  * Identifies the XX action.
25312
25323
  * @final
25313
25324
  * @type {Number}
25314
- */_this126.PAN_BACKWARDS=5;/**
25325
+ */_this127.PAN_BACKWARDS=5;/**
25315
25326
  * Identifies the XX action.
25316
25327
  * @final
25317
25328
  * @type {Number}
25318
- */_this126.ROTATE_X_POS=6;/**
25329
+ */_this127.ROTATE_X_POS=6;/**
25319
25330
  * Identifies the XX action.
25320
25331
  * @final
25321
25332
  * @type {Number}
25322
- */_this126.ROTATE_X_NEG=7;/**
25333
+ */_this127.ROTATE_X_NEG=7;/**
25323
25334
  * Identifies the XX action.
25324
25335
  * @final
25325
25336
  * @type {Number}
25326
- */_this126.ROTATE_Y_POS=8;/**
25337
+ */_this127.ROTATE_Y_POS=8;/**
25327
25338
  * Identifies the XX action.
25328
25339
  * @final
25329
25340
  * @type {Number}
25330
- */_this126.ROTATE_Y_NEG=9;/**
25341
+ */_this127.ROTATE_Y_NEG=9;/**
25331
25342
  * Identifies the XX action.
25332
25343
  * @final
25333
25344
  * @type {Number}
25334
- */_this126.DOLLY_FORWARDS=10;/**
25345
+ */_this127.DOLLY_FORWARDS=10;/**
25335
25346
  * Identifies the XX action.
25336
25347
  * @final
25337
25348
  * @type {Number}
25338
- */_this126.DOLLY_BACKWARDS=11;/**
25349
+ */_this127.DOLLY_BACKWARDS=11;/**
25339
25350
  * Identifies the XX action.
25340
25351
  * @final
25341
25352
  * @type {Number}
25342
- */_this126.AXIS_VIEW_RIGHT=12;/**
25353
+ */_this127.AXIS_VIEW_RIGHT=12;/**
25343
25354
  * Identifies the XX action.
25344
25355
  * @final
25345
25356
  * @type {Number}
25346
- */_this126.AXIS_VIEW_BACK=13;/**
25357
+ */_this127.AXIS_VIEW_BACK=13;/**
25347
25358
  * Identifies the XX action.
25348
25359
  * @final
25349
25360
  * @type {Number}
25350
- */_this126.AXIS_VIEW_LEFT=14;/**
25361
+ */_this127.AXIS_VIEW_LEFT=14;/**
25351
25362
  * Identifies the XX action.
25352
25363
  * @final
25353
25364
  * @type {Number}
25354
- */_this126.AXIS_VIEW_FRONT=15;/**
25365
+ */_this127.AXIS_VIEW_FRONT=15;/**
25355
25366
  * Identifies the XX action.
25356
25367
  * @final
25357
25368
  * @type {Number}
25358
- */_this126.AXIS_VIEW_TOP=16;/**
25369
+ */_this127.AXIS_VIEW_TOP=16;/**
25359
25370
  * Identifies the XX action.
25360
25371
  * @final
25361
25372
  * @type {Number}
25362
- */_this126.AXIS_VIEW_BOTTOM=17;_this126._keyMap={};// Maps key codes to the above actions
25363
- _this126.scene.canvas.canvas.oncontextmenu=function(e){e.preventDefault();};// User-settable CameraControl configurations
25364
- _this126._configs={// Private
25373
+ */_this127.AXIS_VIEW_BOTTOM=17;_this127.SPEED_UP=107;_this127.SPEED_DOWN=109;_this127._keyMap={};// Maps key codes to the above actions
25374
+ _this127.scene.canvas.canvas.oncontextmenu=function(e){e.preventDefault();};// User-settable CameraControl configurations
25375
+ _this127._configs={// Private
25365
25376
  longTapTimeout:600,// Millisecs
25366
25377
  longTapRadius:5,// Pixels
25367
25378
  // General
@@ -25369,16 +25380,13 @@ active:true,keyboardLayout:"qwerty",navMode:"orbit",planView:false,firstPerson:f
25369
25380
  dragRotationRate:360.0,keyboardRotationRate:90.0,rotationInertia:0.0,// Panning
25370
25381
  keyboardPanRate:1.0,touchPanRate:1.0,panInertia:0.5,// Dollying
25371
25382
  keyboardDollyRate:10,mouseWheelDollyRate:100,touchDollyRate:0.2,dollyInertia:0,dollyProximityThreshold:30.0,dollyMinSpeed:0.04};// Current runtime state of the CameraControl
25372
- _this126._states={pointerCanvasPos:math.vec2(),mouseover:false,followPointerDirty:true,mouseDownClientX:0,mouseDownClientY:0,mouseDownCursorX:0,mouseDownCursorY:0,touchStartTime:null,touchEndTime:null,activeTouches:[],tapStartPos:math.vec2(),tapStartTime:-1,lastTapTime:-1,longTouchTimeout:null};// Updates for CameraUpdater to process on next Scene "tick" event
25373
- _this126._updates={rotateDeltaX:0,rotateDeltaY:0,panDeltaX:0,panDeltaY:0,panDeltaZ:0,dollyDelta:0};// Controllers to assist input event handlers with controlling the Camera
25374
- var scene=_this126.scene;_this126._controllers={cameraControl:_this126,pickController:new PickController(_this126,_this126._configs),pivotController:new PivotController(scene,_this126._configs),panController:new PanController(scene),cameraFlight:new CameraFlightAnimation(_this126,{duration:0.5})};// Input event handlers
25375
- _this126._handlers=[new MouseMiscHandler(_this126.scene,_this126._controllers,_this126._configs,_this126._states,_this126._updates),new TouchPanRotateAndDollyHandler(_this126.scene,_this126._controllers,_this126._configs,_this126._states,_this126._updates),new MousePanRotateDollyHandler(_this126.scene,_this126._controllers,_this126._configs,_this126._states,_this126._updates),new KeyboardAxisViewHandler(_this126.scene,_this126._controllers,_this126._configs,_this126._states,_this126._updates),new MousePickHandler(_this126.scene,_this126._controllers,_this126._configs,_this126._states,_this126._updates),new TouchPickHandler(_this126.scene,_this126._controllers,_this126._configs,_this126._states,_this126._updates),new KeyboardPanRotateDollyHandler(_this126.scene,_this126._controllers,_this126._configs,_this126._states,_this126._updates)];// Applies scheduled updates to the Camera on each Scene "tick" event
25376
- _this126._cameraUpdater=new CameraUpdater(_this126.scene,_this126._controllers,_this126._configs,_this126._states,_this126._updates);// Set initial user configurations
25377
- _this126.navMode=cfg.navMode;if(cfg.planView){_this126.planView=cfg.planView;}_this126.constrainVertical=cfg.constrainVertical;if(cfg.keyboardLayout){_this126.keyboardLayout=cfg.keyboardLayout;// Deprecated
25378
- }else{_this126.keyMap=cfg.keyMap;}_this126.doublePickFlyTo=cfg.doublePickFlyTo;_this126.panRightClick=cfg.panRightClick;_this126.active=cfg.active;_this126.followPointer=cfg.followPointer;_this126.rotationInertia=cfg.rotationInertia;_this126.keyboardPanRate=cfg.keyboardPanRate;_this126.touchPanRate=cfg.touchPanRate;_this126.keyboardRotationRate=cfg.keyboardRotationRate;_this126.dragRotationRate=cfg.dragRotationRate;_this126.touchDollyRate=cfg.touchDollyRate;_this126.dollyInertia=cfg.dollyInertia;_this126.dollyProximityThreshold=cfg.dollyProximityThreshold;_this126.dollyMinSpeed=cfg.dollyMinSpeed;_this126.panInertia=cfg.panInertia;_this126.pointerEnabled=true;_this126.keyboardDollyRate=cfg.keyboardDollyRate;_this126.mouseWheelDollyRate=cfg.mouseWheelDollyRate;_this126._moveRate=1;_this126.scene.on("tick",function(){// if (!(this._configs.active && this._configs.pointerEnabled)) return;
25379
- // if (!this._states.mouseover) return;
25380
- if(!(_this126._goLeft||_this126._goRight||_this126._goUp||_this126._goDown||_this126._goForward||_this126._goBackward)){// this._inputDirectionCommand = false;
25381
- return;}if(_this126._goRight){_this126._updates.panDeltaX+=-0.1*_this126._moveRate;}else if(_this126._goLeft){_this126._updates.panDeltaX+=0.1*_this126._moveRate;}if(_this126._goUp){_this126._updates.panDeltaY+=0.1*_this126._moveRate;}else if(_this126._goDown){_this126._updates.panDeltaY+=-0.1*_this126._moveRate;}if(_this126._goForward){_this126._updates.panDeltaZ+=-0.1*_this126._moveRate;}else if(_this126._goBackward){_this126._updates.panDeltaZ+=+0.1*_this126._moveRate;}_this126._inputDirectionCommand=true;});return _this126;}/**
25383
+ _this127._states={pointerCanvasPos:math.vec2(),mouseover:false,followPointerDirty:true,mouseDownClientX:0,mouseDownClientY:0,mouseDownCursorX:0,mouseDownCursorY:0,touchStartTime:null,touchEndTime:null,activeTouches:[],tapStartPos:math.vec2(),tapStartTime:-1,lastTapTime:-1,longTouchTimeout:null};// Updates for CameraUpdater to process on next Scene "tick" event
25384
+ _this127._updates={rotateDeltaX:0,rotateDeltaY:0,panDeltaX:0,panDeltaY:0,panDeltaZ:0,dollyDelta:0};// Controllers to assist input event handlers with controlling the Camera
25385
+ var scene=_this127.scene;_this127._controllers={cameraControl:_this127,pickController:new PickController(_this127,_this127._configs),pivotController:new PivotController(scene,_this127._configs),panController:new PanController(scene),cameraFlight:new CameraFlightAnimation(_this127,{duration:0.5})};// Input event handlers
25386
+ _this127._handlers=[new MouseMiscHandler(_this127.scene,_this127._controllers,_this127._configs,_this127._states,_this127._updates),new TouchPanRotateAndDollyHandler(_this127.scene,_this127._controllers,_this127._configs,_this127._states,_this127._updates),new MousePanRotateDollyHandler(_this127.scene,_this127._controllers,_this127._configs,_this127._states,_this127._updates),new KeyboardAxisViewHandler(_this127.scene,_this127._controllers,_this127._configs,_this127._states,_this127._updates),new MousePickHandler(_this127.scene,_this127._controllers,_this127._configs,_this127._states,_this127._updates),new TouchPickHandler(_this127.scene,_this127._controllers,_this127._configs,_this127._states,_this127._updates),new KeyboardPanRotateDollyHandler(_this127.scene,_this127._controllers,_this127._configs,_this127._states,_this127._updates)];// Applies scheduled updates to the Camera on each Scene "tick" event
25387
+ _this127._cameraUpdater=new CameraUpdater(_this127.scene,_this127._controllers,_this127._configs,_this127._states,_this127._updates);// Set initial user configurations
25388
+ _this127.navMode=cfg.navMode;if(cfg.planView){_this127.planView=cfg.planView;}_this127.constrainVertical=cfg.constrainVertical;if(cfg.keyboardLayout){_this127.keyboardLayout=cfg.keyboardLayout;// Deprecated
25389
+ }else{_this127.keyMap=cfg.keyMap;}_this127.doublePickFlyTo=cfg.doublePickFlyTo;_this127.panRightClick=cfg.panRightClick;_this127.active=cfg.active;_this127.followPointer=cfg.followPointer;_this127.rotationInertia=cfg.rotationInertia;_this127.keyboardPanRate=cfg.keyboardPanRate;_this127.touchPanRate=cfg.touchPanRate;_this127.keyboardRotationRate=cfg.keyboardRotationRate;_this127.dragRotationRate=cfg.dragRotationRate;_this127.touchDollyRate=cfg.touchDollyRate;_this127.dollyInertia=cfg.dollyInertia;_this127.dollyProximityThreshold=cfg.dollyProximityThreshold;_this127.dollyMinSpeed=cfg.dollyMinSpeed;_this127.panInertia=cfg.panInertia;_this127.pointerEnabled=true;_this127.keyboardDollyRate=cfg.keyboardDollyRate;_this127.mouseWheelDollyRate=cfg.mouseWheelDollyRate;_this127._moveRate=1;_this127.scene.on("tick",function(){if(!(_this127._goLeft||_this127._goRight||_this127._goUp||_this127._goDown||_this127._goForward||_this127._goBackward)){return;}if(_this127._goRight){_this127._updates.panDeltaX+=-0.1*_this127._moveRate;}else if(_this127._goLeft){_this127._updates.panDeltaX+=0.1*_this127._moveRate;}if(_this127._goUp){_this127._updates.panDeltaY+=0.1*_this127._moveRate;}else if(_this127._goDown){_this127._updates.panDeltaY+=-0.1*_this127._moveRate;}if(_this127._goForward){_this127._updates.panDeltaZ+=-0.1*_this127._moveRate;}else if(_this127._goBackward){_this127._updates.panDeltaZ+=+0.1*_this127._moveRate;}});return _this127;}/**
25382
25390
  * 停止漫游
25383
25391
  */_inherits(CameraControl,_Component38);return _createClass(CameraControl,[{key:"setdirectionChangeCancel",value:function setdirectionChangeCancel(){this._goLeft=false;this._goRight=false;this._goUp=false;this._goDown=false;this._goForward=false;this._goBackward=false;}/**
25384
25392
  * 设置漫游移动速率
@@ -25386,7 +25394,7 @@ return;}if(_this126._goRight){_this126._updates.panDeltaX+=-0.1*_this126._moveRa
25386
25394
  */},{key:"moveRate",get:function get(){return this._moveRate;}/**
25387
25395
  * 漫游向右
25388
25396
  * @param {boolean} go
25389
- */,set:function set(rate){this._moveRate=rate;}},{key:"goRight",set:function set(go){this._goRight=go;}/**
25397
+ */,set:function set(rate){this._moveRate=rate;this._handlers[6].movespeed=rate;}},{key:"goRight",set:function set(go){this._goRight=go;}/**
25390
25398
  * 漫游向左
25391
25399
  * @param {boolean} go
25392
25400
  */},{key:"goLeft",set:function set(go){this._goLeft=go;}/**
@@ -25418,7 +25426,7 @@ return;}if(_this126._goRight){_this126._updates.panDeltaX+=-0.1*_this126._moveRa
25418
25426
  * @param keyDownMap
25419
25427
  * @private
25420
25428
  */,set:function set(value){value=value||"qwerty";if(utils.isString(value)){var input=this.scene.input;var keyMap={};switch(value){default:this.error("Unsupported value for 'keyMap': "+value+" defaulting to 'qwerty'");// Intentional fall-through to "qwerty"
25421
- case"qwerty":keyMap[this.PAN_LEFT]=[input.KEY_A];keyMap[this.PAN_RIGHT]=[input.KEY_D];keyMap[this.PAN_UP]=[input.KEY_Z];keyMap[this.PAN_DOWN]=[input.KEY_X];keyMap[this.PAN_BACKWARDS]=[];keyMap[this.PAN_FORWARDS]=[];keyMap[this.DOLLY_FORWARDS]=[input.KEY_W,input.KEY_ADD];keyMap[this.DOLLY_BACKWARDS]=[input.KEY_S,input.KEY_SUBTRACT];keyMap[this.ROTATE_X_POS]=[input.KEY_DOWN_ARROW];keyMap[this.ROTATE_X_NEG]=[input.KEY_UP_ARROW];keyMap[this.ROTATE_Y_POS]=[input.KEY_Q,input.KEY_LEFT_ARROW];keyMap[this.ROTATE_Y_NEG]=[input.KEY_E,input.KEY_RIGHT_ARROW];keyMap[this.AXIS_VIEW_RIGHT]=[input.KEY_NUM_1];keyMap[this.AXIS_VIEW_BACK]=[input.KEY_NUM_2];keyMap[this.AXIS_VIEW_LEFT]=[input.KEY_NUM_3];keyMap[this.AXIS_VIEW_FRONT]=[input.KEY_NUM_4];keyMap[this.AXIS_VIEW_TOP]=[input.KEY_NUM_5];keyMap[this.AXIS_VIEW_BOTTOM]=[input.KEY_NUM_6];break;case"azerty":keyMap[this.PAN_LEFT]=[input.KEY_Q];keyMap[this.PAN_RIGHT]=[input.KEY_D];keyMap[this.PAN_UP]=[input.KEY_W];keyMap[this.PAN_DOWN]=[input.KEY_X];keyMap[this.PAN_BACKWARDS]=[];keyMap[this.PAN_FORWARDS]=[];keyMap[this.DOLLY_FORWARDS]=[input.KEY_Z,input.KEY_ADD];keyMap[this.DOLLY_BACKWARDS]=[input.KEY_S,input.KEY_SUBTRACT];keyMap[this.ROTATE_X_POS]=[input.KEY_DOWN_ARROW];keyMap[this.ROTATE_X_NEG]=[input.KEY_UP_ARROW];keyMap[this.ROTATE_Y_POS]=[input.KEY_A,input.KEY_LEFT_ARROW];keyMap[this.ROTATE_Y_NEG]=[input.KEY_E,input.KEY_RIGHT_ARROW];keyMap[this.AXIS_VIEW_RIGHT]=[input.KEY_NUM_1];keyMap[this.AXIS_VIEW_BACK]=[input.KEY_NUM_2];keyMap[this.AXIS_VIEW_LEFT]=[input.KEY_NUM_3];keyMap[this.AXIS_VIEW_FRONT]=[input.KEY_NUM_4];keyMap[this.AXIS_VIEW_TOP]=[input.KEY_NUM_5];keyMap[this.AXIS_VIEW_BOTTOM]=[input.KEY_NUM_6];break;}this._keyMap=keyMap;}else{var _keyMap=value;this._keyMap=_keyMap;}}},{key:"_isKeyDownForAction",value:function _isKeyDownForAction(action,keyDownMap){var keys=this._keyMap[action];if(!keys){return false;}if(!keyDownMap){keyDownMap=this.scene.input.keyDown;}for(var _i503=0,len=keys.length;_i503<len;_i503++){var key=keys[_i503];if(keyDownMap[key]){return true;}}return false;}/**
25429
+ case"qwerty":keyMap[this.PAN_LEFT]=[input.KEY_A];keyMap[this.PAN_RIGHT]=[input.KEY_D];keyMap[this.PAN_UP]=[input.KEY_Z];keyMap[this.PAN_DOWN]=[input.KEY_X];keyMap[this.PAN_BACKWARDS]=[input.KEY_J];keyMap[this.PAN_FORWARDS]=[input.KEY_K];keyMap[this.DOLLY_FORWARDS]=[input.KEY_W];keyMap[this.DOLLY_BACKWARDS]=[input.KEY_S];keyMap[this.ROTATE_X_POS]=[input.KEY_DOWN_ARROW];keyMap[this.ROTATE_X_NEG]=[input.KEY_UP_ARROW];keyMap[this.ROTATE_Y_POS]=[input.KEY_Q,input.KEY_LEFT_ARROW];keyMap[this.ROTATE_Y_NEG]=[input.KEY_E,input.KEY_RIGHT_ARROW];keyMap[this.AXIS_VIEW_RIGHT]=[input.KEY_NUM_1];keyMap[this.AXIS_VIEW_BACK]=[input.KEY_NUM_2];keyMap[this.AXIS_VIEW_LEFT]=[input.KEY_NUM_3];keyMap[this.AXIS_VIEW_FRONT]=[input.KEY_NUM_4];keyMap[this.AXIS_VIEW_TOP]=[input.KEY_NUM_5];keyMap[this.AXIS_VIEW_BOTTOM]=[input.KEY_NUM_6];keyMap[this.SPEED_UP]=[input.KEY_ADD];keyMap[this.SPEED_DOWN]=[input.KEY_SUBTRACT];break;case"azerty":keyMap[this.PAN_LEFT]=[input.KEY_Q];keyMap[this.PAN_RIGHT]=[input.KEY_D];keyMap[this.PAN_UP]=[input.KEY_W];keyMap[this.PAN_DOWN]=[input.KEY_X];keyMap[this.PAN_BACKWARDS]=[input.KEY_J];keyMap[this.PAN_FORWARDS]=[input.KEY_K];keyMap[this.DOLLY_FORWARDS]=[input.KEY_Z];keyMap[this.DOLLY_BACKWARDS]=[input.KEY_S];keyMap[this.ROTATE_X_POS]=[input.KEY_DOWN_ARROW];keyMap[this.ROTATE_X_NEG]=[input.KEY_UP_ARROW];keyMap[this.ROTATE_Y_POS]=[input.KEY_A,input.KEY_LEFT_ARROW];keyMap[this.ROTATE_Y_NEG]=[input.KEY_E,input.KEY_RIGHT_ARROW];keyMap[this.AXIS_VIEW_RIGHT]=[input.KEY_NUM_1];keyMap[this.AXIS_VIEW_BACK]=[input.KEY_NUM_2];keyMap[this.AXIS_VIEW_LEFT]=[input.KEY_NUM_3];keyMap[this.AXIS_VIEW_FRONT]=[input.KEY_NUM_4];keyMap[this.AXIS_VIEW_TOP]=[input.KEY_NUM_5];keyMap[this.AXIS_VIEW_BOTTOM]=[input.KEY_NUM_6];keyMap[this.SPEED_UP]=[input.KEY_ADD];keyMap[this.SPEED_DOWN]=[input.KEY_SUBTRACT];break;}this._keyMap=keyMap;}else{var _keyMap=value;this._keyMap=_keyMap;}}},{key:"_isKeyDownForAction",value:function _isKeyDownForAction(action,keyDownMap){var keys=this._keyMap[action];if(!keys){return false;}if(!keyDownMap){keyDownMap=this.scene.input.keyDown;}for(var _i503=0,len=keys.length;_i503<len;_i503++){var key=keys[_i503];if(keyDownMap[key]){return true;}}return false;}/**
25422
25430
  * Sets the HTMl element to represent the pivot point when {@link CameraControl#followPointer} is true.
25423
25431
  *
25424
25432
  * See class comments for an example.
@@ -26411,7 +26419,7 @@ var documentBackgroundColor=ownerDocument.documentElement?parseColor(context,get
26411
26419
  * configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
26412
26420
  * responsiveness. It is important to consider that each SectionPlane impacts rendering performance, so it is recommended to set this value to a quantity that aligns with
26413
26421
  * your expected usage.
26414
- */function Viewer(cfg){var _this127=this;_classCallCheck(this,Viewer);this.container=cfg.viewerElement;/**
26422
+ */function Viewer(cfg){var _this128=this;_classCallCheck(this,Viewer);this.container=cfg.viewerElement;/**
26415
26423
  * The Viewer's current language setting.
26416
26424
  * @property language
26417
26425
  * @deprecated
@@ -26456,7 +26464,7 @@ var documentBackgroundColor=ownerDocument.documentElement?parseColor(context,get
26456
26464
  * @property cameraControl
26457
26465
  * @type {CameraControl}
26458
26466
  */this.cameraControl=new CameraControl(this.scene,{// panToPointer: true,
26459
- snapRadius:cfg.snapRadius,doublePickFlyTo:true});this.scene.canvas.on("boundary",function(event){_this127.cameraControl.updatePivotElement();});this._plugins=[];/**
26467
+ snapRadius:cfg.snapRadius,doublePickFlyTo:true});this.scene.canvas.on("boundary",function(event){_this128.cameraControl.updatePivotElement();});this._plugins=[];/**
26460
26468
  * Subscriptions to events sent with {@link fire}.
26461
26469
  * @private
26462
26470
  */this._eventSubs={};}/**
@@ -26933,7 +26941,7 @@ if(plugins.length>0){for(var _i518=0,len=plugins.length;_i518<len;_i518++){var p
26933
26941
  * @param {String[]} [cfg.includeTypes] When loading metadata, only loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
26934
26942
  * @param {String[]} [cfg.excludeTypes] When loading metadata, never loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
26935
26943
  * @param {Boolean} [cfg.excludeUnclassifiedObjects=false] When loading metadata and this is ````true````, will only load {@link Entity}s that have {@link MetaObject}s (that are not excluded). This is useful when we don't want Entitys in the Scene that are not represented within IFC navigation components, such as {@link TreeViewPlugin}.
26936
- */function WebIFCLoaderPlugin(viewer){var _this128;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,WebIFCLoaderPlugin);_this128=_callSuper(this,WebIFCLoaderPlugin,["ifcLoader",viewer,cfg]);_this128.dataSource=cfg.dataSource;_this128.objectDefaults=cfg.objectDefaults;_this128.includeTypes=cfg.includeTypes;_this128.excludeTypes=cfg.excludeTypes;_this128.excludeUnclassifiedObjects=cfg.excludeUnclassifiedObjects;if(cfg.WebIFC){_this128._webIFC=cfg.WebIFC;_this128._ifcAPI=cfg.IfcAPI;_this128.webIfcFroMOutside=true;}// else {
26944
+ */function WebIFCLoaderPlugin(viewer){var _this129;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,WebIFCLoaderPlugin);_this129=_callSuper(this,WebIFCLoaderPlugin,["ifcLoader",viewer,cfg]);_this129.dataSource=cfg.dataSource;_this129.objectDefaults=cfg.objectDefaults;_this129.includeTypes=cfg.includeTypes;_this129.excludeTypes=cfg.excludeTypes;_this129.excludeUnclassifiedObjects=cfg.excludeUnclassifiedObjects;if(cfg.WebIFC){_this129._webIFC=cfg.WebIFC;_this129._ifcAPI=cfg.IfcAPI;_this129.webIfcFroMOutside=true;}// else {
26937
26945
  // this._webIFC = WebIFC;
26938
26946
  // this.webIfcFroMOutside = false;
26939
26947
  // this._ifcAPI = new this._webIFC.IfcAPI();
@@ -26949,7 +26957,7 @@ if(plugins.length>0){for(var _i518=0,len=plugins.length;_i518<len;_i518++){var p
26949
26957
  // this.error(e);
26950
26958
  // });
26951
26959
  // }
26952
- return _this128;}/**
26960
+ return _this129;}/**
26953
26961
  * Gets the ````IFC```` format versions supported by this WebIFCLoaderPlugin.
26954
26962
  * @returns {string[]}
26955
26963
  */_inherits(WebIFCLoaderPlugin,_Plugin10);return _createClass(WebIFCLoaderPlugin,[{key:"supportedVersions",get:function get(){return["2x3","4"];}/**
@@ -27094,13 +27102,13 @@ return _this128;}/**
27094
27102
  // sceneModel.fire("error", e);
27095
27103
  // }
27096
27104
  // });
27097
- return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var _this129=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getIFC(params.src,function(arrayBuffer){_this129._parseModel(arrayBuffer,params,options,sceneModel);spinner.processes--;},function(errMsg){spinner.processes--;_this129.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel){if(sceneModel.destroyed){return;}var stats=params.stats||{};stats.sourceFormat="IFC";stats.schemaVersion="";stats.title="";stats.author="";stats.created="";stats.numMetaObjects=0;stats.numPropertySets=0;stats.numObjects=0;stats.numGeometries=0;stats.numTriangles=0;stats.numVertices=0;if(this.webIfcFroMOutside){if(!this._ifcAPI){throw"WebIFCLoaderPlugin has no WebIFC instance configured - please inject via WebIFCLoaderPlugin constructor";}}else{if(options.wasmPath){this._ifcAPI.SetWasmPath(options.wasmPath);}}var dataArray=new Uint8Array(arrayBuffer);var modelID=this._ifcAPI.OpenModel(dataArray);var modelSchema=this._ifcAPI.GetModelSchema(modelID);var lines=this._ifcAPI.GetLineIDsWithType(modelID,this._webIFC.IFCPROJECT);var ifcProjectId=lines.get(0);var loadMetadata=params.loadMetadata!==false;var useOutsideMetadata=params.metadata!==undefined&&params.metadata!==null;var outMetadata;if(useOutsideMetadata){outMetadata=params.metadata;}else outMetadata=null;var metadata=loadMetadata?{id:"",projectId:""+ifcProjectId,author:"",createdAt:"",schema:"",creatingApplication:"",metaObjects:[],propertySets:[]}:outMetadata;var ctx={ifcProjectId:ifcProjectId,modelID:modelID,modelSchema:modelSchema,sceneModel:sceneModel,loadMetadata:loadMetadata,metadata:metadata,metaObjects:useOutsideMetadata?sceneModel.metaObjects:{},options:options,// log: function (msg) {},
27105
+ return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var _this130=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getIFC(params.src,function(arrayBuffer){_this130._parseModel(arrayBuffer,params,options,sceneModel);spinner.processes--;},function(errMsg){spinner.processes--;_this130.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel){if(sceneModel.destroyed){return;}var stats=params.stats||{};stats.sourceFormat="IFC";stats.schemaVersion="";stats.title="";stats.author="";stats.created="";stats.numMetaObjects=0;stats.numPropertySets=0;stats.numObjects=0;stats.numGeometries=0;stats.numTriangles=0;stats.numVertices=0;if(this.webIfcFroMOutside){if(!this._ifcAPI){throw"WebIFCLoaderPlugin has no WebIFC instance configured - please inject via WebIFCLoaderPlugin constructor";}}else{if(options.wasmPath){this._ifcAPI.SetWasmPath(options.wasmPath);}}var dataArray=new Uint8Array(arrayBuffer);var modelID=this._ifcAPI.OpenModel(dataArray);var modelSchema=this._ifcAPI.GetModelSchema(modelID);var lines=this._ifcAPI.GetLineIDsWithType(modelID,this._webIFC.IFCPROJECT);var ifcProjectId=lines.get(0);var loadMetadata=params.loadMetadata!==false;var useOutsideMetadata=params.metadata!==undefined&&params.metadata!==null;var outMetadata;if(useOutsideMetadata){outMetadata=params.metadata;}else outMetadata=null;var metadata=loadMetadata?{id:"",projectId:""+ifcProjectId,author:"",createdAt:"",schema:"",creatingApplication:"",metaObjects:[],propertySets:[]}:outMetadata;var ctx={ifcProjectId:ifcProjectId,modelID:modelID,modelSchema:modelSchema,sceneModel:sceneModel,loadMetadata:loadMetadata,metadata:metadata,metaObjects:useOutsideMetadata?sceneModel.metaObjects:{},options:options,// log: function (msg) {},
27098
27106
  nextId:0,stats:stats};if(loadMetadata){if(options.includeTypes){ctx.includeTypes={};for(var _i521=0,len=options.includeTypes.length;_i521<len;_i521++){ctx.includeTypes[options.includeTypes[_i521]]=true;}}if(options.excludeTypes){ctx.excludeTypes={};for(var _i522=0,_len106=options.excludeTypes.length;_i522<_len106;_i522++){ctx.excludeTypes[options.excludeTypes[_i522]]=true;}}this._parseMetaObjects(ctx);this._parsePropertySets(ctx);}this._parseGeometry(ctx);sceneModel.finalize();if(loadMetadata||useOutsideMetadata){var metaModelId=sceneModel.id;this.viewer.metaScene.createMetaModel(metaModelId,ctx.metadata,options);}sceneModel.scene.once("tick",function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
27099
27107
  sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
27100
- });}},{key:"_parseMetaObjects",value:function _parseMetaObjects(ctx){var ifcProject=this._ifcAPI.GetLine(ctx.modelID,ctx.ifcProjectId);this._parseSpatialChildren(ctx,ifcProject);}},{key:"_parseSpatialChildren",value:function _parseSpatialChildren(ctx,ifcElement,parentMetaObjectId){var metaObjectType=this._ifcAPI.GetNameFromTypeCode(ifcElement.type);if(ctx.includeTypes&&!ctx.includeTypes[metaObjectType]){return;}if(ctx.excludeTypes&&ctx.excludeTypes[metaObjectType]){return;}this._createMetaObject(ctx,ifcElement,parentMetaObjectId);var metaObjectId=ifcElement.GlobalId.value;this._parseRelatedItemsOfType(ctx,ifcElement.expressID,"RelatingObject","RelatedObjects",this._webIFC.IFCRELAGGREGATES,metaObjectId);this._parseRelatedItemsOfType(ctx,ifcElement.expressID,"RelatingStructure","RelatedElements",this._webIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE,metaObjectId);}},{key:"_createMetaObject",value:function _createMetaObject(ctx,ifcElement,parentMetaObjectId){var id=ifcElement.GlobalId.value;var metaObjectType;if(this.webIfcFroMOutside)metaObjectType=this._ifcAPI.GetNameFromTypeCode(ifcElement.type);else metaObjectType=ifcElement.__proto__.constructor.name;var metaObjectName=ifcElement.Name&&ifcElement.Name.value!==""?ifcElement.Name.value:metaObjectType;var metaObject={id:id,name:metaObjectName,type:metaObjectType,parent:parentMetaObjectId};ctx.metadata.metaObjects.push(metaObject);ctx.metaObjects[id]=metaObject;ctx.stats.numMetaObjects++;}},{key:"_parseRelatedItemsOfType",value:function _parseRelatedItemsOfType(ctx,id,relation,related,type,parentMetaObjectId){var _this130=this;var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,type);for(var _i523=0;_i523<lines.size();_i523++){var relID=lines.get(_i523);var rel=this._ifcAPI.GetLine(ctx.modelID,relID);if(rel==null)return;var relatedItems=rel[relation];var foundElement=false;if(Array.isArray(relatedItems)){var values=relatedItems.map(function(item){return item.value;});foundElement=values.includes(id);}else{foundElement=relatedItems.value===id;}if(foundElement){var element=rel[related];if(!Array.isArray(element)){var ifcElement=this._ifcAPI.GetLine(ctx.modelID,element.value);if(ifcElement==null)return;this._parseSpatialChildren(ctx,ifcElement,parentMetaObjectId);}else{element.forEach(function(element2){var ifcElement=_this130._ifcAPI.GetLine(ctx.modelID,element2.value);if(ifcElement==null)return;_this130._parseSpatialChildren(ctx,ifcElement,parentMetaObjectId);});}}}}},{key:"_parsePropertySets",value:function _parsePropertySets(ctx){this.log("start parse property...");var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,this._webIFC.IFCRELDEFINESBYPROPERTIES);for(var _i524=0;_i524<lines.size();_i524++){var relID=lines.get(_i524);var rel=this._ifcAPI.GetLine(ctx.modelID,relID,true);if(rel){var relatingPropertyDefinition=rel.RelatingPropertyDefinition;if(!relatingPropertyDefinition){continue;}var propertySetId=relatingPropertyDefinition.GlobalId.value;var props=relatingPropertyDefinition.HasProperties;if(props&&props.length>0){var propertySetType="Default";var propertySetName=relatingPropertyDefinition.Name.value;var properties=[];for(var _i525=0,len=props.length;_i525<len;_i525++){var prop=props[_i525];var name=prop.Name;var nominalValue=prop.NominalValue;if(name&&nominalValue){var property={name:name.value,type:nominalValue.type,value:nominalValue.value,valueType:nominalValue.valueType};if(prop.Description){property.description=prop.Description.value;}else if(nominalValue.description){property.description=nominalValue.description;}properties.push(property);}}var propertySet={id:propertySetId,type:propertySetType,name:propertySetName,properties:properties};ctx.metadata.propertySets.push(propertySet);ctx.stats.numPropertySets++;var relatedObjects=rel.RelatedObjects;if(!relatedObjects||relatedObjects.length===0){return;}for(var _i526=0,_len107=relatedObjects.length;_i526<_len107;_i526++){var relatedObject=relatedObjects[_i526];var metaObjectId=relatedObject.GlobalId.value;var metaObject=ctx.metaObjects[metaObjectId];if(metaObject){if(!metaObject.propertySetIds){metaObject.propertySetIds=[];}metaObject.propertySetIds.push(propertySetId);}}}}}}},{key:"_parseGeometry",value:function _parseGeometry(ctx){var _this131=this;this.log("start parse geometry");this._ifcAPI.StreamAllMeshes(ctx.modelID,function(flatMesh){// TODO: Can we do geometry reuse with web-ifc?
27101
- var flatMeshExpressID=flatMesh.expressID;var placedGeometries=flatMesh.geometries;var meshIds=[];var properties=_this131._ifcAPI.GetLine(ctx.modelID,flatMeshExpressID);if(properties==null)return;var globalId=properties.GlobalId.value;if(ctx.loadMetadata){var metaObjectId=globalId;var metaObject=ctx.metaObjects[metaObjectId];if(ctx.includeTypes&&(!metaObject||!ctx.includeTypes[metaObject.type])){return;}if(ctx.excludeTypes&&(!metaObject||ctx.excludeTypes[metaObject.type])){return;}}var matrix=math.mat4();var origin=math.vec3();for(var j=0,lenj=placedGeometries.size();j<lenj;j++){var placedGeometry=placedGeometries.get(j);var geometry=_this131._ifcAPI.GetGeometry(ctx.modelID,placedGeometry.geometryExpressID);var vertexData=_this131._ifcAPI.GetVertexArray(geometry.GetVertexData(),geometry.GetVertexDataSize());var indices=_this131._ifcAPI.GetIndexArray(geometry.GetIndexData(),geometry.GetIndexDataSize());// De-interleave vertex arrays
27108
+ });}},{key:"_parseMetaObjects",value:function _parseMetaObjects(ctx){var ifcProject=this._ifcAPI.GetLine(ctx.modelID,ctx.ifcProjectId);this._parseSpatialChildren(ctx,ifcProject);}},{key:"_parseSpatialChildren",value:function _parseSpatialChildren(ctx,ifcElement,parentMetaObjectId){var metaObjectType=this._ifcAPI.GetNameFromTypeCode(ifcElement.type);if(ctx.includeTypes&&!ctx.includeTypes[metaObjectType]){return;}if(ctx.excludeTypes&&ctx.excludeTypes[metaObjectType]){return;}this._createMetaObject(ctx,ifcElement,parentMetaObjectId);var metaObjectId=ifcElement.GlobalId.value;this._parseRelatedItemsOfType(ctx,ifcElement.expressID,"RelatingObject","RelatedObjects",this._webIFC.IFCRELAGGREGATES,metaObjectId);this._parseRelatedItemsOfType(ctx,ifcElement.expressID,"RelatingStructure","RelatedElements",this._webIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE,metaObjectId);}},{key:"_createMetaObject",value:function _createMetaObject(ctx,ifcElement,parentMetaObjectId){var id=ifcElement.GlobalId.value;var metaObjectType;if(this.webIfcFroMOutside)metaObjectType=this._ifcAPI.GetNameFromTypeCode(ifcElement.type);else metaObjectType=ifcElement.__proto__.constructor.name;var metaObjectName=ifcElement.Name&&ifcElement.Name.value!==""?ifcElement.Name.value:metaObjectType;var metaObject={id:id,name:metaObjectName,type:metaObjectType,parent:parentMetaObjectId};ctx.metadata.metaObjects.push(metaObject);ctx.metaObjects[id]=metaObject;ctx.stats.numMetaObjects++;}},{key:"_parseRelatedItemsOfType",value:function _parseRelatedItemsOfType(ctx,id,relation,related,type,parentMetaObjectId){var _this131=this;var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,type);for(var _i523=0;_i523<lines.size();_i523++){var relID=lines.get(_i523);var rel=this._ifcAPI.GetLine(ctx.modelID,relID);if(rel==null)return;var relatedItems=rel[relation];var foundElement=false;if(Array.isArray(relatedItems)){var values=relatedItems.map(function(item){return item.value;});foundElement=values.includes(id);}else{foundElement=relatedItems.value===id;}if(foundElement){var element=rel[related];if(!Array.isArray(element)){var ifcElement=this._ifcAPI.GetLine(ctx.modelID,element.value);if(ifcElement==null)return;this._parseSpatialChildren(ctx,ifcElement,parentMetaObjectId);}else{element.forEach(function(element2){var ifcElement=_this131._ifcAPI.GetLine(ctx.modelID,element2.value);if(ifcElement==null)return;_this131._parseSpatialChildren(ctx,ifcElement,parentMetaObjectId);});}}}}},{key:"_parsePropertySets",value:function _parsePropertySets(ctx){this.log("start parse property...");var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,this._webIFC.IFCRELDEFINESBYPROPERTIES);for(var _i524=0;_i524<lines.size();_i524++){var relID=lines.get(_i524);var rel=this._ifcAPI.GetLine(ctx.modelID,relID,true);if(rel){var relatingPropertyDefinition=rel.RelatingPropertyDefinition;if(!relatingPropertyDefinition){continue;}var propertySetId=relatingPropertyDefinition.GlobalId.value;var props=relatingPropertyDefinition.HasProperties;if(props&&props.length>0){var propertySetType="Default";var propertySetName=relatingPropertyDefinition.Name.value;var properties=[];for(var _i525=0,len=props.length;_i525<len;_i525++){var prop=props[_i525];var name=prop.Name;var nominalValue=prop.NominalValue;if(name&&nominalValue){var property={name:name.value,type:nominalValue.type,value:nominalValue.value,valueType:nominalValue.valueType};if(prop.Description){property.description=prop.Description.value;}else if(nominalValue.description){property.description=nominalValue.description;}properties.push(property);}}var propertySet={id:propertySetId,type:propertySetType,name:propertySetName,properties:properties};ctx.metadata.propertySets.push(propertySet);ctx.stats.numPropertySets++;var relatedObjects=rel.RelatedObjects;if(!relatedObjects||relatedObjects.length===0){return;}for(var _i526=0,_len107=relatedObjects.length;_i526<_len107;_i526++){var relatedObject=relatedObjects[_i526];var metaObjectId=relatedObject.GlobalId.value;var metaObject=ctx.metaObjects[metaObjectId];if(metaObject){if(!metaObject.propertySetIds){metaObject.propertySetIds=[];}metaObject.propertySetIds.push(propertySetId);}}}}}}},{key:"_parseGeometry",value:function _parseGeometry(ctx){var _this132=this;this.log("start parse geometry");this._ifcAPI.StreamAllMeshes(ctx.modelID,function(flatMesh){// TODO: Can we do geometry reuse with web-ifc?
27109
+ var flatMeshExpressID=flatMesh.expressID;var placedGeometries=flatMesh.geometries;var meshIds=[];var properties=_this132._ifcAPI.GetLine(ctx.modelID,flatMeshExpressID);if(properties==null)return;var globalId=properties.GlobalId.value;if(ctx.loadMetadata){var metaObjectId=globalId;var metaObject=ctx.metaObjects[metaObjectId];if(ctx.includeTypes&&(!metaObject||!ctx.includeTypes[metaObject.type])){return;}if(ctx.excludeTypes&&(!metaObject||ctx.excludeTypes[metaObject.type])){return;}}var matrix=math.mat4();var origin=math.vec3();for(var j=0,lenj=placedGeometries.size();j<lenj;j++){var placedGeometry=placedGeometries.get(j);var geometry=_this132._ifcAPI.GetGeometry(ctx.modelID,placedGeometry.geometryExpressID);var vertexData=_this132._ifcAPI.GetVertexArray(geometry.GetVertexData(),geometry.GetVertexDataSize());var indices=_this132._ifcAPI.GetIndexArray(geometry.GetIndexData(),geometry.GetIndexDataSize());// De-interleave vertex arrays
27102
27110
  var positions=new Float64Array(vertexData.length/2);var normals=new Float32Array(vertexData.length/2);for(var k=0,l=0,lenk=vertexData.length/6;k<lenk;k++,l+=3){positions[l+0]=vertexData[k*6+0];positions[l+1]=vertexData[k*6+1];positions[l+2]=vertexData[k*6+2];}matrix.set(placedGeometry.flatTransformation);math.transformPositions3(matrix,positions);var rtcNeeded=worldToRTCPositions(positions,positions,origin);if(!ctx.options.autoNormals){for(var _k2=0,_l2=0,_lenk=vertexData.length/6;_k2<_lenk;_k2++,_l2+=3){normals[_l2+0]=vertexData[_k2*6+3];normals[_l2+1]=vertexData[_k2*6+4];normals[_l2+2]=vertexData[_k2*6+5];}}ctx.stats.numGeometries++;ctx.stats.numVertices+=positions.length/3;ctx.stats.numTriangles+=indices.length/3;var meshId="mesh"+ctx.nextId++;ctx.sceneModel.createMesh({id:meshId,primitive:"triangles",// TODO
27103
- origin:rtcNeeded?origin:null,positions:positions,normals:ctx.options.autoNormals?null:normals,indices:indices,color:[placedGeometry.color.x,placedGeometry.color.y,placedGeometry.color.z],opacity:placedGeometry.color.w});meshIds.push(meshId);}var entityId=ctx.options.globalizeObjectIds?math.globalizeObjectId(ctx.sceneModel.id,globalId):globalId;ctx.sceneModel.createEntity({id:entityId,meshIds:meshIds,isObject:true});ctx.stats.numObjects++;});this._ifcAPI.StreamAllMeshesWithTypes(ctx.modelID,[3856911033],function(mesh,index,total){var flatMeshExpressID=mesh.expressID;var properties=_this131._ifcAPI.GetLine(ctx.modelID,flatMeshExpressID);if(properties==null)return;var globalId=properties.GlobalId.value;var placedGeometries=mesh.geometries;var meshIds=[];var matrix=math.mat4();var origin=math.vec3();for(var j=0,lenj=placedGeometries.size();j<lenj;j++){var placedGeometry=placedGeometries.get(j);var geometry=_this131._ifcAPI.GetGeometry(ctx.modelID,placedGeometry.geometryExpressID);var vertexData=_this131._ifcAPI.GetVertexArray(geometry.GetVertexData(),geometry.GetVertexDataSize());var indices=_this131._ifcAPI.GetIndexArray(geometry.GetIndexData(),geometry.GetIndexDataSize());// De-interleave vertex arrays
27111
+ origin:rtcNeeded?origin:null,positions:positions,normals:ctx.options.autoNormals?null:normals,indices:indices,color:[placedGeometry.color.x,placedGeometry.color.y,placedGeometry.color.z],opacity:placedGeometry.color.w});meshIds.push(meshId);}var entityId=ctx.options.globalizeObjectIds?math.globalizeObjectId(ctx.sceneModel.id,globalId):globalId;ctx.sceneModel.createEntity({id:entityId,meshIds:meshIds,isObject:true});ctx.stats.numObjects++;});this._ifcAPI.StreamAllMeshesWithTypes(ctx.modelID,[3856911033],function(mesh,index,total){var flatMeshExpressID=mesh.expressID;var properties=_this132._ifcAPI.GetLine(ctx.modelID,flatMeshExpressID);if(properties==null)return;var globalId=properties.GlobalId.value;var placedGeometries=mesh.geometries;var meshIds=[];var matrix=math.mat4();var origin=math.vec3();for(var j=0,lenj=placedGeometries.size();j<lenj;j++){var placedGeometry=placedGeometries.get(j);var geometry=_this132._ifcAPI.GetGeometry(ctx.modelID,placedGeometry.geometryExpressID);var vertexData=_this132._ifcAPI.GetVertexArray(geometry.GetVertexData(),geometry.GetVertexDataSize());var indices=_this132._ifcAPI.GetIndexArray(geometry.GetIndexData(),geometry.GetIndexDataSize());// De-interleave vertex arrays
27104
27112
  var positions=new Float64Array(vertexData.length/2);var normals=new Float32Array(vertexData.length/2);for(var k=0,l=0,lenk=vertexData.length/6;k<lenk;k++,l+=3){positions[l+0]=vertexData[k*6+0];positions[l+1]=vertexData[k*6+1];positions[l+2]=vertexData[k*6+2];}matrix.set(placedGeometry.flatTransformation);math.transformPositions3(matrix,positions);var rtcNeeded=worldToRTCPositions(positions,positions,origin);if(!ctx.options.autoNormals){for(var _k3=0,_l3=0,_lenk2=vertexData.length/6;_k3<_lenk2;_k3++,_l3+=3){normals[_l3+0]=vertexData[_k3*6+3];normals[_l3+1]=vertexData[_k3*6+4];normals[_l3+2]=vertexData[_k3*6+5];}}ctx.stats.numGeometries++;ctx.stats.numVertices+=positions.length/3;ctx.stats.numTriangles+=indices.length/3;var meshId="mesh"+ctx.nextId++;ctx.sceneModel.createMesh({id:meshId,primitive:"triangles",// TODO
27105
27113
  origin:rtcNeeded?origin:null,positions:positions,normals:ctx.options.autoNormals?null:normals,indices:indices,color:[placedGeometry.color.x,placedGeometry.color.y,placedGeometry.color.z],opacity:placedGeometry.color.w<1?placedGeometry.color.w:0.1});meshIds.push(meshId);}var entityId=ctx.options.globalizeObjectIds?math.globalizeObjectId(ctx.sceneModel.id,globalId):globalId;ctx.sceneModel.createEntity({id:entityId,meshIds:meshIds,isObject:true});ctx.stats.numObjects++;});}}]);}(Plugin);
27106
27114
 
@@ -69898,9 +69906,9 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
69898
69906
  // this._objectsKdTree3 = new ObjectsKdTree3({
69899
69907
  // viewer
69900
69908
  // });
69901
- this._skyBoxTool = new _toolbar_SkyBoxTool__WEBPACK_IMPORTED_MODULE_21__["default"](this, {
69902
- src: cfg.skyBoxSrc
69903
- });
69909
+ if (cfg.skyBoxImage || cfg.skyBoxSrc) {
69910
+ this._skyBoxTool = new _toolbar_SkyBoxTool__WEBPACK_IMPORTED_MODULE_21__["default"](this, { skyBoxImage: cfg.skyBoxImage, skyBoxSrc: cfg.skyBoxSrc });
69911
+ }
69904
69912
  // this._customizeViewer();
69905
69913
  this._modelsExplorer = new _explorer_ModelsExplorer__WEBPACK_IMPORTED_MODULE_11__["default"](this, {
69906
69914
  enableEditModels: false,
@@ -70372,8 +70380,14 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
70372
70380
  * @param {Function} error Callback invoked on failure, into which the error message string is passed.
70373
70381
  */
70374
70382
  loadModel(modelId, modelBuffer, done = () => { }, error = () => { }) {
70383
+ if (!this._multiModel) {
70384
+ this._projectId = modelId;
70385
+ }
70375
70386
  this._modelsExplorer.loadModel(modelId, modelBuffer, done, error);
70376
70387
  }
70388
+ unloadModel(modelId) {
70389
+ this._modelsExplorer.unloadModel(modelId);
70390
+ }
70377
70391
  /**
70378
70392
  * 单独加载元数据
70379
70393
  * @param deflatedMetadata
@@ -70466,9 +70480,22 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
70466
70480
  };
70467
70481
  return modelInfo;
70468
70482
  }
70483
+ /**
70484
+ * 获取指定元模型对象
70485
+ * @param modelId
70486
+ * @returns
70487
+ */
70469
70488
  getMetaModel(modelId) {
70470
70489
  return this.viewer.metaScene.metaModels[modelId];
70471
70490
  }
70491
+ /**
70492
+ * 获取指定场景模型对象
70493
+ * @param modelId
70494
+ * @returns
70495
+ */
70496
+ getSceneModel(modelId) {
70497
+ return this.viewer.scene.models[modelId];
70498
+ }
70472
70499
  //------------------------------------------------------------------------------------------------------------------
70473
70500
  // 视图设置
70474
70501
  //------------------------------------------------------------------------------------------------------------------
@@ -70833,7 +70860,8 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
70833
70860
  this.measureAngleTool.destroy();
70834
70861
  this._annotationTool.destroy();
70835
70862
  this._commentsTool.destroy();
70836
- this._skyBoxTool.destroy();
70863
+ if (this._skyBoxTool)
70864
+ this._skyBoxTool.destroy();
70837
70865
  this._modelsExplorer.destroy();
70838
70866
  this._classesExplorer.destroy();
70839
70867
  this._objectsExplorer.destroy();
@@ -71358,8 +71386,15 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
71358
71386
  * @param active
71359
71387
  * @param callback
71360
71388
  */
71361
- SetSkyBoxToolActive(active = !this._skyBoxTool.getActive(), callback = () => { }) {
71362
- this._skyBoxTool.setActive(active);
71389
+ SetSkyBoxToolActive(active, callback = () => { }) {
71390
+ if (!this._skyBoxTool)
71391
+ return;
71392
+ if (active == undefined) {
71393
+ this._skyBoxTool.setActive(!this._skyBoxTool.getActive());
71394
+ }
71395
+ else {
71396
+ this._skyBoxTool.setActive(active);
71397
+ }
71363
71398
  if (callback)
71364
71399
  callback(this._sectionTool.getActive());
71365
71400
  }
@@ -71515,12 +71550,14 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
71515
71550
  done = sizeOrCallback;
71516
71551
  const { orbitYawCamera } = this;
71517
71552
  const { viewer } = this;
71518
- const canvas = document.createElement("canvas");
71519
- const ctx = canvas.getContext("2d");
71553
+ const { canvas } = viewer.scene.canvas;
71554
+ const modelId = this._projectId;
71555
+ const imgcanvas = document.createElement("canvas");
71556
+ const ctx = imgcanvas.getContext("2d");
71520
71557
  const canvasWidth = size * 15;
71521
71558
  const canvasHeight = size;
71522
- canvas.width = canvasWidth;
71523
- canvas.height = canvasHeight;
71559
+ imgcanvas.width = canvasWidth;
71560
+ imgcanvas.height = canvasHeight;
71524
71561
  const imagesPromises = Array.from({ length: 15 }, () => processImage);
71525
71562
  function processImage() {
71526
71563
  return __awaiter(this, void 0, void 0, function* () {
@@ -71534,7 +71571,6 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
71534
71571
  }
71535
71572
  function getshot(size) {
71536
71573
  return __awaiter(this, void 0, void 0, function* () {
71537
- const { canvas } = viewer.scene.canvas;
71538
71574
  const tempCanvas = document.createElement("canvas");
71539
71575
  const tempCtx = tempCanvas.getContext("2d");
71540
71576
  if (canvas && tempCtx) {
@@ -71562,7 +71598,7 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
71562
71598
  });
71563
71599
  }
71564
71600
  function handleCanvasResult(download) {
71565
- const imageData = canvas.toDataURL("image/png");
71601
+ const imageData = imgcanvas.toDataURL("image/png");
71566
71602
  if (download) {
71567
71603
  const downloadLink = document.createElement("a");
71568
71604
  downloadLink.href = imageData;
@@ -71571,7 +71607,7 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
71571
71607
  }
71572
71608
  cameraEnable(true);
71573
71609
  if (done)
71574
- done(imageData);
71610
+ done({ modelId, imageData });
71575
71611
  return imageData;
71576
71612
  }
71577
71613
  (() => __awaiter(this, void 0, void 0, function* () {
@@ -76327,22 +76363,25 @@ class MeasureAngleTool extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default
76327
76363
  this.bimViewer.on("closeAll", () => {
76328
76364
  this.setActive(false);
76329
76365
  });
76366
+ this._initSettings();
76367
+ this._initializeMeasure();
76330
76368
  this.on("active", (active) => {
76331
- if (active) {
76332
- this.initSettings();
76369
+ if (!this._isTouch) {
76370
+ this._angleMeasurementsMouseControl.active = active;
76333
76371
  }
76334
76372
  else {
76335
- this.stop();
76373
+ this._angleMeasurementsTouchControl.active = active;
76336
76374
  }
76337
76375
  });
76338
- this._initializeMeasure();
76339
76376
  }
76340
- initSettings() {
76377
+ _initSettings() {
76341
76378
  if (!this._isTouch) {
76342
76379
  this._angleMeasurementsMouseControl.activate();
76380
+ this._angleMeasurementsMouseControl.active = false;
76343
76381
  }
76344
76382
  else {
76345
76383
  this._angleMeasurementsTouchControl.activate();
76384
+ this._angleMeasurementsTouchControl.active = false;
76346
76385
  }
76347
76386
  // this.setPointerLensVisible(true);
76348
76387
  // this.setPointerLensActive(true);
@@ -76471,6 +76510,13 @@ class MeasureAngleTool extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default
76471
76510
  get offsetY() {
76472
76511
  return this._offsetY;
76473
76512
  }
76513
+ /**
76514
+ * 测量数据显隐设置
76515
+ * @param visible
76516
+ */
76517
+ setAllVisible(visible) {
76518
+ this._angleMeasurementsPlugin.setMeasurementsShown(visible);
76519
+ }
76474
76520
  /**
76475
76521
  * 设置是否自动捕捉聚焦
76476
76522
  * @param snappingEnabled
@@ -76605,7 +76651,7 @@ class MeasureAngleTool extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default
76605
76651
  }
76606
76652
  // this.setPointerLensVisible(false);
76607
76653
  // this.setPointerLensActive(false);
76608
- this.clear();
76654
+ // this.clear();
76609
76655
  }
76610
76656
  /**
76611
76657
  * destroy测量插件对象
@@ -76679,22 +76725,25 @@ class MeasureDistanceTool extends _Controller__WEBPACK_IMPORTED_MODULE_1__["defa
76679
76725
  this.bimViewer.on("closeAll", () => {
76680
76726
  this.setActive(false);
76681
76727
  });
76728
+ this._initSettings();
76729
+ this._initializeMeasure();
76682
76730
  this.on("active", (active) => {
76683
- if (active) {
76684
- this.initSettings();
76731
+ if (!this._isTouch) {
76732
+ this._distanceMeasurementsMouseControl.active = active;
76685
76733
  }
76686
76734
  else {
76687
- this.stop();
76735
+ this._distanceMeasurementsTouchControl.active = active;
76688
76736
  }
76689
76737
  });
76690
- this._initializeMeasure();
76691
76738
  }
76692
- initSettings() {
76739
+ _initSettings() {
76693
76740
  if (!this._isTouch) {
76694
76741
  this._distanceMeasurementsMouseControl.activate();
76742
+ this._distanceMeasurementsMouseControl.active = false;
76695
76743
  }
76696
76744
  else {
76697
76745
  this._distanceMeasurementsTouchControl.activate();
76746
+ this._distanceMeasurementsTouchControl.active = false;
76698
76747
  }
76699
76748
  // this.setPointerLensVisible(true);
76700
76749
  // this.setPointerLensActive(true);
@@ -76855,6 +76904,13 @@ class MeasureDistanceTool extends _Controller__WEBPACK_IMPORTED_MODULE_1__["defa
76855
76904
  get offsetY() {
76856
76905
  return this._offsetY;
76857
76906
  }
76907
+ /**
76908
+ * 测量数据显隐设置
76909
+ * @param visible
76910
+ */
76911
+ setAllVisible(visible) {
76912
+ this._distanceMeasurementsPlugin.setMeasurementsShown(visible);
76913
+ }
76858
76914
  /**
76859
76915
  * 设置是否自动捕捉聚焦
76860
76916
  * @param snappingEnabled
@@ -76989,7 +77045,7 @@ class MeasureDistanceTool extends _Controller__WEBPACK_IMPORTED_MODULE_1__["defa
76989
77045
  }
76990
77046
  // this.setPointerLensVisible(false);
76991
77047
  // this.setPointerLensActive(false);
76992
- this.clear();
77048
+ // this.clear();
76993
77049
  }
76994
77050
  /**
76995
77051
  * destroy测量插件对象
@@ -77341,17 +77397,13 @@ class SectionTool extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"] {
77341
77397
  this._isTouch = false;
77342
77398
  this.on("active", (active) => {
77343
77399
  if (active) {
77344
- // this._onHover = this.viewer.cameraControl.on("hover", (hoverResult: any) => {
77345
- // if (!hoverResult.entity) {
77346
- // }
77347
- // });
77400
+ this.showControl();
77348
77401
  }
77349
77402
  else {
77350
- this.clear();
77403
+ this.hideControl();
77351
77404
  }
77352
77405
  });
77353
77406
  this.bimViewer.on("closeAll", () => {
77354
- this.clear();
77355
77407
  this.setActive(false);
77356
77408
  });
77357
77409
  this._initSectionMode();
@@ -77547,6 +77599,7 @@ class SectionTool extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"] {
77547
77599
  for (const section in sectionPlanes) {
77548
77600
  const sectionPlane = sectionPlanes[section];
77549
77601
  sectionPlane.active = false;
77602
+ this.hideControl();
77550
77603
  }
77551
77604
  }
77552
77605
  /**
@@ -77560,8 +77613,8 @@ class SectionTool extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"] {
77560
77613
  */
77561
77614
  showControl() {
77562
77615
  const sectionPlanes = this.getSectionPlanes();
77563
- for (const plane in sectionPlanes) {
77564
- this._sectionPlanesPlugin.showControl(plane);
77616
+ for (const id in sectionPlanes) {
77617
+ sectionPlanes[id].control.setVisible(true);
77565
77618
  }
77566
77619
  }
77567
77620
  /**
@@ -77697,17 +77750,22 @@ __webpack_require__.r(__webpack_exports__);
77697
77750
  class SkyBoxTool extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"] {
77698
77751
  constructor(parent, cfg = {}) {
77699
77752
  super(parent, cfg);
77700
- const skyBoxImgSrc = cfg.src;
77701
77753
  this.skyboxesPlugin = new _xtctwins_tctwins_core__WEBPACK_IMPORTED_MODULE_0__.SkyboxesPlugin(this.viewer);
77754
+ this.on("active", (active) => {
77755
+ this.setSkyBoxActiveById();
77756
+ });
77757
+ this.createSkyBox(cfg);
77758
+ }
77759
+ createSkyBox(cfg) {
77760
+ const { skyBoxImage } = cfg;
77761
+ const { skyBoxSrc } = cfg;
77702
77762
  this.skyboxesPlugin.createSkybox("skybox1", {
77703
- src: skyBoxImgSrc,
77763
+ src: skyBoxSrc,
77764
+ image: skyBoxImage,
77704
77765
  size: 9000,
77705
77766
  scale: [1, 1],
77706
77767
  active: false
77707
77768
  });
77708
- this.on("active", (active) => {
77709
- this.setSkyBoxActiveById();
77710
- });
77711
77769
  }
77712
77770
  setSkyBoxActiveById(id = "skybox1", active = !this.getSkyBoxById(id).active) {
77713
77771
  this.skyboxesPlugin.setSkyBoxActiveById(id, active);