@xtctwins/tctwins-core 1.0.14 → 1.0.15

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.
@@ -2950,57 +2950,57 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._cornerDot.s
2950
2950
  * angleMeasurementsMouseControl.activate();
2951
2951
  * ````
2952
2952
  */var AngleMeasurementsMouseControl=/*#__PURE__*/function(_AngleMeasurementsCon){_inherits(AngleMeasurementsMouseControl,_AngleMeasurementsCon);var _super7=_createSuper(AngleMeasurementsMouseControl);/**
2953
- * Creates a AngleMeasurementsMouseControl bound to the given AngleMeasurementsPlugin.
2954
- *
2955
- * @param {AngleMeasurementsPlugin} angleMeasurementsPlugin The AngleMeasurementsPlugin to control.
2956
- * @param {*} [cfg] Configuration
2957
- * @param {PointerLens} [cfg.pointerLens] A PointerLens to use to provide a magnified view of the cursor when snapping is enabled.
2958
- * @param {boolean} [cfg.snapping=true] Whether to initially enable snap-to-vertex and snap-to-edge for this AngleMeasurementsMouseControl.
2959
- */function AngleMeasurementsMouseControl(angleMeasurementsPlugin){var _this18;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,AngleMeasurementsMouseControl);_this18=_super7.call(this,angleMeasurementsPlugin.viewer.scene);_this18.pointerLens=cfg.pointerLens;_this18._active=false;_this18._mouseState=MOUSE_FINDING_ORIGIN;_this18._currentAngleMeasurement=null;// init markerDiv element (think about making its style configurable)
2960
- _this18._initMarkerDiv();_this18._onMouseHoverSurface=null;_this18._onHoverNothing=null;_this18._onPickedNothing=null;_this18._onPickedSurface=null;_this18._onInputMouseDown=null;_this18._onInputMouseUp=null;_this18._snapping=cfg.snapping!==false;_this18._attachPlugin(angleMeasurementsPlugin,cfg);return _this18;}_createClass(AngleMeasurementsMouseControl,[{key:"_initMarkerDiv",value:function _initMarkerDiv(){var markerDiv=document.createElement('div');markerDiv.setAttribute('id','myAngleMeasureMarker');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){var element=document.getElementById('myAngleMeasureMarker');element.parentNode.removeChild(element);this.markerDiv=null;}}},{key:"_attachPlugin",value:function _attachPlugin(angleMeasurementsPlugin){var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};/**
2961
- * The {@link AngleMeasurementsPlugin} that owns this AngleMeasurementsMouseControl.
2962
- *
2963
- * @type {AngleMeasurementsPlugin}
2964
- */this.angleMeasurementsPlugin=angleMeasurementsPlugin;/**
2965
- * The {@link AngleMeasurementsPlugin} that owns this AngleMeasurementsMouseControl.
2966
- *
2967
- * @type {AngleMeasurementsPlugin}
2968
- */this.plugin=angleMeasurementsPlugin;}/**
2969
- * Gets if this AngleMeasurementsMouseControl is currently active, where it is responding to input.
2970
- *
2971
- * @returns {boolean}
2972
- */},{key:"active",get:function get(){return this._active;}/**
2973
- * Sets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
2974
- *
2975
- * This is `true` by default.
2976
- *
2977
- * Internally, this deactivates then activates the AngleMeasurementsMouseControl when changed, which means that
2978
- * it will destroy any AngleMeasurements currently under construction, and incurs some overhead, since it unbinds
2979
- * and rebinds various input handlers.
2980
- *
2981
- * @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this AngleMeasurementsMouseControl.
2982
- */},{key:"snapping",get:/**
2983
- * Gets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
2984
- *
2985
- * This is `true` by default.
2986
- *
2987
- * @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
2988
- */function get(){return this._snapping;}/**
2989
- * Activates this AngleMeasurementsMouseControl, ready to respond to input.
2990
- */,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 _this19=this;if(this._active){return;}if(!this.markerDiv){this._initMarkerDiv();// if the marker is destroyed after deactivation, we recreate it
2991
- }this.angleMeasurementsPlugin;var scene=this.scene;scene.input;var canvas=scene.canvas.canvas;var clickTolerance=20;var cameraControl=this.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(event.snappedToVertex||event.snappedToEdge){if(pointerLens){pointerLens.visible=true;pointerLens.canvasPos=event.canvasPos;pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;pointerLens.snapped=true;}_this19.markerDiv.style.background="greenyellow";_this19.markerDiv.style.border="2px solid green";}else{if(pointerLens){pointerLens.visible=true;pointerLens.canvasPos=event.canvasPos;pointerLens.snappedCanvasPos=event.canvasPos;pointerLens.snapped=false;}_this19.markerDiv.style.background="pink";_this19.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(_this19._mouseState){case MOUSE_FINDING_ORIGIN:var canvasBoundRect=canvas.getBoundingClientRect();var scrollLeft=window.pageXOffset||document.documentElement.scrollLeft;var scrollTop=window.pageYOffset||document.documentElement.scrollTop;var canvasLeftEdge=canvasBoundRect.left+scrollLeft;var canvasTopEdge=canvasBoundRect.top+scrollTop;_this19.markerDiv.style.marginLeft="".concat(canvasLeftEdge+canvasPos[0]-5,"px");_this19.markerDiv.style.marginTop="".concat(canvasTopEdge+canvasPos[1]-5,"px");break;case MOUSE_FINDING_CORNER:if(_this19._currentAngleMeasurement){_this19._currentAngleMeasurement.originWireVisible=true;_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.cornerVisible=true;_this19._currentAngleMeasurement.angleVisible=false;_this19._currentAngleMeasurement.corner.worldPos=event.worldPos;_this19._currentAngleMeasurement.corner.entity=event.entity;}_this19.markerDiv.style.marginLeft="-10000px";_this19.markerDiv.style.marginTop="-10000px";canvas.style.cursor="pointer";break;case MOUSE_FINDING_TARGET:if(_this19._currentAngleMeasurement){_this19._currentAngleMeasurement.targetWireVisible=true;_this19._currentAngleMeasurement.targetVisible=true;_this19._currentAngleMeasurement.angleVisible=true;_this19._currentAngleMeasurement.target.worldPos=event.worldPos;_this19._currentAngleMeasurement.target.entity=event.entity;}_this19.markerDiv.style.marginLeft="-10000px";_this19.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(e.which!==1){return;}if(e.clientX>lastMouseCanvasX+clickTolerance||e.clientX<lastMouseCanvasX-clickTolerance||e.clientY>lastMouseCanvasY+clickTolerance||e.clientY<lastMouseCanvasY-clickTolerance){return;}switch(_this19._mouseState){case MOUSE_FINDING_ORIGIN:if(mouseHovering){_this19._currentAngleMeasurement=_this19.angleMeasurementsPlugin.createMeasurement({id:math.createUUID(),origin:{worldPos:mouseWorldPos},corner:{worldPos:mouseWorldPos},target:{worldPos:mouseWorldPos},approximate:true});_this19._currentAngleMeasurement.clickable=false;_this19._currentAngleMeasurement.originVisible=true;_this19._currentAngleMeasurement.originWireVisible=true;_this19._currentAngleMeasurement.cornerVisible=false;_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.targetVisible=false;_this19._currentAngleMeasurement.angleVisible=false;_this19._currentAngleMeasurement.origin.entity=hoveredEntity;_this19._mouseState=MOUSE_FINDING_CORNER;_this19.angleMeasurementsPlugin.fire("measurementStart",_this19._currentAngleMeasurement);}break;case MOUSE_FINDING_CORNER:if(mouseHovering){_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.targetVisible=true;_this19._currentAngleMeasurement.angleVisible=true;_this19._currentAngleMeasurement.corner.entity=hoveredEntity;_this19._mouseState=MOUSE_FINDING_TARGET;}else{if(_this19._currentAngleMeasurement){_this19._currentAngleMeasurement.destroy();_this19._currentAngleMeasurement=null;hoveredEntity=null;_this19._mouseState=MOUSE_FINDING_ORIGIN;_this19.angleMeasurementsPlugin.fire("measurementCancel",_this19._currentAngleMeasurement);}}break;case MOUSE_FINDING_TARGET:if(mouseHovering){_this19._currentAngleMeasurement.targetVisible=true;_this19._currentAngleMeasurement.angleVisible=true;_this19._currentAngleMeasurement.target.entity=hoveredEntity;_this19._currentAngleMeasurement.clickable=true;hoveredEntity=null;_this19.angleMeasurementsPlugin.fire("measurementEnd",_this19._currentAngleMeasurement);_this19._currentAngleMeasurement=null;_this19._mouseState=MOUSE_FINDING_ORIGIN;}else{if(_this19._currentAngleMeasurement){_this19._currentAngleMeasurement.destroy();_this19._currentAngleMeasurement=null;hoveredEntity=null;_this19._mouseState=MOUSE_FINDING_ORIGIN;_this19.angleMeasurementsPlugin.fire("measurementCancel",_this19._currentAngleMeasurement);}}break;}});this._onMouseHoverOff=cameraControl.on(this._snapping?"hoverSnapOrSurfaceOff":"hoverOff",function(event){mouseHovering=false;if(pointerLens){pointerLens.visible=true;pointerLens.pointerPos=event.canvasPos;pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;pointerLens.snapped=false;}_this19.markerDiv.style.marginLeft="-100px";_this19.markerDiv.style.marginTop="-100px";if(_this19._currentAngleMeasurement){switch(_this19._mouseState){case MOUSE_FINDING_ORIGIN:_this19._currentAngleMeasurement.originVisible=false;break;case MOUSE_FINDING_CORNER:_this19._currentAngleMeasurement.cornerVisible=false;_this19._currentAngleMeasurement.originWireVisible=false;_this19._currentAngleMeasurement.targetVisible=false;_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.angleVisible=false;break;case MOUSE_FINDING_TARGET:_this19._currentAngleMeasurement.targetVisible=false;_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.angleVisible=false;break;}canvas.style.cursor="default";}});this._active=true;}/**
2992
- * Deactivates this AngleMeasurementsMouseControl, making it unresponsive to input.
2993
- *
2994
- * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl.
2995
- */},{key:"deactivate",value:function deactivate(){if(!this._active){return;}if(this.pointerLens){this.pointerLens.visible=false;}if(this.markerDiv){this._destroyMarkerDiv();}this.reset();var canvas=this.scene.canvas.canvas;canvas.removeEventListener("mousedown",this._onMouseDown);canvas.removeEventListener("mouseup",this._onMouseUp);var cameraControl=this.angleMeasurementsPlugin.viewer.cameraControl;cameraControl.off(this._onMouseHoverSurface);cameraControl.off(this._onPickedSurface);cameraControl.off(this._onHoverNothing);cameraControl.off(this._onPickedNothing);this._currentAngleMeasurement=null;this._active=false;}/**
2996
- * Resets this AngleMeasurementsMouseControl.
2997
- *
2998
- * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl.
2999
- *
3000
- * Does nothing if the AngleMeasurementsMouseControl is not active.
3001
- */},{key:"reset",value:function reset(){if(!this._active){return;}this._destroyMarkerDiv();this._initMarkerDiv();if(this._currentAngleMeasurement){this._currentAngleMeasurement.destroy();this._currentAngleMeasurement=null;}this._mouseState=MOUSE_FINDING_ORIGIN;}/**
3002
- * Destroys this AngleMeasurementsMouseControl.
3003
- */},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(AngleMeasurementsMouseControl.prototype),"destroy",this).call(this);}}]);return AngleMeasurementsMouseControl;}(AngleMeasurementsControl);/**
2953
+ * Creates a AngleMeasurementsMouseControl bound to the given AngleMeasurementsPlugin.
2954
+ *
2955
+ * @param {AngleMeasurementsPlugin} angleMeasurementsPlugin The AngleMeasurementsPlugin to control.
2956
+ * @param {*} [cfg] Configuration
2957
+ * @param {PointerLens} [cfg.pointerLens] A PointerLens to use to provide a magnified view of the cursor when snapping is enabled.
2958
+ * @param {boolean} [cfg.snapping=true] Whether to initially enable snap-to-vertex and snap-to-edge for this AngleMeasurementsMouseControl.
2959
+ */function AngleMeasurementsMouseControl(angleMeasurementsPlugin){var _this18;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,AngleMeasurementsMouseControl);_this18=_super7.call(this,angleMeasurementsPlugin.viewer.scene);_this18.pointerLens=cfg.pointerLens;_this18._active=false;_this18._mouseState=MOUSE_FINDING_ORIGIN;_this18._currentAngleMeasurement=null;// init markerDiv element (think about making its style configurable)
2960
+ _this18._initMarkerDiv();_this18._onMouseHoverSurface=null;_this18._onHoverNothing=null;_this18._onPickedNothing=null;_this18._onPickedSurface=null;_this18._onInputMouseDown=null;_this18._onInputMouseUp=null;_this18._snapping=cfg.snapping!==false;_this18._attachPlugin(angleMeasurementsPlugin,cfg);return _this18;}_createClass(AngleMeasurementsMouseControl,[{key:"_initMarkerDiv",value:function _initMarkerDiv(){var markerDiv=document.createElement("div");markerDiv.setAttribute("id","myAngleMeasureMarker");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){var element=document.getElementById("myAngleMeasureMarker");element.parentNode.removeChild(element);this.markerDiv=null;}}},{key:"_attachPlugin",value:function _attachPlugin(angleMeasurementsPlugin){var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};/**
2961
+ * The {@link AngleMeasurementsPlugin} that owns this AngleMeasurementsMouseControl.
2962
+ *
2963
+ * @type {AngleMeasurementsPlugin}
2964
+ */this.angleMeasurementsPlugin=angleMeasurementsPlugin;/**
2965
+ * The {@link AngleMeasurementsPlugin} that owns this AngleMeasurementsMouseControl.
2966
+ *
2967
+ * @type {AngleMeasurementsPlugin}
2968
+ */this.plugin=angleMeasurementsPlugin;}/**
2969
+ * Gets if this AngleMeasurementsMouseControl is currently active, where it is responding to input.
2970
+ *
2971
+ * @returns {boolean}
2972
+ */},{key:"active",get:function get(){return this._active;}/**
2973
+ * Sets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
2974
+ *
2975
+ * This is `true` by default.
2976
+ *
2977
+ * Internally, this deactivates then activates the AngleMeasurementsMouseControl when changed, which means that
2978
+ * it will destroy any AngleMeasurements currently under construction, and incurs some overhead, since it unbinds
2979
+ * and rebinds various input handlers.
2980
+ *
2981
+ * @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this AngleMeasurementsMouseControl.
2982
+ */},{key:"snapping",get:/**
2983
+ * Gets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
2984
+ *
2985
+ * This is `true` by default.
2986
+ *
2987
+ * @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
2988
+ */function get(){return this._snapping;}/**
2989
+ * Activates this AngleMeasurementsMouseControl, ready to respond to input.
2990
+ */,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 _this19=this;if(this._active){return;}if(!this.markerDiv){this._initMarkerDiv();// if the marker is destroyed after deactivation, we recreate it
2991
+ }this.angleMeasurementsPlugin;var scene=this.scene;scene.input;var canvas=scene.canvas.canvas;var clickTolerance=20;var cameraControl=this.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(event.snappedToVertex||event.snappedToEdge){if(pointerLens){pointerLens.visible=true;pointerLens.canvasPos=event.canvasPos;pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;pointerLens.snapped=true;}_this19.markerDiv.style.background="greenyellow";_this19.markerDiv.style.border="2px solid green";}else{if(pointerLens){pointerLens.visible=true;pointerLens.canvasPos=event.canvasPos;pointerLens.snappedCanvasPos=event.canvasPos;pointerLens.snapped=false;}_this19.markerDiv.style.background="pink";_this19.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(_this19._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;_this19.markerDiv.style.marginLeft="".concat(canvasLeftEdge+canvasPos[0]-5,"px");_this19.markerDiv.style.marginTop="".concat(canvasTopEdge+canvasPos[1]-5,"px");break;case MOUSE_FINDING_CORNER:if(_this19._currentAngleMeasurement){_this19._currentAngleMeasurement.originWireVisible=true;_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.cornerVisible=true;_this19._currentAngleMeasurement.angleVisible=false;_this19._currentAngleMeasurement.corner.worldPos=event.worldPos;_this19._currentAngleMeasurement.corner.entity=event.entity;}_this19.markerDiv.style.marginLeft="-10000px";_this19.markerDiv.style.marginTop="-10000px";canvas.style.cursor="pointer";break;case MOUSE_FINDING_TARGET:if(_this19._currentAngleMeasurement){_this19._currentAngleMeasurement.targetWireVisible=true;_this19._currentAngleMeasurement.targetVisible=true;_this19._currentAngleMeasurement.angleVisible=true;_this19._currentAngleMeasurement.target.worldPos=event.worldPos;_this19._currentAngleMeasurement.target.entity=event.entity;}_this19.markerDiv.style.marginLeft="-10000px";_this19.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(e.which!==1){return;}if(e.clientX>lastMouseCanvasX+clickTolerance||e.clientX<lastMouseCanvasX-clickTolerance||e.clientY>lastMouseCanvasY+clickTolerance||e.clientY<lastMouseCanvasY-clickTolerance){return;}switch(_this19._mouseState){case MOUSE_FINDING_ORIGIN:if(mouseHovering){_this19._currentAngleMeasurement=_this19.angleMeasurementsPlugin.createMeasurement({id:math.createUUID(),origin:{worldPos:mouseWorldPos},corner:{worldPos:mouseWorldPos},target:{worldPos:mouseWorldPos},approximate:true});_this19._currentAngleMeasurement.clickable=false;_this19._currentAngleMeasurement.originVisible=true;_this19._currentAngleMeasurement.originWireVisible=true;_this19._currentAngleMeasurement.cornerVisible=false;_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.targetVisible=false;_this19._currentAngleMeasurement.angleVisible=false;_this19._currentAngleMeasurement.origin.entity=hoveredEntity;_this19._mouseState=MOUSE_FINDING_CORNER;_this19.angleMeasurementsPlugin.fire("measurementStart",_this19._currentAngleMeasurement);}break;case MOUSE_FINDING_CORNER:if(mouseHovering){_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.targetVisible=true;_this19._currentAngleMeasurement.angleVisible=true;_this19._currentAngleMeasurement.corner.entity=hoveredEntity;_this19._mouseState=MOUSE_FINDING_TARGET;}else{if(_this19._currentAngleMeasurement){_this19._currentAngleMeasurement.destroy();_this19._currentAngleMeasurement=null;hoveredEntity=null;_this19._mouseState=MOUSE_FINDING_ORIGIN;_this19.angleMeasurementsPlugin.fire("measurementCancel",_this19._currentAngleMeasurement);}}break;case MOUSE_FINDING_TARGET:if(mouseHovering){_this19._currentAngleMeasurement.targetVisible=true;_this19._currentAngleMeasurement.angleVisible=true;_this19._currentAngleMeasurement.target.entity=hoveredEntity;_this19._currentAngleMeasurement.clickable=true;hoveredEntity=null;_this19.angleMeasurementsPlugin.fire("measurementEnd",_this19._currentAngleMeasurement);_this19._currentAngleMeasurement=null;_this19._mouseState=MOUSE_FINDING_ORIGIN;}else{if(_this19._currentAngleMeasurement){_this19._currentAngleMeasurement.destroy();_this19._currentAngleMeasurement=null;hoveredEntity=null;_this19._mouseState=MOUSE_FINDING_ORIGIN;_this19.angleMeasurementsPlugin.fire("measurementCancel",_this19._currentAngleMeasurement);}}break;}});this._onMouseHoverOff=cameraControl.on(this._snapping?"hoverSnapOrSurfaceOff":"hoverOff",function(event){mouseHovering=false;if(pointerLens){pointerLens.visible=true;pointerLens.pointerPos=event.canvasPos;pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;pointerLens.snapped=false;}_this19.markerDiv.style.marginLeft="-100px";_this19.markerDiv.style.marginTop="-100px";if(_this19._currentAngleMeasurement){switch(_this19._mouseState){case MOUSE_FINDING_ORIGIN:_this19._currentAngleMeasurement.originVisible=false;break;case MOUSE_FINDING_CORNER:_this19._currentAngleMeasurement.cornerVisible=false;_this19._currentAngleMeasurement.originWireVisible=false;_this19._currentAngleMeasurement.targetVisible=false;_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.angleVisible=false;break;case MOUSE_FINDING_TARGET:_this19._currentAngleMeasurement.targetVisible=false;_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.angleVisible=false;break;}canvas.style.cursor="default";}});this._active=true;}/**
2992
+ * Deactivates this AngleMeasurementsMouseControl, making it unresponsive to input.
2993
+ *
2994
+ * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl.
2995
+ */},{key:"deactivate",value:function deactivate(){if(!this._active){return;}if(this.pointerLens){this.pointerLens.visible=false;}if(this.markerDiv){this._destroyMarkerDiv();}this.reset();var canvas=this.scene.canvas.canvas;canvas.removeEventListener("mousedown",this._onMouseDown);canvas.removeEventListener("mouseup",this._onMouseUp);var cameraControl=this.angleMeasurementsPlugin.viewer.cameraControl;cameraControl.off(this._onMouseHoverSurface);cameraControl.off(this._onPickedSurface);cameraControl.off(this._onHoverNothing);cameraControl.off(this._onPickedNothing);this._currentAngleMeasurement=null;this._active=false;}/**
2996
+ * Resets this AngleMeasurementsMouseControl.
2997
+ *
2998
+ * Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl.
2999
+ *
3000
+ * Does nothing if the AngleMeasurementsMouseControl is not active.
3001
+ */},{key:"reset",value:function reset(){if(!this._active){return;}this._destroyMarkerDiv();this._initMarkerDiv();if(this._currentAngleMeasurement){this._currentAngleMeasurement.destroy();this._currentAngleMeasurement=null;}this._mouseState=MOUSE_FINDING_ORIGIN;}/**
3002
+ * Destroys this AngleMeasurementsMouseControl.
3003
+ */},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(AngleMeasurementsMouseControl.prototype),"destroy",this).call(this);}}]);return AngleMeasurementsMouseControl;}(AngleMeasurementsControl);/**
3004
3004
  * {@link Viewer} plugin for measuring angles.
3005
3005
  *
3006
3006
  * [<img src="https://user-images.githubusercontent.com/83100/63641903-61488180-c6b6-11e9-8e00-895b9d16dc4b.gif">](https://xeokit.github.io/xeokit-sdk/examples/#measurements_angle_createWithMouse)
@@ -18709,11 +18709,11 @@ origin:eye,direction:look});look=hit?hit.worldPos:math.addVec3(eye,look,tempVec3
18709
18709
  */function DistanceMeasurement(plugin){var _this80;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,DistanceMeasurement);_this80=_super115.call(this,plugin.viewer.scene,cfg);/**
18710
18710
  * The {@link DistanceMeasurementsPlugin} that owns this DistanceMeasurement.
18711
18711
  * @type {DistanceMeasurementsPlugin}
18712
- */_this80.plugin=plugin;_this80._container=cfg.container;if(!_this80._container){throw"config missing: container";}_this80._eventSubs={};var scene=_this80.plugin.viewer.scene;_this80._originMarker=new Marker(scene,cfg.origin);_this80._targetMarker=new Marker(scene,cfg.target);_this80._originWorld=math.vec3();_this80._targetWorld=math.vec3();_this80._wp=new Float64Array(24);_this80._vp=new Float64Array(24);_this80._pp=new Float64Array(24);_this80._cp=new Float64Array(8);_this80._xAxisLabelCulled=false;_this80._yAxisLabelCulled=false;_this80._zAxisLabelCulled=false;_this80._color=cfg.color||_this80.plugin.defaultColor;var onMouseOver=cfg.onMouseOver?function(event){cfg.onMouseOver(event,_assertThisInitialized(_this80));_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseover',event));}:null;var onMouseLeave=cfg.onMouseLeave?function(event){cfg.onMouseLeave(event,_assertThisInitialized(_this80));_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseleave',event));}:null;var onMouseDown=function onMouseDown(event){_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mousedown',event));};var onMouseUp=function onMouseUp(event){_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseup',event));};var onMouseMove=function onMouseMove(event){_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mousemove',event));};var onContextMenu=cfg.onContextMenu?function(event){cfg.onContextMenu(event,_assertThisInitialized(_this80));}:null;var onMouseWheel=function onMouseWheel(event){_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent('wheel',event));};_this80._originDot=new Dot(_this80._container,{fillColor:_this80._color,zIndex:plugin.zIndex!==undefined?plugin.zIndex+2:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._targetDot=new Dot(_this80._container,{fillColor:_this80._color,zIndex:plugin.zIndex!==undefined?plugin.zIndex+2:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._lengthWire=new Wire(_this80._container,{color:_this80._color,thickness:2,thicknessClickable:6,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._xAxisWire=new Wire(_this80._container,{color:"#FF0000",thickness:1,thicknessClickable:6,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._yAxisWire=new Wire(_this80._container,{color:"green",thickness:1,thicknessClickable:6,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._zAxisWire=new Wire(_this80._container,{color:"blue",thickness:1,thicknessClickable:6,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._lengthLabel=new Label(_this80._container,{fillColor:_this80._color,prefix:"",text:"",zIndex:plugin.zIndex!==undefined?plugin.zIndex+4:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._xAxisLabel=new Label(_this80._container,{fillColor:"red",prefix:"X",text:"",zIndex:plugin.zIndex!==undefined?plugin.zIndex+3:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._yAxisLabel=new Label(_this80._container,{fillColor:"green",prefix:"Y",text:"",zIndex:plugin.zIndex!==undefined?plugin.zIndex+3:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._zAxisLabel=new Label(_this80._container,{fillColor:"blue",prefix:"Z",text:"",zIndex:plugin.zIndex!==undefined?plugin.zIndex+3:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._wpDirty=false;_this80._vpDirty=false;_this80._cpDirty=false;_this80._sectionPlanesDirty=true;_this80._visible=false;_this80._originVisible=false;_this80._targetVisible=false;_this80._wireVisible=false;_this80._axisVisible=false;_this80._xAxisVisible=false;_this80._yAxisVisible=false;_this80._zAxisVisible=false;_this80._axisEnabled=true;_this80._labelsVisible=false;_this80._clickable=false;_this80._originMarker.on("worldPos",function(value){_this80._originWorld.set(value||[0,0,0]);_this80._wpDirty=true;_this80._needUpdate(0);// No lag
18712
+ */_this80.plugin=plugin;_this80._container=cfg.container;if(!_this80._container){throw"config missing: container";}_this80._eventSubs={};var scene=_this80.plugin.viewer.scene;_this80._originMarker=new Marker(scene,cfg.origin);_this80._targetMarker=new Marker(scene,cfg.target);_this80._originWorld=math.vec3();_this80._targetWorld=math.vec3();_this80._wp=new Float64Array(24);_this80._vp=new Float64Array(24);_this80._pp=new Float64Array(24);_this80._cp=new Float64Array(8);_this80._xAxisLabelCulled=false;_this80._yAxisLabelCulled=false;_this80._zAxisLabelCulled=false;_this80._color=cfg.color||_this80.plugin.defaultColor;var onMouseOver=cfg.onMouseOver?function(event){cfg.onMouseOver(event,_assertThisInitialized(_this80));_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseover',event));}:null;var onMouseLeave=cfg.onMouseLeave?function(event){cfg.onMouseLeave(event,_assertThisInitialized(_this80));_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseleave',event));}:null;var onMouseDown=function onMouseDown(event){_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mousedown',event));};var onMouseUp=function onMouseUp(event){_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseup',event));};var onMouseMove=function onMouseMove(event){_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mousemove',event));};var onContextMenu=cfg.onContextMenu?function(event){cfg.onContextMenu(event,_assertThisInitialized(_this80));}:null;var onMouseWheel=function onMouseWheel(event){_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent('wheel',event));};_this80._originDot=new Dot(_this80._container,{fillColor:_this80._color,zIndex:plugin.zIndex!==undefined?plugin.zIndex+2:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._targetDot=new Dot(_this80._container,{fillColor:_this80._color,zIndex:plugin.zIndex!==undefined?plugin.zIndex+2:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._lengthWire=new Wire(_this80._container,{color:_this80._color,thickness:2,thicknessClickable:6,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._xAxisWire=new Wire(_this80._container,{color:"#FF0000",thickness:1,thicknessClickable:6,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._yAxisWire=new Wire(_this80._container,{color:"green",thickness:1,thicknessClickable:6,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._zAxisWire=new Wire(_this80._container,{color:"blue",thickness:1,thicknessClickable:6,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._lengthLabel=new Label(_this80._container,{fillColor:_this80._color,prefix:"",text:"",zIndex:plugin.zIndex!==undefined?plugin.zIndex+4:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._xAxisLabel=new Label(_this80._container,{fillColor:"red",prefix:"X",text:"",zIndex:plugin.zIndex!==undefined?plugin.zIndex+3:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._yAxisLabel=new Label(_this80._container,{fillColor:"green",prefix:"Y",text:"",zIndex:plugin.zIndex!==undefined?plugin.zIndex+3:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._zAxisLabel=new Label(_this80._container,{fillColor:"blue",prefix:"Z",text:"",zIndex:plugin.zIndex!==undefined?plugin.zIndex+3:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._wpDirty=false;_this80._vpDirty=false;_this80._cpDirty=false;_this80._sectionPlanesDirty=true;_this80._visible=false;_this80._originVisible=false;_this80._targetVisible=false;_this80._wireVisible=false;_this80._axisVisible=false;_this80._xAxisVisible=false;_this80._yAxisVisible=false;_this80._zAxisVisible=false;_this80._axisEnabled=true;_this80._labelsVisible=false;_this80._labelsOnWires=false;_this80._clickable=false;_this80._originMarker.on("worldPos",function(value){_this80._originWorld.set(value||[0,0,0]);_this80._wpDirty=true;_this80._needUpdate(0);// No lag
18713
18713
  });_this80._targetMarker.on("worldPos",function(value){_this80._targetWorld.set(value||[0,0,0]);_this80._wpDirty=true;_this80._needUpdate(0);// No lag
18714
18714
  });_this80._onViewMatrix=scene.camera.on("viewMatrix",function(){_this80._vpDirty=true;_this80._needUpdate(0);// No lag
18715
18715
  });_this80._onProjMatrix=scene.camera.on("projMatrix",function(){_this80._cpDirty=true;_this80._needUpdate();});_this80._onCanvasBoundary=scene.canvas.on("boundary",function(){_this80._cpDirty=true;_this80._needUpdate(0);// No lag
18716
- });_this80._onMetricsUnits=scene.metrics.on("units",function(){_this80._cpDirty=true;_this80._needUpdate();});_this80._onMetricsScale=scene.metrics.on("scale",function(){_this80._cpDirty=true;_this80._needUpdate();});_this80._onMetricsOrigin=scene.metrics.on("origin",function(){_this80._cpDirty=true;_this80._needUpdate();});_this80._onSectionPlaneUpdated=scene.on("sectionPlaneUpdated",function(){_this80._sectionPlanesDirty=true;_this80._needUpdate();});_this80.approximate=cfg.approximate;_this80.visible=cfg.visible;_this80.originVisible=cfg.originVisible;_this80.targetVisible=cfg.targetVisible;_this80.wireVisible=cfg.wireVisible;_this80.axisVisible=cfg.axisVisible;_this80.xAxisVisible=cfg.xAxisVisible;_this80.yAxisVisible=cfg.yAxisVisible;_this80.zAxisVisible=cfg.zAxisVisible;_this80.labelsVisible=cfg.labelsVisible;return _this80;}_createClass(DistanceMeasurement,[{key:"_update",value:function _update(){if(!this._visible){return;}var scene=this.plugin.viewer.scene;if(this._wpDirty){this._wp[0]=this._originWorld[0];this._wp[1]=this._originWorld[1];this._wp[2]=this._originWorld[2];this._wp[3]=1.0;this._wp[4]=this._targetWorld[0];this._wp[5]=this._originWorld[1];this._wp[6]=this._originWorld[2];this._wp[7]=1.0;this._wp[8]=this._targetWorld[0];this._wp[9]=this._targetWorld[1];this._wp[10]=this._originWorld[2];this._wp[11]=1.0;this._wp[12]=this._targetWorld[0];this._wp[13]=this._targetWorld[1];this._wp[14]=this._targetWorld[2];this._wp[15]=1.0;this._wpDirty=false;this._vpDirty=true;}if(this._vpDirty){math.transformPositions4(scene.camera.viewMatrix,this._wp,this._vp);this._vp[3]=1.0;this._vp[7]=1.0;this._vp[11]=1.0;this._vp[15]=1.0;this._vpDirty=false;this._cpDirty=true;}if(this._sectionPlanesDirty){if(this._isSliced(this._wp)){this._xAxisLabel.setCulled(true);this._yAxisLabel.setCulled(true);this._zAxisLabel.setCulled(true);this._lengthLabel.setCulled(true);this._xAxisWire.setCulled(true);this._yAxisWire.setCulled(true);this._zAxisWire.setCulled(true);this._lengthWire.setCulled(true);this._originDot.setCulled(true);this._targetDot.setCulled(true);return;}else{this._xAxisLabel.setCulled(false);this._yAxisLabel.setCulled(false);this._zAxisLabel.setCulled(false);this._lengthLabel.setCulled(false);this._xAxisWire.setCulled(false);this._yAxisWire.setCulled(false);this._zAxisWire.setCulled(false);this._lengthWire.setCulled(false);this._originDot.setCulled(false);this._targetDot.setCulled(false);}this._sectionPlanesDirty=true;}var near=-0.3;var vpz1=this._originMarker.viewPos[2];var vpz2=this._targetMarker.viewPos[2];if(vpz1>near||vpz2>near){this._xAxisLabel.setCulled(true);this._yAxisLabel.setCulled(true);this._zAxisLabel.setCulled(true);this._lengthLabel.setCulled(true);this._xAxisWire.setVisible(false);this._yAxisWire.setVisible(false);this._zAxisWire.setVisible(false);this._lengthWire.setVisible(false);this._originDot.setVisible(false);this._targetDot.setVisible(false);return;}if(this._cpDirty){math.transformPositions4(scene.camera.project.matrix,this._vp,this._pp);var pp=this._pp;var cp=this._cp;var canvas=scene.canvas.canvas;var offsets=canvas.getBoundingClientRect();var containerOffsets=this._container.getBoundingClientRect();var top=offsets.top-containerOffsets.top;var left=offsets.left-containerOffsets.left;var aabb=scene.canvas.boundary;var canvasWidth=aabb[2];var canvasHeight=aabb[3];var j=0;var metrics=this.plugin.viewer.scene.metrics;var _scale5=metrics.scale;var units=metrics.units;var unitInfo=metrics.unitsInfo[units];var unitAbbrev=unitInfo.abbrev;for(var i=0,len=pp.length;i<len;i+=4){cp[j]=left+Math.floor((1+pp[i+0]/pp[i+3])*canvasWidth/2);cp[j+1]=top+Math.floor((1-pp[i+1]/pp[i+3])*canvasHeight/2);j+=2;}this._originDot.setPos(cp[0],cp[1]);this._targetDot.setPos(cp[6],cp[7]);this._lengthWire.setStartAndEnd(cp[0],cp[1],cp[6],cp[7]);this._xAxisWire.setStartAndEnd(cp[0],cp[1],cp[2],cp[3]);this._yAxisWire.setStartAndEnd(cp[2],cp[3],cp[4],cp[5]);this._zAxisWire.setStartAndEnd(cp[4],cp[5],cp[6],cp[7]);if(!this.labelsVisible){this._lengthLabel.setCulled(true);this._xAxisLabel.setCulled(true);this._yAxisLabel.setCulled(true);this._zAxisLabel.setCulled(true);}else{this._lengthLabel.setPosOnWire(cp[0],cp[1],cp[6],cp[7]);this._xAxisLabel.setPosOnWire(cp[0],cp[1],cp[2],cp[3]);this._yAxisLabel.setPosOnWire(cp[2],cp[3],cp[4],cp[5]);this._zAxisLabel.setPosOnWire(cp[4],cp[5],cp[6],cp[7]);var tilde=this._approximate?" ~ ":" = ";this._length=Math.abs(math.lenVec3(math.subVec3(this._targetWorld,this._originWorld,distVec3)));this._lengthLabel.setText(tilde+(this._length*_scale5).toFixed(2)+unitAbbrev);var xAxisCanvasLength=Math.abs(lengthWire(cp[0],cp[1],cp[2],cp[3]));var yAxisCanvasLength=Math.abs(lengthWire(cp[2],cp[3],cp[4],cp[5]));var zAxisCanvasLength=Math.abs(lengthWire(cp[4],cp[5],cp[6],cp[7]));var labelMinAxisLength=this.plugin.labelMinAxisLength;this._xAxisLabelCulled=xAxisCanvasLength<labelMinAxisLength;this._yAxisLabelCulled=yAxisCanvasLength<labelMinAxisLength;this._zAxisLabelCulled=zAxisCanvasLength<labelMinAxisLength;if(!this._xAxisLabelCulled){this._xAxisLabel.setText(tilde+Math.abs((this._targetWorld[0]-this._originWorld[0])*_scale5).toFixed(2)+unitAbbrev);this._xAxisLabel.setCulled(!this.axisVisible);}else{this._xAxisLabel.setCulled(true);}if(!this._yAxisLabelCulled){this._yAxisLabel.setText(tilde+Math.abs((this._targetWorld[1]-this._originWorld[1])*_scale5).toFixed(2)+unitAbbrev);this._yAxisLabel.setCulled(!this.axisVisible);}else{this._yAxisLabel.setCulled(true);}if(!this._zAxisLabelCulled){this._zAxisLabel.setText(tilde+Math.abs((this._targetWorld[2]-this._originWorld[2])*_scale5).toFixed(2)+unitAbbrev);this._zAxisLabel.setCulled(!this.axisVisible);}else{this._zAxisLabel.setCulled(true);}}// this._xAxisLabel.setVisible(this.axisVisible && this.xAxisVisible);
18716
+ });_this80._onMetricsUnits=scene.metrics.on("units",function(){_this80._cpDirty=true;_this80._needUpdate();});_this80._onMetricsScale=scene.metrics.on("scale",function(){_this80._cpDirty=true;_this80._needUpdate();});_this80._onMetricsOrigin=scene.metrics.on("origin",function(){_this80._cpDirty=true;_this80._needUpdate();});_this80._onSectionPlaneUpdated=scene.on("sectionPlaneUpdated",function(){_this80._sectionPlanesDirty=true;_this80._needUpdate();});_this80.approximate=cfg.approximate;_this80.visible=cfg.visible;_this80.originVisible=cfg.originVisible;_this80.targetVisible=cfg.targetVisible;_this80.wireVisible=cfg.wireVisible;_this80.axisVisible=cfg.axisVisible;_this80.xAxisVisible=cfg.xAxisVisible;_this80.yAxisVisible=cfg.yAxisVisible;_this80.zAxisVisible=cfg.zAxisVisible;_this80.labelsVisible=cfg.labelsVisible;_this80.labelsOnWires=cfg.labelsOnWires;return _this80;}_createClass(DistanceMeasurement,[{key:"_update",value:function _update(){if(!this._visible){return;}var scene=this.plugin.viewer.scene;if(this._wpDirty){this._wp[0]=this._originWorld[0];this._wp[1]=this._originWorld[1];this._wp[2]=this._originWorld[2];this._wp[3]=1.0;this._wp[4]=this._targetWorld[0];this._wp[5]=this._originWorld[1];this._wp[6]=this._originWorld[2];this._wp[7]=1.0;this._wp[8]=this._targetWorld[0];this._wp[9]=this._targetWorld[1];this._wp[10]=this._originWorld[2];this._wp[11]=1.0;this._wp[12]=this._targetWorld[0];this._wp[13]=this._targetWorld[1];this._wp[14]=this._targetWorld[2];this._wp[15]=1.0;this._wpDirty=false;this._vpDirty=true;}if(this._vpDirty){math.transformPositions4(scene.camera.viewMatrix,this._wp,this._vp);this._vp[3]=1.0;this._vp[7]=1.0;this._vp[11]=1.0;this._vp[15]=1.0;this._vpDirty=false;this._cpDirty=true;}if(this._sectionPlanesDirty){if(this._isSliced(this._originWorld)||this._isSliced(this._targetWorld)){this._xAxisLabel.setCulled(true);this._yAxisLabel.setCulled(true);this._zAxisLabel.setCulled(true);this._lengthLabel.setCulled(true);this._xAxisWire.setCulled(true);this._yAxisWire.setCulled(true);this._zAxisWire.setCulled(true);this._lengthWire.setCulled(true);this._originDot.setCulled(true);this._targetDot.setCulled(true);return;}else{this._xAxisLabel.setCulled(false);this._yAxisLabel.setCulled(false);this._zAxisLabel.setCulled(false);this._lengthLabel.setCulled(false);this._xAxisWire.setCulled(false);this._yAxisWire.setCulled(false);this._zAxisWire.setCulled(false);this._lengthWire.setCulled(false);this._originDot.setCulled(false);this._targetDot.setCulled(false);}this._sectionPlanesDirty=true;}var near=-0.3;var vpz1=this._originMarker.viewPos[2];var vpz2=this._targetMarker.viewPos[2];if(vpz1>near||vpz2>near){this._xAxisLabel.setCulled(true);this._yAxisLabel.setCulled(true);this._zAxisLabel.setCulled(true);this._lengthLabel.setCulled(true);this._xAxisWire.setVisible(false);this._yAxisWire.setVisible(false);this._zAxisWire.setVisible(false);this._lengthWire.setVisible(false);this._originDot.setVisible(false);this._targetDot.setVisible(false);return;}if(this._cpDirty){math.transformPositions4(scene.camera.project.matrix,this._vp,this._pp);var pp=this._pp;var cp=this._cp;var canvas=scene.canvas.canvas;var offsets=canvas.getBoundingClientRect();var containerOffsets=this._container.getBoundingClientRect();var top=offsets.top-containerOffsets.top;var left=offsets.left-containerOffsets.left;var aabb=scene.canvas.boundary;var canvasWidth=aabb[2];var canvasHeight=aabb[3];var j=0;var metrics=this.plugin.viewer.scene.metrics;var _scale5=metrics.scale;var units=metrics.units;var unitInfo=metrics.unitsInfo[units];var unitAbbrev=unitInfo.abbrev;for(var i=0,len=pp.length;i<len;i+=4){cp[j]=left+Math.floor((1+pp[i+0]/pp[i+3])*canvasWidth/2);cp[j+1]=top+Math.floor((1-pp[i+1]/pp[i+3])*canvasHeight/2);j+=2;}this._originDot.setPos(cp[0],cp[1]);this._targetDot.setPos(cp[6],cp[7]);this._lengthWire.setStartAndEnd(cp[0],cp[1],cp[6],cp[7]);this._xAxisWire.setStartAndEnd(cp[0],cp[1],cp[2],cp[3]);this._yAxisWire.setStartAndEnd(cp[2],cp[3],cp[4],cp[5]);this._zAxisWire.setStartAndEnd(cp[4],cp[5],cp[6],cp[7]);if(!this.labelsVisible){this._lengthLabel.setCulled(true);this._xAxisLabel.setCulled(true);this._yAxisLabel.setCulled(true);this._zAxisLabel.setCulled(true);}else{this._lengthLabel.setPosOnWire(cp[0],cp[1],cp[6],cp[7]);if(this.labelsOnWires){this._xAxisLabel.setPosOnWire(cp[0],cp[1],cp[2],cp[3]);this._yAxisLabel.setPosOnWire(cp[2],cp[3],cp[4],cp[5]);this._zAxisLabel.setPosOnWire(cp[4],cp[5],cp[6],cp[7]);}else{var labelOffset=35;var currentLabelOffset=labelOffset;this._xAxisLabel.setPosOnWire(cp[0],cp[1]+currentLabelOffset,cp[6],cp[7]+currentLabelOffset);currentLabelOffset+=labelOffset;this._yAxisLabel.setPosOnWire(cp[0],cp[1]+currentLabelOffset,cp[6],cp[7]+currentLabelOffset);currentLabelOffset+=labelOffset;this._zAxisLabel.setPosOnWire(cp[0],cp[1]+currentLabelOffset,cp[6],cp[7]+currentLabelOffset);}var tilde=this._approximate?" ~ ":" = ";this._length=Math.abs(math.lenVec3(math.subVec3(this._targetWorld,this._originWorld,distVec3)));this._lengthLabel.setText(tilde+(this._length*_scale5).toFixed(2)+unitAbbrev);var xAxisCanvasLength=Math.abs(lengthWire(cp[0],cp[1],cp[2],cp[3]));var yAxisCanvasLength=Math.abs(lengthWire(cp[2],cp[3],cp[4],cp[5]));var zAxisCanvasLength=Math.abs(lengthWire(cp[4],cp[5],cp[6],cp[7]));var labelMinAxisLength=this.plugin.labelMinAxisLength;if(this.labelsOnWires){this._xAxisLabelCulled=xAxisCanvasLength<labelMinAxisLength;this._yAxisLabelCulled=yAxisCanvasLength<labelMinAxisLength;this._zAxisLabelCulled=zAxisCanvasLength<labelMinAxisLength;}else{this._xAxisLabelCulled=false;this._yAxisLabelCulled=false;this._zAxisLabelCulled=false;}if(!this._xAxisLabelCulled){this._xAxisLabel.setText(tilde+Math.abs((this._targetWorld[0]-this._originWorld[0])*_scale5).toFixed(2)+unitAbbrev);this._xAxisLabel.setCulled(!this.axisVisible);}else{this._xAxisLabel.setCulled(true);}if(!this._yAxisLabelCulled){this._yAxisLabel.setText(tilde+Math.abs((this._targetWorld[1]-this._originWorld[1])*_scale5).toFixed(2)+unitAbbrev);this._yAxisLabel.setCulled(!this.axisVisible);}else{this._yAxisLabel.setCulled(true);}if(!this._zAxisLabelCulled){this._zAxisLabel.setText(tilde+Math.abs((this._targetWorld[2]-this._originWorld[2])*_scale5).toFixed(2)+unitAbbrev);this._zAxisLabel.setCulled(!this.axisVisible);}else{this._zAxisLabel.setCulled(true);}}// this._xAxisLabel.setVisible(this.axisVisible && this.xAxisVisible);
18717
18717
  // this._yAxisLabel.setVisible(this.axisVisible && this.yAxisVisible);
18718
18718
  // this._zAxisLabel.setVisible(this.axisVisible && this.zAxisVisible);
18719
18719
  // this._lengthLabel.setVisible(false);
@@ -18842,9 +18842,17 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.s
18842
18842
  *
18843
18843
  * @type {Boolean}
18844
18844
  */function get(){return this._labelsVisible;}/**
18845
+ * Sets if labels should be positioned on the wires.
18846
+ *
18847
+ * @type {Boolean}
18848
+ */,set:function set(value){value=value!==undefined?Boolean(value):this.plugin.defaultLabelsVisible;this._labelsVisible=value;var labelsVisible=this._visible&&this._labelsVisible;this._xAxisLabel.setVisible(labelsVisible&&!this._xAxisLabelCulled&&this._clickable&&this._axisEnabled);this._yAxisLabel.setVisible(labelsVisible&&!this._yAxisLabelCulled&&this._clickable&&this._axisEnabled);this._zAxisLabel.setVisible(labelsVisible&&!this._zAxisLabelCulled&&this._clickable&&this._axisEnabled);this._lengthLabel.setVisible(labelsVisible);this._cpDirty=true;this._needUpdate();}},{key:"labelsOnWires",get:/**
18849
+ * Gets if labels should be positioned on the wires.
18850
+ *
18851
+ * @type {Boolean}
18852
+ */function get(){return this._labelsOnWires;}/**
18845
18853
  * Sets if this DistanceMeasurement appears highlighted.
18846
18854
  * @param highlighted
18847
- */,set:function set(value){value=value!==undefined?Boolean(value):this.plugin.defaultLabelsVisible;this._labelsVisible=value;var labelsVisible=this._visible&&this._labelsVisible;this._xAxisLabel.setVisible(labelsVisible&&!this._xAxisLabelCulled&&this._clickable&&this._axisEnabled);this._yAxisLabel.setVisible(labelsVisible&&!this._yAxisLabelCulled&&this._clickable&&this._axisEnabled);this._zAxisLabel.setVisible(labelsVisible&&!this._zAxisLabelCulled&&this._clickable&&this._axisEnabled);this._lengthLabel.setVisible(labelsVisible);this._cpDirty=true;this._needUpdate();}},{key:"setHighlighted",value:function setHighlighted(highlighted){this._originDot.setHighlighted(highlighted);this._targetDot.setHighlighted(highlighted);this._xAxisWire.setHighlighted(highlighted);this._yAxisWire.setHighlighted(highlighted);this._zAxisWire.setHighlighted(highlighted);this._xAxisLabel.setHighlighted(highlighted);this._yAxisLabel.setHighlighted(highlighted);this._zAxisLabel.setHighlighted(highlighted);this._lengthWire.setHighlighted(highlighted);this._lengthLabel.setHighlighted(highlighted);}/**
18855
+ */,set:function set(value){value=value!==undefined?Boolean(value):this.plugin.defaultLabelsOnWires;this._labelsOnWires=value;}},{key:"setHighlighted",value:function setHighlighted(highlighted){this._originDot.setHighlighted(highlighted);this._targetDot.setHighlighted(highlighted);this._xAxisWire.setHighlighted(highlighted);this._yAxisWire.setHighlighted(highlighted);this._zAxisWire.setHighlighted(highlighted);this._xAxisLabel.setHighlighted(highlighted);this._yAxisLabel.setHighlighted(highlighted);this._zAxisLabel.setHighlighted(highlighted);this._lengthWire.setHighlighted(highlighted);this._lengthLabel.setHighlighted(highlighted);}/**
18848
18856
  * Sets if the wires, dots ad labels will fire "mouseOver" "mouseLeave" and "contextMenu" events, or ignore mouse events altogether.
18849
18857
  *
18850
18858
  * @type {Boolean}
@@ -18940,55 +18948,55 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.s
18940
18948
  * distanceMeasurementsControl.activate();
18941
18949
  * ````
18942
18950
  */var DistanceMeasurementsMouseControl=/*#__PURE__*/function(_DistanceMeasurements){_inherits(DistanceMeasurementsMouseControl,_DistanceMeasurements);var _super117=_createSuper(DistanceMeasurementsMouseControl);/**
18943
- * Creates a DistanceMeasurementsMouseControl bound to the given DistanceMeasurementsPlugin.
18944
- *
18945
- * @param {DistanceMeasurementsPlugin} distanceMeasurementsPlugin The AngleMeasurementsPlugin to control.
18946
- * @param [cfg] Configuration
18947
- * @param {PointerLens} [cfg.pointerLens] A PointerLens to use to provide a magnified view of the cursor when snapping is enabled.
18948
- * @param {boolean} [cfg.snapping=true] Whether to initially enable snap-to-vertex and snap-to-edge for this DistanceMeasurementsMouseControl.
18949
- */function DistanceMeasurementsMouseControl(distanceMeasurementsPlugin){var _this81;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,DistanceMeasurementsMouseControl);_this81=_super117.call(this,distanceMeasurementsPlugin.viewer.scene);_this81.pointerLens=cfg.pointerLens;_this81._active=false;_this81._currentDistanceMeasurement=null;_this81._currentDistanceMeasurementInitState={wireVisible:null,axisVisible:null,xAxisVisible:null,yaxisVisible:null,zAxisVisible:null,targetVisible:null};_this81._initMarkerDiv();_this81._onCameraControlHoverSnapOrSurface=null;_this81._onCameraControlHoverSnapOrSurfaceOff=null;_this81._onMouseDown=null;_this81._onMouseUp=null;_this81._onCanvasTouchStart=null;_this81._onCanvasTouchEnd=null;_this81._snapping=cfg.snapping!==false;_this81._mouseState=MOUSE_FIRST_CLICK_EXPECTED;_this81._attachPlugin(distanceMeasurementsPlugin,cfg);return _this81;}_createClass(DistanceMeasurementsMouseControl,[{key:"_initMarkerDiv",value:function _initMarkerDiv(){var markerDiv=document.createElement('div');markerDiv.setAttribute('id','myDistanceMarker');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){var element=document.getElementById('myDistanceMarker');element.parentNode.removeChild(element);this._markerDiv=null;}}},{key:"_attachPlugin",value:function _attachPlugin(distanceMeasurementsPlugin){var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};/**
18950
- * The {@link DistanceMeasurementsPlugin} that owns this DistanceMeasurementsMouseControl.
18951
- * @type {DistanceMeasurementsPlugin}
18952
- */this.distanceMeasurementsPlugin=distanceMeasurementsPlugin;/**
18953
- * The {@link DistanceMeasurementsPlugin} that owns this DistanceMeasurementsMouseControl.
18954
- * @type {DistanceMeasurementsPlugin}
18955
- */this.plugin=distanceMeasurementsPlugin;}/**
18956
- * Gets if this DistanceMeasurementsMouseControl is currently active, where it is responding to input.
18957
- *
18958
- * @returns {boolean} True if this DistanceMeasurementsMouseControl is active.
18959
- */},{key:"active",get:function get(){return this._active;}/**
18960
- * Sets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
18961
- *
18962
- * This is `true` by default.
18963
- *
18964
- * Internally, this deactivates then activates the DistanceMeasurementsMouseControl when changed, which means that
18965
- * it will destroy any DistanceMeasurements currently under construction, and incurs some overhead, since it unbinds
18966
- * and rebinds various input handlers.
18967
- *
18968
- * @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this DistanceMeasurementsMouseControl.
18969
- */},{key:"snapping",get:/**
18970
- * Gets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
18971
- *
18972
- * This is `true` by default.
18973
- *
18974
- * @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
18975
- */function get(){return this._snapping;}/**
18976
- * Activates this DistanceMeasurementsMouseControl, ready to respond to input.
18977
- */,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 _this82=this;if(this._active){return;}if(!this._markerDiv){this._initMarkerDiv();}this.fire("activated",true);var distanceMeasurementsPlugin=this.distanceMeasurementsPlugin;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){var canvasPos=event.snappedCanvasPos||event.canvasPos;mouseHovering=true;pointerWorldPos.set(event.worldPos);pointerCanvasPos.set(event.canvasPos);if(_this82._mouseState===MOUSE_FIRST_CLICK_EXPECTED){var canvasBoundRect=canvas.getBoundingClientRect();var scrollLeft=window.pageXOffset||document.documentElement.scrollLeft;var scrollTop=window.pageYOffset||document.documentElement.scrollTop;var canvasLeftEdge=canvasBoundRect.left+scrollLeft;var canvasTopEdge=canvasBoundRect.top+scrollTop;_this82._markerDiv.style.marginLeft="".concat(canvasLeftEdge+canvasPos[0]-5,"px");_this82._markerDiv.style.marginTop="".concat(canvasTopEdge+canvasPos[1]-5,"px");_this82._markerDiv.style.background="pink";if(event.snappedToVertex||event.snappedToEdge){if(_this82.pointerLens){_this82.pointerLens.visible=true;_this82.pointerLens.canvasPos=event.canvasPos;_this82.pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;_this82.pointerLens.snapped=true;}_this82._markerDiv.style.background="greenyellow";_this82._markerDiv.style.border="2px solid green";}else{if(_this82.pointerLens){_this82.pointerLens.visible=true;_this82.pointerLens.canvasPos=event.canvasPos;_this82.pointerLens.snappedCanvasPos=event.canvasPos;_this82.pointerLens.snapped=false;}_this82._markerDiv.style.background="pink";_this82._markerDiv.style.border="2px solid red";}hoveredEntity=event.entity;}else{_this82._markerDiv.style.marginLeft="-10000px";_this82._markerDiv.style.marginTop="-10000px";}canvas.style.cursor="pointer";if(_this82._currentDistanceMeasurement){_this82._currentDistanceMeasurement.wireVisible=_this82._currentDistanceMeasurementInitState.wireVisible;_this82._currentDistanceMeasurement.axisVisible=_this82._currentDistanceMeasurementInitState.axisVisible&&_this82.distanceMeasurementsPlugin.defaultAxisVisible;_this82._currentDistanceMeasurement.xAxisVisible=_this82._currentDistanceMeasurementInitState.xAxisVisible&&_this82.distanceMeasurementsPlugin.defaultXAxisVisible;_this82._currentDistanceMeasurement.yAxisVisible=_this82._currentDistanceMeasurementInitState.yAxisVisible&&_this82.distanceMeasurementsPlugin.defaultYAxisVisible;_this82._currentDistanceMeasurement.zAxisVisible=_this82._currentDistanceMeasurementInitState.zAxisVisible&&_this82.distanceMeasurementsPlugin.defaultZAxisVisible;_this82._currentDistanceMeasurement.targetVisible=_this82._currentDistanceMeasurementInitState.targetVisible;_this82._currentDistanceMeasurement.target.worldPos=pointerWorldPos.slice();_this82._markerDiv.style.marginLeft="-10000px";_this82._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(e.which!==1){return;}if(e.clientX>pointerDownCanvasX+clickTolerance||e.clientX<pointerDownCanvasX-clickTolerance||e.clientY>pointerDownCanvasY+clickTolerance||e.clientY<pointerDownCanvasY-clickTolerance){return;}if(_this82._currentDistanceMeasurement){if(mouseHovering){_this82._currentDistanceMeasurement.target.entity=hoveredEntity;hoveredEntity=null;_this82._currentDistanceMeasurement.clickable=true;_this82.distanceMeasurementsPlugin.fire("measurementEnd",_this82._currentDistanceMeasurement);_this82._currentDistanceMeasurement=null;}else{_this82._currentDistanceMeasurement.destroy();_this82.distanceMeasurementsPlugin.fire("measurementCancel",_this82._currentDistanceMeasurement);_this82._currentDistanceMeasurement=null;hoveredEntity=null;}}else{if(mouseHovering){_this82._currentDistanceMeasurement=distanceMeasurementsPlugin.createMeasurement({id:math.createUUID(),origin:{worldPos:pointerWorldPos.slice()},target:{worldPos:pointerWorldPos.slice()},approximate:true});_this82._currentDistanceMeasurementInitState.axisVisible=_this82._currentDistanceMeasurement.axisVisible&&_this82.distanceMeasurementsPlugin.defaultAxisVisible;_this82._currentDistanceMeasurementInitState.xAxisVisible=_this82._currentDistanceMeasurement.xAxisVisible&&_this82.distanceMeasurementsPlugin.defaultXAxisVisible;_this82._currentDistanceMeasurementInitState.yAxisVisible=_this82._currentDistanceMeasurement.yAxisVisible&&_this82.distanceMeasurementsPlugin.defaultYAxisVisible;_this82._currentDistanceMeasurementInitState.zAxisVisible=_this82._currentDistanceMeasurement.zAxisVisible&&_this82.distanceMeasurementsPlugin.defaultZAxisVisible;_this82._currentDistanceMeasurementInitState.wireVisible=_this82._currentDistanceMeasurement.wireVisible;_this82._currentDistanceMeasurementInitState.targetVisible=_this82._currentDistanceMeasurement.targetVisible;_this82._currentDistanceMeasurement.clickable=false;_this82._currentDistanceMeasurement.origin.entity=hoveredEntity;hoveredEntity=null;_this82.fire("measurementStart",_this82._currentDistanceMeasurement);}}});this._onCameraControlHoverSnapOrSurfaceOff=cameraControl.on(this._snapping?"hoverSnapOrSurfaceOff":"hoverOff",function(event){if(_this82.pointerLens){_this82.pointerLens.visible=true;_this82.pointerLens.canvasPos=event.canvasPos;_this82.pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;}mouseHovering=false;_this82._markerDiv.style.marginLeft="-100px";_this82._markerDiv.style.marginTop="-100px";if(_this82._currentDistanceMeasurement){_this82._currentDistanceMeasurement.wireVisible=false;_this82._currentDistanceMeasurement.targetVisible=false;_this82._currentDistanceMeasurement.axisVisible=false;}canvas.style.cursor="default";});this._active=true;}/**
18978
- * Deactivates this DistanceMeasurementsMouseControl, making it unresponsive to input.
18979
- *
18980
- * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.
18981
- */},{key:"deactivate",value:function deactivate(){if(!this._active){return;}this.fire("activated",false);if(this.pointerLens){this.pointerLens.visible=false;}if(this._markerDiv){this._destroyMarkerDiv();}this.reset();var canvas=this.scene.canvas.canvas;canvas.removeEventListener("mousedown",this._onMouseDown);canvas.removeEventListener("mouseup",this._onMouseUp);var cameraControl=this.distanceMeasurementsPlugin.viewer.cameraControl;cameraControl.off(this._onCameraControlHoverSnapOrSurface);cameraControl.off(this._onCameraControlHoverSnapOrSurfaceOff);if(this._currentDistanceMeasurement){this.distanceMeasurementsPlugin.fire("measurementCancel",this._currentDistanceMeasurement);this._currentDistanceMeasurement.destroy();this._currentDistanceMeasurement=null;}this._active=false;}/**
18982
- * Resets this DistanceMeasurementsMouseControl.
18983
- *
18984
- * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.
18985
- *
18986
- * Does nothing if the DistanceMeasurementsMouseControl is not active.
18987
- */},{key:"reset",value:function reset(){if(!this._active){return;}this._destroyMarkerDiv();this._initMarkerDiv();if(this._currentDistanceMeasurement){this.distanceMeasurementsPlugin.fire("measurementCancel",this._currentDistanceMeasurement);this._currentDistanceMeasurement.destroy();this._currentDistanceMeasurement=null;}}/**
18988
- * Destroys this DistanceMeasurementsMouseControl.
18989
- *
18990
- * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.
18991
- */},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(DistanceMeasurementsMouseControl.prototype),"destroy",this).call(this);}}]);return DistanceMeasurementsMouseControl;}(DistanceMeasurementsControl);/**
18951
+ * Creates a DistanceMeasurementsMouseControl bound to the given DistanceMeasurementsPlugin.
18952
+ *
18953
+ * @param {DistanceMeasurementsPlugin} distanceMeasurementsPlugin The AngleMeasurementsPlugin to control.
18954
+ * @param [cfg] Configuration
18955
+ * @param {PointerLens} [cfg.pointerLens] A PointerLens to use to provide a magnified view of the cursor when snapping is enabled.
18956
+ * @param {boolean} [cfg.snapping=true] Whether to initially enable snap-to-vertex and snap-to-edge for this DistanceMeasurementsMouseControl.
18957
+ */function DistanceMeasurementsMouseControl(distanceMeasurementsPlugin){var _this81;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,DistanceMeasurementsMouseControl);_this81=_super117.call(this,distanceMeasurementsPlugin.viewer.scene);_this81.pointerLens=cfg.pointerLens;_this81._active=false;_this81._currentDistanceMeasurement=null;_this81._currentDistanceMeasurementInitState={wireVisible:null,axisVisible:null,xAxisVisible:null,yaxisVisible:null,zAxisVisible:null,targetVisible:null};_this81._initMarkerDiv();_this81._onCameraControlHoverSnapOrSurface=null;_this81._onCameraControlHoverSnapOrSurfaceOff=null;_this81._onMouseDown=null;_this81._onMouseUp=null;_this81._onCanvasTouchStart=null;_this81._onCanvasTouchEnd=null;_this81._snapping=cfg.snapping!==false;_this81._mouseState=MOUSE_FIRST_CLICK_EXPECTED;_this81._attachPlugin(distanceMeasurementsPlugin,cfg);return _this81;}_createClass(DistanceMeasurementsMouseControl,[{key:"_initMarkerDiv",value:function _initMarkerDiv(){var markerDiv=document.createElement("div");markerDiv.setAttribute("id","myDistanceMarker");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){var element=document.getElementById("myDistanceMarker");element.parentNode.removeChild(element);this._markerDiv=null;}}},{key:"_attachPlugin",value:function _attachPlugin(distanceMeasurementsPlugin){var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};/**
18958
+ * The {@link DistanceMeasurementsPlugin} that owns this DistanceMeasurementsMouseControl.
18959
+ * @type {DistanceMeasurementsPlugin}
18960
+ */this.distanceMeasurementsPlugin=distanceMeasurementsPlugin;/**
18961
+ * The {@link DistanceMeasurementsPlugin} that owns this DistanceMeasurementsMouseControl.
18962
+ * @type {DistanceMeasurementsPlugin}
18963
+ */this.plugin=distanceMeasurementsPlugin;}/**
18964
+ * Gets if this DistanceMeasurementsMouseControl is currently active, where it is responding to input.
18965
+ *
18966
+ * @returns {boolean} True if this DistanceMeasurementsMouseControl is active.
18967
+ */},{key:"active",get:function get(){return this._active;}/**
18968
+ * Sets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
18969
+ *
18970
+ * This is `true` by default.
18971
+ *
18972
+ * Internally, this deactivates then activates the DistanceMeasurementsMouseControl when changed, which means that
18973
+ * it will destroy any DistanceMeasurements currently under construction, and incurs some overhead, since it unbinds
18974
+ * and rebinds various input handlers.
18975
+ *
18976
+ * @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this DistanceMeasurementsMouseControl.
18977
+ */},{key:"snapping",get:/**
18978
+ * Gets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
18979
+ *
18980
+ * This is `true` by default.
18981
+ *
18982
+ * @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
18983
+ */function get(){return this._snapping;}/**
18984
+ * Activates this DistanceMeasurementsMouseControl, ready to respond to input.
18985
+ */,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 _this82=this;if(this._active){return;}if(!this._markerDiv){this._initMarkerDiv();}this.fire("activated",true);var distanceMeasurementsPlugin=this.distanceMeasurementsPlugin;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){var canvasPos=event.snappedCanvasPos||event.canvasPos;mouseHovering=true;pointerWorldPos.set(event.worldPos);pointerCanvasPos.set(event.canvasPos);if(_this82._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;_this82._markerDiv.style.marginLeft="".concat(canvasLeftEdge+canvasPos[0]-5,"px");_this82._markerDiv.style.marginTop="".concat(canvasTopEdge+canvasPos[1]-5,"px");_this82._markerDiv.style.background="pink";if(event.snappedToVertex||event.snappedToEdge){if(_this82.pointerLens){_this82.pointerLens.visible=true;_this82.pointerLens.canvasPos=event.canvasPos;_this82.pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;_this82.pointerLens.snapped=true;}_this82._markerDiv.style.background="greenyellow";_this82._markerDiv.style.border="2px solid green";}else{if(_this82.pointerLens){_this82.pointerLens.visible=true;_this82.pointerLens.canvasPos=event.canvasPos;_this82.pointerLens.snappedCanvasPos=event.canvasPos;_this82.pointerLens.snapped=false;}_this82._markerDiv.style.background="pink";_this82._markerDiv.style.border="2px solid red";}hoveredEntity=event.entity;}else{_this82._markerDiv.style.marginLeft="-10000px";_this82._markerDiv.style.marginTop="-10000px";}canvas.style.cursor="pointer";if(_this82._currentDistanceMeasurement){_this82._currentDistanceMeasurement.wireVisible=_this82._currentDistanceMeasurementInitState.wireVisible;_this82._currentDistanceMeasurement.axisVisible=_this82._currentDistanceMeasurementInitState.axisVisible&&_this82.distanceMeasurementsPlugin.defaultAxisVisible;_this82._currentDistanceMeasurement.xAxisVisible=_this82._currentDistanceMeasurementInitState.xAxisVisible&&_this82.distanceMeasurementsPlugin.defaultXAxisVisible;_this82._currentDistanceMeasurement.yAxisVisible=_this82._currentDistanceMeasurementInitState.yAxisVisible&&_this82.distanceMeasurementsPlugin.defaultYAxisVisible;_this82._currentDistanceMeasurement.zAxisVisible=_this82._currentDistanceMeasurementInitState.zAxisVisible&&_this82.distanceMeasurementsPlugin.defaultZAxisVisible;_this82._currentDistanceMeasurement.targetVisible=_this82._currentDistanceMeasurementInitState.targetVisible;_this82._currentDistanceMeasurement.target.worldPos=pointerWorldPos.slice();_this82._markerDiv.style.marginLeft="-10000px";_this82._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(e.which!==1){return;}if(e.clientX>pointerDownCanvasX+clickTolerance||e.clientX<pointerDownCanvasX-clickTolerance||e.clientY>pointerDownCanvasY+clickTolerance||e.clientY<pointerDownCanvasY-clickTolerance){return;}if(_this82._currentDistanceMeasurement){if(mouseHovering){_this82._currentDistanceMeasurement.target.entity=hoveredEntity;hoveredEntity=null;_this82._currentDistanceMeasurement.clickable=true;_this82.distanceMeasurementsPlugin.fire("measurementEnd",_this82._currentDistanceMeasurement);_this82._currentDistanceMeasurement=null;}else{_this82._currentDistanceMeasurement.destroy();_this82.distanceMeasurementsPlugin.fire("measurementCancel",_this82._currentDistanceMeasurement);_this82._currentDistanceMeasurement=null;hoveredEntity=null;}}else{if(mouseHovering){_this82._currentDistanceMeasurement=distanceMeasurementsPlugin.createMeasurement({id:math.createUUID(),origin:{worldPos:pointerWorldPos.slice()},target:{worldPos:pointerWorldPos.slice()},approximate:true});_this82._currentDistanceMeasurementInitState.axisVisible=_this82._currentDistanceMeasurement.axisVisible&&_this82.distanceMeasurementsPlugin.defaultAxisVisible;_this82._currentDistanceMeasurementInitState.xAxisVisible=_this82._currentDistanceMeasurement.xAxisVisible&&_this82.distanceMeasurementsPlugin.defaultXAxisVisible;_this82._currentDistanceMeasurementInitState.yAxisVisible=_this82._currentDistanceMeasurement.yAxisVisible&&_this82.distanceMeasurementsPlugin.defaultYAxisVisible;_this82._currentDistanceMeasurementInitState.zAxisVisible=_this82._currentDistanceMeasurement.zAxisVisible&&_this82.distanceMeasurementsPlugin.defaultZAxisVisible;_this82._currentDistanceMeasurementInitState.wireVisible=_this82._currentDistanceMeasurement.wireVisible;_this82._currentDistanceMeasurementInitState.targetVisible=_this82._currentDistanceMeasurement.targetVisible;_this82._currentDistanceMeasurement.clickable=false;_this82._currentDistanceMeasurement.origin.entity=hoveredEntity;hoveredEntity=null;_this82.fire("measurementStart",_this82._currentDistanceMeasurement);}}});this._onCameraControlHoverSnapOrSurfaceOff=cameraControl.on(this._snapping?"hoverSnapOrSurfaceOff":"hoverOff",function(event){if(_this82.pointerLens){_this82.pointerLens.visible=true;_this82.pointerLens.canvasPos=event.canvasPos;_this82.pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;}mouseHovering=false;_this82._markerDiv.style.marginLeft="-100px";_this82._markerDiv.style.marginTop="-100px";if(_this82._currentDistanceMeasurement){_this82._currentDistanceMeasurement.wireVisible=false;_this82._currentDistanceMeasurement.targetVisible=false;_this82._currentDistanceMeasurement.axisVisible=false;}canvas.style.cursor="default";});this._active=true;}/**
18986
+ * Deactivates this DistanceMeasurementsMouseControl, making it unresponsive to input.
18987
+ *
18988
+ * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.
18989
+ */},{key:"deactivate",value:function deactivate(){if(!this._active){return;}this.fire("activated",false);if(this.pointerLens){this.pointerLens.visible=false;}if(this._markerDiv){this._destroyMarkerDiv();}this.reset();var canvas=this.scene.canvas.canvas;canvas.removeEventListener("mousedown",this._onMouseDown);canvas.removeEventListener("mouseup",this._onMouseUp);var cameraControl=this.distanceMeasurementsPlugin.viewer.cameraControl;cameraControl.off(this._onCameraControlHoverSnapOrSurface);cameraControl.off(this._onCameraControlHoverSnapOrSurfaceOff);if(this._currentDistanceMeasurement){this.distanceMeasurementsPlugin.fire("measurementCancel",this._currentDistanceMeasurement);this._currentDistanceMeasurement.destroy();this._currentDistanceMeasurement=null;}this._active=false;}/**
18990
+ * Resets this DistanceMeasurementsMouseControl.
18991
+ *
18992
+ * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.
18993
+ *
18994
+ * Does nothing if the DistanceMeasurementsMouseControl is not active.
18995
+ */},{key:"reset",value:function reset(){if(!this._active){return;}this._destroyMarkerDiv();this._initMarkerDiv();if(this._currentDistanceMeasurement){this.distanceMeasurementsPlugin.fire("measurementCancel",this._currentDistanceMeasurement);this._currentDistanceMeasurement.destroy();this._currentDistanceMeasurement=null;}}/**
18996
+ * Destroys this DistanceMeasurementsMouseControl.
18997
+ *
18998
+ * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.
18999
+ */},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(DistanceMeasurementsMouseControl.prototype),"destroy",this).call(this);}}]);return DistanceMeasurementsMouseControl;}(DistanceMeasurementsControl);/**
18992
19000
  * {@link Viewer} plugin for measuring point-to-point distances.
18993
19001
  *
18994
19002
  * [<img src="https://user-images.githubusercontent.com/83100/63047331-867a0a80-bed4-11e9-892f-398740013c5f.gif">](https://xeokit.github.io/xeokit-sdk/examples/#measurements_distance_createWithMouse)
@@ -21705,62 +21713,64 @@ var eyeTargetVec=math.subVec3(optionalTargetWorldPos,camera.eye,tempVec3a$7);var
21705
21713
  // - add both vectors to camera eye and look.
21706
21714
  var worldPos1=this._unproject(targetCanvasPos,tempVec4a$4);camera.ortho.scale=camera.ortho.scale-dollyDelta;camera.ortho._update();// HACK
21707
21715
  var worldPos2=this._unproject(targetCanvasPos,tempVec4b$4);var _offset=math.subVec3(worldPos2,worldPos1,tempVec4c$1);var eyeLookMoveVec=math.mulVec3Scalar(math.normalizeVec3(math.subVec3(camera.look,camera.eye,tempVec3a$7)),-dollyDelta,tempVec3b$4);var _moveVec=math.addVec3(_offset,eyeLookMoveVec,tempVec3c$3);camera.eye=[camera.eye[0]-_moveVec[0],camera.eye[1]-_moveVec[1],camera.eye[2]-_moveVec[2]];camera.look=[camera.look[0]-_moveVec[0],camera.look[1]-_moveVec[1],camera.look[2]-_moveVec[2]];}return dolliedThroughSurface;}},{key:"_unproject",value:function _unproject(canvasPos,worldPos){var camera=this._scene.camera;var transposedProjectMat=camera.project.transposedMatrix;var Pt3=transposedProjectMat.subarray(8,12);var Pt4=transposedProjectMat.subarray(12);var D=[0,0,-1.0,1];var screenZ=math.dotVec4(D,Pt3)/math.dotVec4(D,Pt4);camera.project.unproject(canvasPos,screenZ,screenPos,viewPos,worldPos);return worldPos;}},{key:"destroy",value:function destroy(){}}]);return PanController;}();var tempVec3a$6=math.vec3();var tempVec3b$3=math.vec3();var tempVec3c$2=math.vec3();var tempVec4a$3=math.vec4();var tempVec4b$3=math.vec4();var tempVec4c=math.vec4();/** @private */var PivotController=/*#__PURE__*/function(){/**
21708
- * @private
21709
- */function PivotController(scene,configs){var _this103=this;_classCallCheck(this,PivotController);// Pivot math by: http://www.derschmale.com/
21716
+ * @private
21717
+ */function PivotController(scene,configs){var _this103=this;_classCallCheck(this,PivotController);// Pivot math by: http://www.derschmale.com/
21710
21718
  this._scene=scene;this._configs=configs;this._pivotWorldPos=math.vec3();this._cameraOffset=math.vec3();this._azimuth=0;this._polar=0;this._radius=0;this._pivotPosSet=false;// Initially false, true as soon as _pivotWorldPos has been set to some value
21711
21719
  this._pivoting=false;// True while pivoting
21712
- this._shown=false;this._pivotSphereEnabled=false;this._pivotSphere=null;this._pivotSphereSize=1;this._pivotSphereGeometry=null;this._pivotSphereMaterial=null;this._rtcCenter=math.vec3();this._rtcPos=math.vec3();this._pivotViewPos=math.vec4();this._pivotProjPos=math.vec4();this._pivotCanvasPos=math.vec2();this._cameraDirty=true;this._onViewMatrix=this._scene.camera.on("viewMatrix",function(){_this103._cameraDirty=true;});this._onProjMatrix=this._scene.camera.on("projMatrix",function(){_this103._cameraDirty=true;});this._onTick=this._scene.on("tick",function(){_this103.updatePivotElement();_this103.updatePivotSphere();});}_createClass(PivotController,[{key:"createPivotSphere",value:function createPivotSphere(){var currentPos=this.getPivotPos();var cameraPos=math.vec3();math.decomposeMat4(math.inverseMat4(this._scene.viewer.camera.viewMatrix,math.mat4()),cameraPos,math.vec4(),math.vec3());var length=math.distVec3(cameraPos,currentPos);var radius=Math.tan(Math.PI/500)*length*this._pivotSphereSize;if(this._scene.camera.projection=="ortho"){radius/=this._scene.camera.ortho.scale/2;}worldToRTCPos(currentPos,this._rtcCenter,this._rtcPos);this._pivotSphereGeometry=new VBOGeometry(this._scene,buildSphereGeometry({radius:radius}));this._pivotSphere=new Mesh(this._scene,{geometry:this._pivotSphereGeometry,material:this._pivotSphereMaterial,pickable:false,position:this._rtcPos,rtcCenter:this._rtcCenter});}},{key:"destroyPivotSphere",value:function destroyPivotSphere(){if(this._pivotSphere){this._pivotSphere.destroy();this._pivotSphere=null;}if(this._pivotSphereGeometry){this._pivotSphereGeometry.destroy();this._pivotSphereGeometry=null;}}},{key:"updatePivotElement",value:function updatePivotElement(){var camera=this._scene.camera;var canvas=this._scene.canvas;if(this._pivoting&&this._cameraDirty){math.transformPoint3(camera.viewMatrix,this.getPivotPos(),this._pivotViewPos);this._pivotViewPos[3]=1;math.transformPoint4(camera.projMatrix,this._pivotViewPos,this._pivotProjPos);var canvasAABB=canvas.boundary;var canvasWidth=canvasAABB[2];var canvasHeight=canvasAABB[3];this._pivotCanvasPos[0]=Math.floor((1+this._pivotProjPos[0]/this._pivotProjPos[3])*canvasWidth/2);this._pivotCanvasPos[1]=Math.floor((1-this._pivotProjPos[1]/this._pivotProjPos[3])*canvasHeight/2);// data-textures: avoid to do continuous DOM layout calculations
21713
- var canvasBoundingRect=canvas._lastBoundingClientRect;if(!canvasBoundingRect||canvas._canvasSizeChanged){var canvasElem=canvas.canvas;canvasBoundingRect=canvas._lastBoundingClientRect=canvasElem.getBoundingClientRect();}if(this._pivotElement){this._pivotElement.style.left=Math.floor(canvasBoundingRect.left+this._pivotCanvasPos[0])-this._pivotElement.clientWidth/2+window.scrollX+"px";this._pivotElement.style.top=Math.floor(canvasBoundingRect.top+this._pivotCanvasPos[1])-this._pivotElement.clientHeight/2+window.scrollY+"px";}this._cameraDirty=false;}}},{key:"updatePivotSphere",value:function updatePivotSphere(){if(this._pivoting&&this._pivotSphere){worldToRTCPos(this.getPivotPos(),this._rtcCenter,this._rtcPos);if(!math.compareVec3(this._rtcPos,this._pivotSphere.position)){this.destroyPivotSphere();this.createPivotSphere();}}}/**
21714
- * Sets the HTML DOM element that will represent the pivot position.
21715
- *
21716
- * @param pivotElement
21717
- */},{key:"setPivotElement",value:function setPivotElement(pivotElement){this._pivotElement=pivotElement;}/**
21718
- * Sets a sphere as the representation of the pivot position.
21719
- *
21720
- * @param {Object} [cfg] Sphere configuration.
21721
- * @param {String} [cfg.size=1] Optional size factor of the sphere. Defaults to 1.
21722
- * @param {String} [cfg.color=Array] Optional maretial color. Defaults to a red.
21723
- */},{key:"enablePivotSphere",value:function enablePivotSphere(){var cfg=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};this.destroyPivotSphere();this._pivotSphereEnabled=true;if(cfg.size){this._pivotSphereSize=cfg.size;}var color=cfg.color||[1,0,0];this._pivotSphereMaterial=new PhongMaterial(this._scene,{emissive:color,ambient:color,specular:[0,0,0],diffuse:[0,0,0]});}/**
21724
- * Remove the sphere as the representation of the pivot position.
21725
- *
21726
- */},{key:"disablePivotSphere",value:function disablePivotSphere(){this.destroyPivotSphere();this._pivotSphereEnabled=false;}/**
21727
- * Begins pivoting.
21728
- */},{key:"startPivot",value:function startPivot(){if(this._cameraLookingDownwards()){this._pivoting=false;return false;}var camera=this._scene.camera;var lookat=math.lookAtMat4v(camera.eye,camera.look,camera.worldUp);math.transformPoint3(lookat,this.getPivotPos(),this._cameraOffset);var pivotPos=this.getPivotPos();this._cameraOffset[2]+=math.distVec3(camera.eye,pivotPos);lookat=math.inverseMat4(lookat);var offset=math.transformVec3(lookat,this._cameraOffset);var diff=math.vec3();math.subVec3(camera.eye,pivotPos,diff);math.addVec3(diff,offset);if(camera.zUp){var t=diff[1];diff[1]=diff[2];diff[2]=t;}this._radius=math.lenVec3(diff);this._polar=Math.acos(diff[1]/this._radius);this._azimuth=Math.atan2(diff[0],diff[2]);this._pivoting=true;}},{key:"_cameraLookingDownwards",value:function _cameraLookingDownwards(){// Returns true if angle between camera viewing direction and World-space "up" axis is too small
21720
+ this._shown=false;this._pivotSphereEnabled=false;this._pivotSphere=null;this._pivotSphereSize=1;this._pivotSphereGeometry=null;this._pivotSphereMaterial=null;this._rtcCenter=math.vec3();this._rtcPos=math.vec3();this._pivotViewPos=math.vec4();this._pivotProjPos=math.vec4();this._pivotCanvasPos=math.vec2();this._cameraDirty=true;this._onViewMatrix=this._scene.camera.on("viewMatrix",function(){_this103._cameraDirty=true;});this._onProjMatrix=this._scene.camera.on("projMatrix",function(){_this103._cameraDirty=true;});this._onTick=this._scene.on("tick",function(){_this103.updatePivotElement();_this103.updatePivotSphere();});}_createClass(PivotController,[{key:"createPivotSphere",value:function createPivotSphere(){var currentPos=this.getPivotPos();var cameraPos=math.vec3();math.decomposeMat4(math.inverseMat4(this._scene.viewer.camera.viewMatrix,math.mat4()),cameraPos,math.vec4(),math.vec3());var length=math.distVec3(cameraPos,currentPos);var radius=Math.tan(Math.PI/500)*length*this._pivotSphereSize;if(this._scene.camera.projection=="ortho"){radius/=this._scene.camera.ortho.scale/2;}worldToRTCPos(currentPos,this._rtcCenter,this._rtcPos);this._pivotSphereGeometry=new VBOGeometry(this._scene,buildSphereGeometry({radius:radius}));this._pivotSphere=new Mesh(this._scene,{geometry:this._pivotSphereGeometry,material:this._pivotSphereMaterial,pickable:false,position:this._rtcPos,rtcCenter:this._rtcCenter});}},{key:"destroyPivotSphere",value:function destroyPivotSphere(){if(this._pivotSphere){this._pivotSphere.destroy();this._pivotSphere=null;}if(this._pivotSphereGeometry){this._pivotSphereGeometry.destroy();this._pivotSphereGeometry=null;}}},{key:"updatePivotElement",value:function updatePivotElement(){var camera=this._scene.camera;var canvas=this._scene.canvas;if(this._pivoting&&this._cameraDirty){math.transformPoint3(camera.viewMatrix,this.getPivotPos(),this._pivotViewPos);this._pivotViewPos[3]=1;math.transformPoint4(camera.projMatrix,this._pivotViewPos,this._pivotProjPos);var canvasAABB=canvas.boundary;var canvasWidth=canvasAABB[2];var canvasHeight=canvasAABB[3];this._pivotCanvasPos[0]=Math.floor((1+this._pivotProjPos[0]/this._pivotProjPos[3])*canvasWidth/2);this._pivotCanvasPos[1]=Math.floor((1-this._pivotProjPos[1]/this._pivotProjPos[3])*canvasHeight/2);// data-textures: avoid to do continuous DOM layout calculations
21721
+ var canvasBoundingRect=canvas._lastBoundingClientRect;// if (!canvasBoundingRect || canvas._canvasSizeChanged) {
21722
+ var canvasElem=canvas.canvas;canvasBoundingRect=canvas._lastBoundingClientRect=canvasElem.getBoundingClientRect();// }
21723
+ if(this._pivotElement){this._pivotElement.style.left=Math.floor(canvasBoundingRect.left+this._pivotCanvasPos[0])-this._pivotElement.clientWidth/2+window.scrollX+"px";this._pivotElement.style.top=Math.floor(canvasBoundingRect.top+this._pivotCanvasPos[1])-this._pivotElement.clientHeight/2+window.scrollY+"px";}this._cameraDirty=false;}}},{key:"updatePivotSphere",value:function updatePivotSphere(){if(this._pivoting&&this._pivotSphere){worldToRTCPos(this.getPivotPos(),this._rtcCenter,this._rtcPos);if(!math.compareVec3(this._rtcPos,this._pivotSphere.position)){this.destroyPivotSphere();this.createPivotSphere();}}}/**
21724
+ * Sets the HTML DOM element that will represent the pivot position.
21725
+ *
21726
+ * @param pivotElement
21727
+ */},{key:"setPivotElement",value:function setPivotElement(pivotElement){this._pivotElement=pivotElement;}/**
21728
+ * Sets a sphere as the representation of the pivot position.
21729
+ *
21730
+ * @param {Object} [cfg] Sphere configuration.
21731
+ * @param {String} [cfg.size=1] Optional size factor of the sphere. Defaults to 1.
21732
+ * @param {String} [cfg.color=Array] Optional maretial color. Defaults to a red.
21733
+ */},{key:"enablePivotSphere",value:function enablePivotSphere(){var cfg=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};this.destroyPivotSphere();this._pivotSphereEnabled=true;if(cfg.size){this._pivotSphereSize=cfg.size;}var color=cfg.color||[1,0,0];this._pivotSphereMaterial=new PhongMaterial(this._scene,{emissive:color,ambient:color,specular:[0,0,0],diffuse:[0,0,0]});}/**
21734
+ * Remove the sphere as the representation of the pivot position.
21735
+ *
21736
+ */},{key:"disablePivotSphere",value:function disablePivotSphere(){this.destroyPivotSphere();this._pivotSphereEnabled=false;}/**
21737
+ * Begins pivoting.
21738
+ */},{key:"startPivot",value:function startPivot(){if(this._cameraLookingDownwards()){this._pivoting=false;return false;}var camera=this._scene.camera;var lookat=math.lookAtMat4v(camera.eye,camera.look,camera.worldUp);math.transformPoint3(lookat,this.getPivotPos(),this._cameraOffset);var pivotPos=this.getPivotPos();this._cameraOffset[2]+=math.distVec3(camera.eye,pivotPos);lookat=math.inverseMat4(lookat);var offset=math.transformVec3(lookat,this._cameraOffset);var diff=math.vec3();math.subVec3(camera.eye,pivotPos,diff);math.addVec3(diff,offset);if(camera.zUp){var t=diff[1];diff[1]=diff[2];diff[2]=t;}this._radius=math.lenVec3(diff);this._polar=Math.acos(diff[1]/this._radius);this._azimuth=Math.atan2(diff[0],diff[2]);this._pivoting=true;}},{key:"_cameraLookingDownwards",value:function _cameraLookingDownwards(){// Returns true if angle between camera viewing direction and World-space "up" axis is too small
21729
21739
  var camera=this._scene.camera;var forwardAxis=math.normalizeVec3(math.subVec3(camera.look,camera.eye,tempVec3a$6));var rightAxis=math.cross3Vec3(forwardAxis,camera.worldUp,tempVec3b$3);var rightAxisLen=math.sqLenVec3(rightAxis);return rightAxisLen<=0.0001;}/**
21730
- * Returns true if we are currently pivoting.
21731
- *
21732
- * @returns {Boolean}
21733
- */},{key:"getPivoting",value:function getPivoting(){return this._pivoting;}/**
21734
- * Sets a 3D World-space position to pivot about.
21735
- *
21736
- * @param {Number[]} worldPos The new World-space pivot position.
21737
- */},{key:"setPivotPos",value:function setPivotPos(worldPos){this._pivotWorldPos.set(worldPos);this._pivotPosSet=true;}/**
21738
- * Sets the pivot position to the 3D projection of the given 2D canvas coordinates on a sphere centered
21739
- * at the viewpoint. The radius of the sphere is configured via {@link CameraControl#smartPivot}.
21740
- *
21741
- *
21742
- * @param canvasPos
21743
- */},{key:"setCanvasPivotPos",value:function setCanvasPivotPos(canvasPos){var camera=this._scene.camera;var pivotShereRadius=Math.abs(math.distVec3(this._scene.center,camera.eye));var transposedProjectMat=camera.project.transposedMatrix;var Pt3=transposedProjectMat.subarray(8,12);var Pt4=transposedProjectMat.subarray(12);var D=[0,0,-1.0,1];var screenZ=math.dotVec4(D,Pt3)/math.dotVec4(D,Pt4);var worldPos=tempVec4a$3;camera.project.unproject(canvasPos,screenZ,tempVec4b$3,tempVec4c,worldPos);var eyeWorldPosVec=math.normalizeVec3(math.subVec3(worldPos,camera.eye,tempVec3a$6));var posOnSphere=math.addVec3(camera.eye,math.mulVec3Scalar(eyeWorldPosVec,pivotShereRadius,tempVec3b$3),tempVec3c$2);this.setPivotPos(posOnSphere);}/**
21744
- * Gets the current position we're pivoting about.
21745
- * @returns {Number[]} The current World-space pivot position.
21746
- */},{key:"getPivotPos",value:function getPivotPos(){return this._pivotPosSet?this._pivotWorldPos:this._scene.camera.look;// Avoid pivoting about [0,0,0] by default
21740
+ * Returns true if we are currently pivoting.
21741
+ *
21742
+ * @returns {Boolean}
21743
+ */},{key:"getPivoting",value:function getPivoting(){return this._pivoting;}/**
21744
+ * Sets a 3D World-space position to pivot about.
21745
+ *
21746
+ * @param {Number[]} worldPos The new World-space pivot position.
21747
+ */},{key:"setPivotPos",value:function setPivotPos(worldPos){this._pivotWorldPos.set(worldPos);this._pivotPosSet=true;}/**
21748
+ * Sets the pivot position to the 3D projection of the given 2D canvas coordinates on a sphere centered
21749
+ * at the viewpoint. The radius of the sphere is configured via {@link CameraControl#smartPivot}.
21750
+ *
21751
+ *
21752
+ * @param canvasPos
21753
+ */},{key:"setCanvasPivotPos",value:function setCanvasPivotPos(canvasPos){var camera=this._scene.camera;var pivotShereRadius=Math.abs(math.distVec3(this._scene.center,camera.eye));var transposedProjectMat=camera.project.transposedMatrix;var Pt3=transposedProjectMat.subarray(8,12);var Pt4=transposedProjectMat.subarray(12);var D=[0,0,-1.0,1];var screenZ=math.dotVec4(D,Pt3)/math.dotVec4(D,Pt4);var worldPos=tempVec4a$3;camera.project.unproject(canvasPos,screenZ,tempVec4b$3,tempVec4c,worldPos);var eyeWorldPosVec=math.normalizeVec3(math.subVec3(worldPos,camera.eye,tempVec3a$6));var posOnSphere=math.addVec3(camera.eye,math.mulVec3Scalar(eyeWorldPosVec,pivotShereRadius,tempVec3b$3),tempVec3c$2);this.setPivotPos(posOnSphere);}/**
21754
+ * Gets the current position we're pivoting about.
21755
+ * @returns {Number[]} The current World-space pivot position.
21756
+ */},{key:"getPivotPos",value:function getPivotPos(){return this._pivotPosSet?this._pivotWorldPos:this._scene.camera.look;// Avoid pivoting about [0,0,0] by default
21747
21757
  }/**
21748
- * Continues to pivot.
21749
- *
21750
- * @param {Number} yawInc Yaw rotation increment.
21751
- * @param {Number} pitchInc Pitch rotation increment.
21752
- */},{key:"continuePivot",value:function continuePivot(yawInc,pitchInc){if(!this._pivoting){return;}if(yawInc===0&&pitchInc===0){return;}var camera=this._scene.camera;var dx=-yawInc;var dy=-pitchInc;if(camera.worldUp[2]===1){dx=-dx;}this._azimuth+=-dx*.01;this._polar+=dy*.01;this._polar=math.clamp(this._polar,.001,Math.PI-.001);var pos=[this._radius*Math.sin(this._polar)*Math.sin(this._azimuth),this._radius*Math.cos(this._polar),this._radius*Math.sin(this._polar)*Math.cos(this._azimuth)];if(camera.worldUp[2]===1){var t=pos[1];pos[1]=pos[2];pos[2]=t;}// Preserve the eye->look distance, since in xeokit "look" is the point-of-interest, not the direction vector.
21758
+ * Continues to pivot.
21759
+ *
21760
+ * @param {Number} yawInc Yaw rotation increment.
21761
+ * @param {Number} pitchInc Pitch rotation increment.
21762
+ */},{key:"continuePivot",value:function continuePivot(yawInc,pitchInc){if(!this._pivoting){return;}if(yawInc===0&&pitchInc===0){return;}var camera=this._scene.camera;var dx=-yawInc;var dy=-pitchInc;if(camera.worldUp[2]===1){dx=-dx;}this._azimuth+=-dx*0.01;this._polar+=dy*0.01;this._polar=math.clamp(this._polar,0.001,Math.PI-0.001);var pos=[this._radius*Math.sin(this._polar)*Math.sin(this._azimuth),this._radius*Math.cos(this._polar),this._radius*Math.sin(this._polar)*Math.cos(this._azimuth)];if(camera.worldUp[2]===1){var t=pos[1];pos[1]=pos[2];pos[2]=t;}// Preserve the eye->look distance, since in xeokit "look" is the point-of-interest, not the direction vector.
21753
21763
  var eyeLookLen=math.lenVec3(math.subVec3(camera.look,camera.eye,math.vec3()));var pivotPos=this.getPivotPos();math.addVec3(pos,pivotPos);var lookat=math.lookAtMat4v(pos,pivotPos,camera.worldUp);lookat=math.inverseMat4(lookat);var offset=math.transformVec3(lookat,this._cameraOffset);lookat[12]-=offset[0];lookat[13]-=offset[1];lookat[14]-=offset[2];var zAxis=[lookat[8],lookat[9],lookat[10]];camera.eye=[lookat[12],lookat[13],lookat[14]];math.subVec3(camera.eye,math.mulVec3Scalar(zAxis,eyeLookLen),camera.look);camera.up=[lookat[4],lookat[5],lookat[6]];this.showPivot();}/**
21754
- * Shows the pivot position.
21755
- *
21756
- * Only works if we set an HTML DOM element to represent the pivot position.
21757
- */},{key:"showPivot",value:function showPivot(){if(this._shown){return;}if(this._pivotElement){this.updatePivotElement();this._pivotElement.style.visibility="visible";}if(this._pivotSphereEnabled){this.destroyPivotSphere();this.createPivotSphere();}this._shown=true;}/**
21758
- * Hides the pivot position.
21759
- *
21760
- * Only works if we set an HTML DOM element to represent the pivot position.
21761
- */},{key:"hidePivot",value:function hidePivot(){if(!this._shown){return;}if(this._pivotElement){this._pivotElement.style.visibility="hidden";}if(this._pivotSphereEnabled){this.destroyPivotSphere();}this._shown=false;}/**
21762
- * Finishes pivoting.
21763
- */},{key:"endPivot",value:function endPivot(){this._pivoting=false;}},{key:"destroy",value:function destroy(){this.destroyPivotSphere();this._scene.camera.off(this._onViewMatrix);this._scene.camera.off(this._onProjMatrix);this._scene.off(this._onTick);}}]);return PivotController;}();/**
21764
+ * Shows the pivot position.
21765
+ *
21766
+ * Only works if we set an HTML DOM element to represent the pivot position.
21767
+ */},{key:"showPivot",value:function showPivot(){if(this._shown){return;}if(this._pivotElement){this.updatePivotElement();this._pivotElement.style.visibility="visible";}if(this._pivotSphereEnabled){this.destroyPivotSphere();this.createPivotSphere();}this._shown=true;}/**
21768
+ * Hides the pivot position.
21769
+ *
21770
+ * Only works if we set an HTML DOM element to represent the pivot position.
21771
+ */},{key:"hidePivot",value:function hidePivot(){if(!this._shown){return;}if(this._pivotElement){this._pivotElement.style.visibility="hidden";}if(this._pivotSphereEnabled){this.destroyPivotSphere();}this._shown=false;}/**
21772
+ * Finishes pivoting.
21773
+ */},{key:"endPivot",value:function endPivot(){this._pivoting=false;}},{key:"destroy",value:function destroy(){this.destroyPivotSphere();this._scene.camera.off(this._onViewMatrix);this._scene.camera.off(this._onProjMatrix);this._scene.off(this._onTick);}}]);return PivotController;}();/**
21764
21774
  *
21765
21775
  * @private
21766
21776
  */var PickController=/*#__PURE__*/function(){function PickController(cameraControl,configs){_classCallCheck(this,PickController);/**
@@ -22368,81 +22378,81 @@ getCanvasPosFromEvent(changedTouches[0],pickController.pickCursorPos);pickContro
22368
22378
  * * ````"qwerty"````
22369
22379
  * * ````"azerty"````
22370
22380
  */var CameraControl=/*#__PURE__*/function(_Component38){_inherits(CameraControl,_Component38);var _super136=_createSuper(CameraControl);/**
22371
- * @private
22372
- * @constructor
22373
- */function CameraControl(owner){var _this105;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CameraControl);_this105=_super136.call(this,owner,cfg);/**
22374
- * Identifies the XX action.
22375
- * @final
22376
- * @type {Number}
22377
- */_this105.PAN_LEFT=0;/**
22378
- * Identifies the XX action.
22379
- * @final
22380
- * @type {Number}
22381
- */_this105.PAN_RIGHT=1;/**
22382
- * Identifies the XX action.
22383
- * @final
22384
- * @type {Number}
22385
- */_this105.PAN_UP=2;/**
22386
- * Identifies the XX action.
22387
- * @final
22388
- * @type {Number}
22389
- */_this105.PAN_DOWN=3;/**
22390
- * Identifies the XX action.
22391
- * @final
22392
- * @type {Number}
22393
- */_this105.PAN_FORWARDS=4;/**
22394
- * Identifies the XX action.
22395
- * @final
22396
- * @type {Number}
22397
- */_this105.PAN_BACKWARDS=5;/**
22398
- * Identifies the XX action.
22399
- * @final
22400
- * @type {Number}
22401
- */_this105.ROTATE_X_POS=6;/**
22402
- * Identifies the XX action.
22403
- * @final
22404
- * @type {Number}
22405
- */_this105.ROTATE_X_NEG=7;/**
22406
- * Identifies the XX action.
22407
- * @final
22408
- * @type {Number}
22409
- */_this105.ROTATE_Y_POS=8;/**
22410
- * Identifies the XX action.
22411
- * @final
22412
- * @type {Number}
22413
- */_this105.ROTATE_Y_NEG=9;/**
22414
- * Identifies the XX action.
22415
- * @final
22416
- * @type {Number}
22417
- */_this105.DOLLY_FORWARDS=10;/**
22418
- * Identifies the XX action.
22419
- * @final
22420
- * @type {Number}
22421
- */_this105.DOLLY_BACKWARDS=11;/**
22422
- * Identifies the XX action.
22423
- * @final
22424
- * @type {Number}
22425
- */_this105.AXIS_VIEW_RIGHT=12;/**
22426
- * Identifies the XX action.
22427
- * @final
22428
- * @type {Number}
22429
- */_this105.AXIS_VIEW_BACK=13;/**
22430
- * Identifies the XX action.
22431
- * @final
22432
- * @type {Number}
22433
- */_this105.AXIS_VIEW_LEFT=14;/**
22434
- * Identifies the XX action.
22435
- * @final
22436
- * @type {Number}
22437
- */_this105.AXIS_VIEW_FRONT=15;/**
22438
- * Identifies the XX action.
22439
- * @final
22440
- * @type {Number}
22441
- */_this105.AXIS_VIEW_TOP=16;/**
22442
- * Identifies the XX action.
22443
- * @final
22444
- * @type {Number}
22445
- */_this105.AXIS_VIEW_BOTTOM=17;_this105._keyMap={};// Maps key codes to the above actions
22381
+ * @private
22382
+ * @constructor
22383
+ */function CameraControl(owner){var _this105;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CameraControl);_this105=_super136.call(this,owner,cfg);/**
22384
+ * Identifies the XX action.
22385
+ * @final
22386
+ * @type {Number}
22387
+ */_this105.PAN_LEFT=0;/**
22388
+ * Identifies the XX action.
22389
+ * @final
22390
+ * @type {Number}
22391
+ */_this105.PAN_RIGHT=1;/**
22392
+ * Identifies the XX action.
22393
+ * @final
22394
+ * @type {Number}
22395
+ */_this105.PAN_UP=2;/**
22396
+ * Identifies the XX action.
22397
+ * @final
22398
+ * @type {Number}
22399
+ */_this105.PAN_DOWN=3;/**
22400
+ * Identifies the XX action.
22401
+ * @final
22402
+ * @type {Number}
22403
+ */_this105.PAN_FORWARDS=4;/**
22404
+ * Identifies the XX action.
22405
+ * @final
22406
+ * @type {Number}
22407
+ */_this105.PAN_BACKWARDS=5;/**
22408
+ * Identifies the XX action.
22409
+ * @final
22410
+ * @type {Number}
22411
+ */_this105.ROTATE_X_POS=6;/**
22412
+ * Identifies the XX action.
22413
+ * @final
22414
+ * @type {Number}
22415
+ */_this105.ROTATE_X_NEG=7;/**
22416
+ * Identifies the XX action.
22417
+ * @final
22418
+ * @type {Number}
22419
+ */_this105.ROTATE_Y_POS=8;/**
22420
+ * Identifies the XX action.
22421
+ * @final
22422
+ * @type {Number}
22423
+ */_this105.ROTATE_Y_NEG=9;/**
22424
+ * Identifies the XX action.
22425
+ * @final
22426
+ * @type {Number}
22427
+ */_this105.DOLLY_FORWARDS=10;/**
22428
+ * Identifies the XX action.
22429
+ * @final
22430
+ * @type {Number}
22431
+ */_this105.DOLLY_BACKWARDS=11;/**
22432
+ * Identifies the XX action.
22433
+ * @final
22434
+ * @type {Number}
22435
+ */_this105.AXIS_VIEW_RIGHT=12;/**
22436
+ * Identifies the XX action.
22437
+ * @final
22438
+ * @type {Number}
22439
+ */_this105.AXIS_VIEW_BACK=13;/**
22440
+ * Identifies the XX action.
22441
+ * @final
22442
+ * @type {Number}
22443
+ */_this105.AXIS_VIEW_LEFT=14;/**
22444
+ * Identifies the XX action.
22445
+ * @final
22446
+ * @type {Number}
22447
+ */_this105.AXIS_VIEW_FRONT=15;/**
22448
+ * Identifies the XX action.
22449
+ * @final
22450
+ * @type {Number}
22451
+ */_this105.AXIS_VIEW_TOP=16;/**
22452
+ * Identifies the XX action.
22453
+ * @final
22454
+ * @type {Number}
22455
+ */_this105.AXIS_VIEW_BOTTOM=17;_this105._keyMap={};// Maps key codes to the above actions
22446
22456
  _this105.scene.canvas.canvas.oncontextmenu=function(e){e.preventDefault();};// User-settable CameraControl configurations
22447
22457
  _this105._configs={// Private
22448
22458
  longTapTimeout:600,// Millisecs
@@ -22459,509 +22469,509 @@ _this105._handlers=[new MouseMiscHandler(_this105.scene,_this105._controllers,_t
22459
22469
  _this105._cameraUpdater=new CameraUpdater(_this105.scene,_this105._controllers,_this105._configs,_this105._states,_this105._updates);// Set initial user configurations
22460
22470
  _this105.navMode=cfg.navMode;if(cfg.planView){_this105.planView=cfg.planView;}_this105.constrainVertical=cfg.constrainVertical;if(cfg.keyboardLayout){_this105.keyboardLayout=cfg.keyboardLayout;// Deprecated
22461
22471
  }else{_this105.keyMap=cfg.keyMap;}_this105.doublePickFlyTo=cfg.doublePickFlyTo;_this105.panRightClick=cfg.panRightClick;_this105.active=cfg.active;_this105.followPointer=cfg.followPointer;_this105.rotationInertia=cfg.rotationInertia;_this105.keyboardPanRate=cfg.keyboardPanRate;_this105.touchPanRate=cfg.touchPanRate;_this105.keyboardRotationRate=cfg.keyboardRotationRate;_this105.dragRotationRate=cfg.dragRotationRate;_this105.touchDollyRate=cfg.touchDollyRate;_this105.dollyInertia=cfg.dollyInertia;_this105.dollyProximityThreshold=cfg.dollyProximityThreshold;_this105.dollyMinSpeed=cfg.dollyMinSpeed;_this105.panInertia=cfg.panInertia;_this105.pointerEnabled=true;_this105.keyboardDollyRate=cfg.keyboardDollyRate;_this105.mouseWheelDollyRate=cfg.mouseWheelDollyRate;return _this105;}/**
22462
- * Sets custom mappings of keys to ````CameraControl```` actions.
22463
- *
22464
- * See class docs for usage.
22465
- *
22466
- * @param {{Number:Number}|String} value Either a set of new key mappings, or a string to select a keyboard layout,
22467
- * which causes ````CameraControl```` to use the default key mappings for that layout.
22468
- */_createClass(CameraControl,[{key:"keyMap",get:/**
22469
- * Gets custom mappings of keys to {@link CameraControl} actions.
22470
- *
22471
- * @returns {{Number:Number}} Current key mappings.
22472
- */function get(){return this._keyMap;}/**
22473
- * Returns true if any keys configured for the given action are down.
22474
- * @param action
22475
- * @param keyDownMap
22476
- * @private
22477
- */,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"
22472
+ * Sets custom mappings of keys to ````CameraControl```` actions.
22473
+ *
22474
+ * See class docs for usage.
22475
+ *
22476
+ * @param {{Number:Number}|String} value Either a set of new key mappings, or a string to select a keyboard layout,
22477
+ * which causes ````CameraControl```` to use the default key mappings for that layout.
22478
+ */_createClass(CameraControl,[{key:"keyMap",get:/**
22479
+ * Gets custom mappings of keys to {@link CameraControl} actions.
22480
+ *
22481
+ * @returns {{Number:Number}} Current key mappings.
22482
+ */function get(){return this._keyMap;}/**
22483
+ * Returns true if any keys configured for the given action are down.
22484
+ * @param action
22485
+ * @param keyDownMap
22486
+ * @private
22487
+ */,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"
22478
22488
  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 _i466=0,len=keys.length;_i466<len;_i466++){var key=keys[_i466];if(keyDownMap[key]){return true;}}return false;}/**
22479
- * Sets the HTMl element to represent the pivot point when {@link CameraControl#followPointer} is true.
22480
- *
22481
- * See class comments for an example.
22482
- *
22483
- * @param {HTMLElement} element HTML element representing the pivot point.
22484
- */},{key:"pivotElement",set:function set(element){this._controllers.pivotController.setPivotElement(element);}/**
22485
- * Sets if this ````CameraControl```` is active or not.
22486
- *
22487
- * When inactive, the ````CameraControl```` will not react to input.
22488
- *
22489
- * Default is ````true````.
22490
- *
22491
- * @param {Boolean} value Set ````true```` to activate this ````CameraControl````.
22492
- */},{key:"active",get:/**
22493
- * Gets if this ````CameraControl```` is active or not.
22494
- *
22495
- * When inactive, the ````CameraControl```` will not react to input.
22496
- *
22497
- * Default is ````true````.
22498
- *
22499
- * @returns {Boolean} Returns ````true```` if this ````CameraControl```` is active.
22500
- */function get(){return this._configs.active;}/**
22501
- * Sets whether the pointer snap to vertex.
22502
- *
22503
- * @param {boolean} snapToVertex
22504
- */,set:function set(value){value=value!==false;this._configs.active=value;this._handlers[1]._active=value;this._handlers[5]._active=value;}},{key:"snapToVertex",get:/**
22505
- * Gets whether the pointer snap to vertex.
22506
- *
22507
- * @returns {boolean}
22508
- */function get(){return this._configs.snapToVertex;}/**
22509
- * Sets whether the pointer snap to edge.
22510
- *
22511
- * @param {boolean} snapToEdge
22512
- */,set:function set(snapToVertex){this._configs.snapToVertex=!!snapToVertex;}},{key:"snapToEdge",get:/**
22513
- * Gets whether the pointer snap to edge.
22514
- *
22515
- * @returns {boolean}
22516
- */function get(){return this._configs.snapToEdge;}/**
22517
- * Sets the current snap radius for "hoverSnapOrSurface" events, to specify whether the radius
22518
- * within which the pointer snaps to the nearest vertex or the nearest edge.
22519
- *
22520
- * Default value is 30 pixels.
22521
- *
22522
- * @param {Number} snapRadius The snap radius.
22523
- */,set:function set(snapToEdge){this._configs.snapToEdge=!!snapToEdge;}},{key:"snapRadius",get:/**
22524
- * Gets the current snap radius.
22525
- *
22526
- * @returns {Number} The snap radius.
22527
- */function get(){return this._configs.snapRadius;}/**
22528
- * Sets the current navigation mode.
22529
- *
22530
- * Accepted values are:
22531
- *
22532
- * * "orbit" - rotation orbits about the current target or pivot point,
22533
- * * "firstPerson" - rotation is about the current eye position,
22534
- * * "planView" - rotation is disabled.
22535
- *
22536
- * See class comments for more info.
22537
- *
22538
- * @param {String} navMode The navigation mode: "orbit", "firstPerson" or "planView".
22539
- */,set:function set(snapRadius){snapRadius=snapRadius||DEFAULT_SNAP_PICK_RADIUS;this._configs.snapRadius=snapRadius;}},{key:"navMode",get:/**
22540
- * Gets the current navigation mode.
22541
- *
22542
- * @returns {String} The navigation mode: "orbit", "firstPerson" or "planView".
22543
- */function get(){return this._configs.navMode;}/**
22544
- * Sets whether mouse and touch input is enabled.
22545
- *
22546
- * Default is ````true````.
22547
- *
22548
- * Disabling mouse and touch input on ````CameraControl```` is useful when we want to temporarily use mouse or
22549
- * touch input to interact with some other 3D control, without disturbing the {@link Camera}.
22550
- *
22551
- * @param {Boolean} value Set ````true```` to enable mouse and touch input.
22552
- */,set:function set(navMode){navMode=navMode||"orbit";if(navMode!=="firstPerson"&&navMode!=="orbit"&&navMode!=="planView"){this.error("Unsupported value for navMode: "+navMode+" - supported values are 'orbit', 'firstPerson' and 'planView' - defaulting to 'orbit'");navMode="orbit";}this._configs.firstPerson=navMode==="firstPerson";this._configs.planView=navMode==="planView";if(this._configs.firstPerson||this._configs.planView){this._controllers.pivotController.hidePivot();this._controllers.pivotController.endPivot();}this._configs.navMode=navMode;}},{key:"pointerEnabled",get:/**
22553
- * Gets whether mouse and touch input is enabled.
22554
- *
22555
- * Default is ````true````.
22556
- *
22557
- * Disabling mouse and touch input on ````CameraControl```` is desirable when we want to temporarily use mouse or
22558
- * touch input to interact with some other 3D control, without interfering with the {@link Camera}.
22559
- *
22560
- * @returns {Boolean} Returns ````true```` if mouse and touch input is enabled.
22561
- */function get(){return this._configs.pointerEnabled;}/**
22562
- * Sets whether the {@link Camera} follows the mouse/touch pointer.
22563
- *
22564
- * In orbiting mode, the Camera will orbit about the pointer, and will dolly to and from the pointer.
22565
- *
22566
- * In fly-to mode, the Camera will dolly to and from the pointer, however the World will always rotate about the Camera position.
22567
- *
22568
- * In plan-view mode, the Camera will dolly to and from the pointer, however the Camera will not rotate.
22569
- *
22570
- * Default is ````true````.
22571
- *
22572
- * See class comments for more info.
22573
- *
22574
- * @param {Boolean} value Set ````true```` to enable the Camera to follow the pointer.
22575
- */,set:function set(value){this._reset();this._configs.pointerEnabled=!!value;}},{key:"_reset",value:function _reset(){for(var _i467=0,len=this._handlers.length;_i467<len;_i467++){var handler=this._handlers[_i467];if(handler.reset){handler.reset();}}this._updates.panDeltaX=0;this._updates.panDeltaY=0;this._updates.rotateDeltaX=0;this._updates.rotateDeltaY=0;this._updates.dolyDelta=0;}},{key:"followPointer",get:/**
22576
- * Sets whether the {@link Camera} follows the mouse/touch pointer.
22577
- *
22578
- * In orbiting mode, the Camera will orbit about the pointer, and will dolly to and from the pointer.
22579
- *
22580
- * In fly-to mode, the Camera will dolly to and from the pointer, however the World will always rotate about the Camera position.
22581
- *
22582
- * In plan-view mode, the Camera will dolly to and from the pointer, however the Camera will not rotate.
22583
- *
22584
- * Default is ````true````.
22585
- *
22586
- * See class comments for more info.
22587
- *
22588
- * @returns {Boolean} Returns ````true```` if the Camera follows the pointer.
22589
- */function get(){return this._configs.followPointer;}/**
22590
- * Sets the current World-space 3D target position.
22591
- *
22592
- * Only applies when {@link CameraControl#followPointer} is ````true````.
22593
- *
22594
- * @param {Number[]} worldPos The new World-space 3D target position.
22595
- */,set:function set(value){this._configs.followPointer=value!==false;}},{key:"pivotPos",get:/**
22596
- * Gets the current World-space 3D pivot position.
22597
- *
22598
- * Only applies when {@link CameraControl#followPointer} is ````true````.
22599
- *
22600
- * @return {Number[]} worldPos The current World-space 3D pivot position.
22601
- */function get(){return this._controllers.pivotController.getPivotPos();}/**
22602
- * @deprecated
22603
- * @param {Boolean} value Set ````true```` to enable dolly-to-pointer behaviour.
22604
- */,set:function set(worldPos){this._controllers.pivotController.setPivotPos(worldPos);}},{key:"dollyToPointer",get:/**
22605
- * @deprecated
22606
- * @returns {Boolean} Returns ````true```` if dolly-to-pointer behaviour is enabled.
22607
- */function get(){this.warn("dollyToPointer property is deprecated - replaced with followPointer");return this.followPointer;}/**
22608
- * @deprecated
22609
- * @param {Boolean} value Set ````true```` to enable dolly-to-pointer behaviour.
22610
- */,set:function set(value){this.warn("dollyToPointer property is deprecated - replaced with followPointer");this.followPointer=value;}},{key:"panToPointer",get:/**
22611
- * @deprecated
22612
- * @returns {Boolean} Returns ````true```` if dolly-to-pointer behaviour is enabled.
22613
- */function get(){this.warn("panToPointer property is deprecated - replaced with followPointer");return false;}/**
22614
- * Sets whether this ````CameraControl```` is in plan-view mode.
22615
- *
22616
- * When in plan-view mode, rotation is disabled.
22617
- *
22618
- * Default is ````false````.
22619
- *
22620
- * Deprecated - use {@link CameraControl#navMode} instead.
22621
- *
22622
- * @param {Boolean} value Set ````true```` to enable plan-view mode.
22623
- * @deprecated
22624
- */,set:function set(value){this.warn("panToPointer property is deprecated - replaced with followPointer");}},{key:"planView",get:/**
22625
- * Gets whether this ````CameraControl```` is in plan-view mode.
22626
- *
22627
- * When in plan-view mode, rotation is disabled.
22628
- *
22629
- * Default is ````false````.
22630
- *
22631
- * Deprecated - use {@link CameraControl#navMode} instead.
22632
- *
22633
- * @returns {Boolean} Returns ````true```` if plan-view mode is enabled.
22634
- * @deprecated
22635
- */function get(){this.warn("planView property is deprecated - replaced with navMode");return this._configs.planView;}/**
22636
- * Sets whether this ````CameraControl```` is in first-person mode.
22637
- *
22638
- * In "first person" mode (disabled by default) the look position rotates about the eye position. Otherwise, {@link Camera#eye} rotates about {@link Camera#look}.
22639
- *
22640
- * Default is ````false````.
22641
- *
22642
- * Deprecated - use {@link CameraControl#navMode} instead.
22643
- *
22644
- * @param {Boolean} value Set ````true```` to enable first-person mode.
22645
- * @deprecated
22646
- */,set:function set(value){this._configs.planView=!!value;this._configs.firstPerson=false;if(this._configs.planView){this._controllers.pivotController.hidePivot();this._controllers.pivotController.endPivot();}this.warn("planView property is deprecated - replaced with navMode");}},{key:"firstPerson",get:/**
22647
- * Gets whether this ````CameraControl```` is in first-person mode.
22648
- *
22649
- * In "first person" mode (disabled by default) the look position rotates about the eye position. Otherwise, {@link Camera#eye} rotates about {@link Camera#look}.
22650
- *
22651
- * Default is ````false````.
22652
- *
22653
- * Deprecated - use {@link CameraControl#navMode} instead.
22654
- *
22655
- * @returns {Boolean} Returns ````true```` if first-person mode is enabled.
22656
- * @deprecated
22657
- */function get(){this.warn("firstPerson property is deprecated - replaced with navMode");return this._configs.firstPerson;}/**
22658
- * Sets whether to vertically constrain the {@link Camera} position for first-person navigation.
22659
- *
22660
- * When set ````true````, this constrains {@link Camera#eye} to its current vertical position.
22661
- *
22662
- * Only applies when {@link CameraControl#navMode} is ````"firstPerson"````.
22663
- *
22664
- * Default is ````false````.
22665
- *
22666
- * @param {Boolean} value Set ````true```` to vertically constrain the Camera.
22667
- */,set:function set(value){this.warn("firstPerson property is deprecated - replaced with navMode");this._configs.firstPerson=!!value;this._configs.planView=false;if(this._configs.firstPerson){this._controllers.pivotController.hidePivot();this._controllers.pivotController.endPivot();}}},{key:"constrainVertical",get:/**
22668
- * Gets whether to vertically constrain the {@link Camera} position for first-person navigation.
22669
- *
22670
- * When set ````true````, this constrains {@link Camera#eye} to its current vertical position.
22671
- *
22672
- * Only applies when {@link CameraControl#navMode} is ````"firstPerson"````.
22673
- *
22674
- * Default is ````false````.
22675
- *
22676
- * @returns {Boolean} ````true```` when Camera is vertically constrained.
22677
- */function get(){return this._configs.constrainVertical;}/**
22678
- * Sets whether double-picking an {@link Entity} causes the {@link Camera} to fly to its boundary.
22679
- *
22680
- * Default is ````false````.
22681
- *
22682
- * @param {Boolean} value Set ````true```` to enable double-pick-fly-to mode.
22683
- */,set:function set(value){this._configs.constrainVertical=!!value;}},{key:"doublePickFlyTo",get:/**
22684
- * Gets whether double-picking an {@link Entity} causes the {@link Camera} to fly to its boundary.
22685
- *
22686
- * Default is ````false````.
22687
- *
22688
- * @returns {Boolean} Returns ````true```` when double-pick-fly-to mode is enabled.
22689
- */function get(){return this._configs.doublePickFlyTo;}/**
22690
- * Sets whether either right-clicking (true) or middle-clicking (false) pans the {@link Camera}.
22691
- *
22692
- * Default is ````true````.
22693
- *
22694
- * @param {Boolean} value Set ````false```` to disable pan on right-click.
22695
- */,set:function set(value){this._configs.doublePickFlyTo=value!==false;}},{key:"panRightClick",get:/**
22696
- * Gets whether right-clicking pans the {@link Camera}.
22697
- *
22698
- * Default is ````true````.
22699
- *
22700
- * @returns {Boolean} Returns ````false```` when pan on right-click is disabled.
22701
- */function get(){return this._configs.panRightClick;}/**
22702
- * Sets a factor in range ````[0..1]```` indicating how much the {@link Camera} keeps moving after you finish rotating it.
22703
- *
22704
- * A value of ````0.0```` causes it to immediately stop, ````0.5```` causes its movement to decay 50% on each tick,
22705
- * while ````1.0```` causes no decay, allowing it continue moving, by the current rate of rotation.
22706
- *
22707
- * You may choose an inertia of zero when you want be able to precisely rotate the Camera,
22708
- * without interference from inertia. Zero inertia can also mean that less frames are rendered while
22709
- * you are rotating the Camera.
22710
- *
22711
- * Default is ````0.0````.
22712
- *
22713
- * Does not apply when {@link CameraControl#navMode} is ````"planView"````, which disallows rotation.
22714
- *
22715
- * @param {Number} rotationInertia New inertial factor.
22716
- */,set:function set(value){this._configs.panRightClick=value!==false;}},{key:"rotationInertia",get:/**
22717
- * Gets the rotation inertia factor.
22718
- *
22719
- * Default is ````0.0````.
22720
- *
22721
- * Does not apply when {@link CameraControl#navMode} is ````"planView"````, which disallows rotation.
22722
- *
22723
- * @returns {Number} The inertia factor.
22724
- */function get(){return this._configs.rotationInertia;}/**
22725
- * Sets how much the {@link Camera} pans each second with keyboard input.
22726
- *
22727
- * Default is ````5.0````, to pan the Camera ````5.0```` World-space units every second that
22728
- * a panning key is depressed. See the ````CameraControl```` class documentation for which keys control
22729
- * panning.
22730
- *
22731
- * Panning direction is aligned to our Camera's orientation. When we pan horizontally, we pan
22732
- * to our left and right, when we pan vertically, we pan upwards and downwards, and when we pan forwards
22733
- * and backwards, we pan along the direction the Camera is pointing.
22734
- *
22735
- * Unlike dollying when {@link followPointer} is ````true````, panning does not follow the pointer.
22736
- *
22737
- * @param {Number} keyboardPanRate The new keyboard pan rate.
22738
- */,set:function set(rotationInertia){this._configs.rotationInertia=rotationInertia!==undefined&&rotationInertia!==null?rotationInertia:0.0;}},{key:"keyboardPanRate",get:/**
22739
- * Gets how much the {@link Camera} pans each second with keyboard input.
22740
- *
22741
- * Default is ````5.0````.
22742
- *
22743
- * @returns {Number} The current keyboard pan rate.
22744
- */function get(){return this._configs.keyboardPanRate;}/**
22745
- * Sets how many degrees per second the {@link Camera} rotates/orbits with keyboard input.
22746
- *
22747
- * Default is ````90.0````, to rotate/orbit the Camera ````90.0```` degrees every second that
22748
- * a rotation key is depressed. See the ````CameraControl```` class documentation for which keys control
22749
- * rotation/orbit.
22750
- *
22751
- * @param {Number} keyboardRotationRate The new keyboard rotation rate.
22752
- */,set:function set(keyboardPanRate){this._configs.keyboardPanRate=keyboardPanRate!==null&&keyboardPanRate!==undefined?keyboardPanRate:5.0;}/**
22753
- * Sets how fast the camera pans on touch panning
22754
- *
22755
- * @param {Number} touchPanRate The new touch pan rate.
22756
- */},{key:"touchPanRate",get:/**
22757
- * Gets how fast the {@link Camera} pans on touch panning
22758
- *
22759
- * Default is ````1.0````.
22760
- *
22761
- * @returns {Number} The current touch pan rate.
22762
- */function get(){return this._configs.touchPanRate;},set:function set(touchPanRate){this._configs.touchPanRate=touchPanRate!==null&&touchPanRate!==undefined?touchPanRate:1.0;}},{key:"keyboardRotationRate",get:/**
22763
- * Sets how many degrees per second the {@link Camera} rotates/orbits with keyboard input.
22764
- *
22765
- * Default is ````90.0````.
22766
- *
22767
- * @returns {Number} The current keyboard rotation rate.
22768
- */function get(){return this._configs.keyboardRotationRate;}/**
22769
- * Sets the current drag rotation rate.
22770
- *
22771
- * This configures how many degrees the {@link Camera} rotates/orbits for a full sweep of the canvas by mouse or touch dragging.
22772
- *
22773
- * For example, a value of ````360.0```` indicates that the ````Camera```` rotates/orbits ````360.0```` degrees horizontally
22774
- * when we sweep the entire width of the canvas.
22775
- *
22776
- * ````CameraControl```` makes vertical rotation half as sensitive as horizontal rotation, so that we don't tend to
22777
- * flip upside-down. Therefore, a value of ````360.0```` rotates/orbits the ````Camera```` through ````180.0```` degrees
22778
- * vertically when we sweep the entire height of the canvas.
22779
- *
22780
- * Default is ````360.0````.
22781
- *
22782
- * @param {Number} dragRotationRate The new drag rotation rate.
22783
- */,set:function set(keyboardRotationRate){this._configs.keyboardRotationRate=keyboardRotationRate!==null&&keyboardRotationRate!==undefined?keyboardRotationRate:90.0;}},{key:"dragRotationRate",get:/**
22784
- * Gets the current drag rotation rate.
22785
- *
22786
- * Default is ````360.0````.
22787
- *
22788
- * @returns {Number} The current drag rotation rate.
22789
- */function get(){return this._configs.dragRotationRate;}/**
22790
- * Sets how much the {@link Camera} dollys each second with keyboard input.
22791
- *
22792
- * Default is ````15.0````, to dolly the {@link Camera} ````15.0```` World-space units per second while we hold down
22793
- * the ````+```` and ````-```` keys.
22794
- *
22795
- * @param {Number} keyboardDollyRate The new keyboard dolly rate.
22796
- */,set:function set(dragRotationRate){this._configs.dragRotationRate=dragRotationRate!==null&&dragRotationRate!==undefined?dragRotationRate:360.0;}},{key:"keyboardDollyRate",get:/**
22797
- * Gets how much the {@link Camera} dollys each second with keyboard input.
22798
- *
22799
- * Default is ````15.0````.
22800
- *
22801
- * @returns {Number} The current keyboard dolly rate.
22802
- */function get(){return this._configs.keyboardDollyRate;}/**
22803
- * Sets how much the {@link Camera} dollys with touch input.
22804
- *
22805
- * Default is ````0.2````
22806
- *
22807
- * @param {Number} touchDollyRate The new touch dolly rate.
22808
- */,set:function set(keyboardDollyRate){this._configs.keyboardDollyRate=keyboardDollyRate!==null&&keyboardDollyRate!==undefined?keyboardDollyRate:15.0;}},{key:"touchDollyRate",get:/**
22809
- * Gets how much the {@link Camera} dollys each second with touch input.
22810
- *
22811
- * Default is ````0.2````.
22812
- *
22813
- * @returns {Number} The current touch dolly rate.
22814
- */function get(){return this._configs.touchDollyRate;}/**
22815
- * Sets how much the {@link Camera} dollys each second while the mouse wheel is spinning.
22816
- *
22817
- * Default is ````100.0````, to dolly the {@link Camera} ````10.0```` World-space units per second as we spin
22818
- * the mouse wheel.
22819
- *
22820
- * @param {Number} mouseWheelDollyRate The new mouse wheel dolly rate.
22821
- */,set:function set(touchDollyRate){this._configs.touchDollyRate=touchDollyRate!==null&&touchDollyRate!==undefined?touchDollyRate:0.2;}},{key:"mouseWheelDollyRate",get:/**
22822
- * Gets how much the {@link Camera} dollys each second while the mouse wheel is spinning.
22823
- *
22824
- * Default is ````100.0````.
22825
- *
22826
- * @returns {Number} The current mouseWheel dolly rate.
22827
- */function get(){return this._configs.mouseWheelDollyRate;}/**
22828
- * Sets the dolly inertia factor.
22829
- *
22830
- * This factor configures how much the {@link Camera} keeps moving after you finish dollying it.
22831
- *
22832
- * This factor is a value in range ````[0..1]````. A value of ````0.0```` causes dollying to immediately stop,
22833
- * ````0.5```` causes dollying to decay 50% on each animation frame, while ````1.0```` causes no decay, which allows dollying
22834
- * to continue until further input stops it.
22835
- *
22836
- * You might set ````dollyInertia```` to zero when you want be able to precisely position or rotate the Camera,
22837
- * without interference from inertia. This also means that xeokit renders less frames while dollying the Camera,
22838
- * which can improve rendering performance.
22839
- *
22840
- * Default is ````0````.
22841
- *
22842
- * @param {Number} dollyInertia New dolly inertia factor.
22843
- */,set:function set(mouseWheelDollyRate){this._configs.mouseWheelDollyRate=mouseWheelDollyRate!==null&&mouseWheelDollyRate!==undefined?mouseWheelDollyRate:100.0;}},{key:"dollyInertia",get:/**
22844
- * Gets the dolly inertia factor.
22845
- *
22846
- * Default is ````0````.
22847
- *
22848
- * @returns {Number} The current dolly inertia factor.
22849
- */function get(){return this._configs.dollyInertia;}/**
22850
- * Sets the proximity to the closest object below which dolly speed decreases, and above which dolly speed increases.
22851
- *
22852
- * Default is ````35.0````.
22853
- *
22854
- * @param {Number} dollyProximityThreshold New dolly proximity threshold.
22855
- */,set:function set(dollyInertia){this._configs.dollyInertia=dollyInertia!==undefined&&dollyInertia!==null?dollyInertia:0;}},{key:"dollyProximityThreshold",get:/**
22856
- * Gets the proximity to the closest object below which dolly speed decreases, and above which dolly speed increases.
22857
- *
22858
- * Default is ````35.0````.
22859
- *
22860
- * @returns {Number} The current dolly proximity threshold.
22861
- */function get(){return this._configs.dollyProximityThreshold;}/**
22862
- * Sets the minimum dolly speed.
22863
- *
22864
- * Default is ````0.04````.
22865
- *
22866
- * @param {Number} dollyMinSpeed New dolly minimum speed.
22867
- */,set:function set(dollyProximityThreshold){this._configs.dollyProximityThreshold=dollyProximityThreshold!==undefined&&dollyProximityThreshold!==null?dollyProximityThreshold:35.0;}},{key:"dollyMinSpeed",get:/**
22868
- * Gets the minimum dolly speed.
22869
- *
22870
- * Default is ````0.04````.
22871
- *
22872
- * @returns {Number} The current minimum dolly speed.
22873
- */function get(){return this._configs.dollyMinSpeed;}/**
22874
- * Sets the pan inertia factor.
22875
- *
22876
- * This factor configures how much the {@link Camera} keeps moving after you finish panning it.
22877
- *
22878
- * This factor is a value in range ````[0..1]````. A value of ````0.0```` causes panning to immediately stop,
22879
- * ````0.5```` causes panning to decay 50% on each animation frame, while ````1.0```` causes no decay, which allows panning
22880
- * to continue until further input stops it.
22881
- *
22882
- * You might set ````panInertia```` to zero when you want be able to precisely position or rotate the Camera,
22883
- * without interference from inertia. This also means that xeokit renders less frames while panning the Camera,
22884
- * wich can improve rendering performance.
22885
- *
22886
- * Default is ````0.5````.
22887
- *
22888
- * @param {Number} panInertia New pan inertia factor.
22889
- */,set:function set(dollyMinSpeed){this._configs.dollyMinSpeed=dollyMinSpeed!==undefined&&dollyMinSpeed!==null?dollyMinSpeed:0.04;}},{key:"panInertia",get:/**
22890
- * Gets the pan inertia factor.
22891
- *
22892
- * Default is ````0.5````.
22893
- *
22894
- * @returns {Number} The current pan inertia factor.
22895
- */function get(){return this._configs.panInertia;}/**
22896
- * Sets the keyboard layout.
22897
- *
22898
- * Supported layouts are:
22899
- *
22900
- * * ````"qwerty"```` (default)
22901
- * * ````"azerty"````
22902
- *
22903
- * @deprecated
22904
- * @param {String} value Selects the keyboard layout.
22905
- */,set:function set(panInertia){this._configs.panInertia=panInertia!==undefined&&panInertia!==null?panInertia:0.5;}},{key:"keyboardLayout",get:/**
22906
- * Gets the keyboard layout.
22907
- *
22908
- * Supported layouts are:
22909
- *
22910
- * * ````"qwerty"```` (default)
22911
- * * ````"azerty"````
22912
- *
22913
- * @deprecated
22914
- * @returns {String} The current keyboard layout.
22915
- */function get(){return this._configs.keyboardLayout;}/**
22916
- * Sets a sphere as the representation of the pivot position.
22917
- *
22918
- * @param {Object} [cfg] Sphere configuration.
22919
- * @param {String} [cfg.size=1] Optional size factor of the sphere. Defaults to 1.
22920
- * @param {String} [cfg.material=PhongMaterial] Optional size factor of the sphere. Defaults to a red opaque material.
22921
- */,set:function set(value){// this.warn("keyboardLayout property is deprecated - use keyMap property instead");
22489
+ * Sets the HTMl element to represent the pivot point when {@link CameraControl#followPointer} is true.
22490
+ *
22491
+ * See class comments for an example.
22492
+ *
22493
+ * @param {HTMLElement} element HTML element representing the pivot point.
22494
+ */},{key:"pivotElement",set:function set(element){this._controllers.pivotController.setPivotElement(element);}/**
22495
+ * Sets if this ````CameraControl```` is active or not.
22496
+ *
22497
+ * When inactive, the ````CameraControl```` will not react to input.
22498
+ *
22499
+ * Default is ````true````.
22500
+ *
22501
+ * @param {Boolean} value Set ````true```` to activate this ````CameraControl````.
22502
+ */},{key:"active",get:/**
22503
+ * Gets if this ````CameraControl```` is active or not.
22504
+ *
22505
+ * When inactive, the ````CameraControl```` will not react to input.
22506
+ *
22507
+ * Default is ````true````.
22508
+ *
22509
+ * @returns {Boolean} Returns ````true```` if this ````CameraControl```` is active.
22510
+ */function get(){return this._configs.active;}/**
22511
+ * Sets whether the pointer snap to vertex.
22512
+ *
22513
+ * @param {boolean} snapToVertex
22514
+ */,set:function set(value){value=value!==false;this._configs.active=value;this._handlers[1]._active=value;this._handlers[5]._active=value;}},{key:"snapToVertex",get:/**
22515
+ * Gets whether the pointer snap to vertex.
22516
+ *
22517
+ * @returns {boolean}
22518
+ */function get(){return this._configs.snapToVertex;}/**
22519
+ * Sets whether the pointer snap to edge.
22520
+ *
22521
+ * @param {boolean} snapToEdge
22522
+ */,set:function set(snapToVertex){this._configs.snapToVertex=!!snapToVertex;}},{key:"snapToEdge",get:/**
22523
+ * Gets whether the pointer snap to edge.
22524
+ *
22525
+ * @returns {boolean}
22526
+ */function get(){return this._configs.snapToEdge;}/**
22527
+ * Sets the current snap radius for "hoverSnapOrSurface" events, to specify whether the radius
22528
+ * within which the pointer snaps to the nearest vertex or the nearest edge.
22529
+ *
22530
+ * Default value is 30 pixels.
22531
+ *
22532
+ * @param {Number} snapRadius The snap radius.
22533
+ */,set:function set(snapToEdge){this._configs.snapToEdge=!!snapToEdge;}},{key:"snapRadius",get:/**
22534
+ * Gets the current snap radius.
22535
+ *
22536
+ * @returns {Number} The snap radius.
22537
+ */function get(){return this._configs.snapRadius;}/**
22538
+ * Sets the current navigation mode.
22539
+ *
22540
+ * Accepted values are:
22541
+ *
22542
+ * * "orbit" - rotation orbits about the current target or pivot point,
22543
+ * * "firstPerson" - rotation is about the current eye position,
22544
+ * * "planView" - rotation is disabled.
22545
+ *
22546
+ * See class comments for more info.
22547
+ *
22548
+ * @param {String} navMode The navigation mode: "orbit", "firstPerson" or "planView".
22549
+ */,set:function set(snapRadius){snapRadius=snapRadius||DEFAULT_SNAP_PICK_RADIUS;this._configs.snapRadius=snapRadius;}},{key:"navMode",get:/**
22550
+ * Gets the current navigation mode.
22551
+ *
22552
+ * @returns {String} The navigation mode: "orbit", "firstPerson" or "planView".
22553
+ */function get(){return this._configs.navMode;}/**
22554
+ * Sets whether mouse and touch input is enabled.
22555
+ *
22556
+ * Default is ````true````.
22557
+ *
22558
+ * Disabling mouse and touch input on ````CameraControl```` is useful when we want to temporarily use mouse or
22559
+ * touch input to interact with some other 3D control, without disturbing the {@link Camera}.
22560
+ *
22561
+ * @param {Boolean} value Set ````true```` to enable mouse and touch input.
22562
+ */,set:function set(navMode){navMode=navMode||"orbit";if(navMode!=="firstPerson"&&navMode!=="orbit"&&navMode!=="planView"){this.error("Unsupported value for navMode: "+navMode+" - supported values are 'orbit', 'firstPerson' and 'planView' - defaulting to 'orbit'");navMode="orbit";}this._configs.firstPerson=navMode==="firstPerson";this._configs.planView=navMode==="planView";if(this._configs.firstPerson||this._configs.planView){this._controllers.pivotController.hidePivot();this._controllers.pivotController.endPivot();}this._configs.navMode=navMode;}},{key:"pointerEnabled",get:/**
22563
+ * Gets whether mouse and touch input is enabled.
22564
+ *
22565
+ * Default is ````true````.
22566
+ *
22567
+ * Disabling mouse and touch input on ````CameraControl```` is desirable when we want to temporarily use mouse or
22568
+ * touch input to interact with some other 3D control, without interfering with the {@link Camera}.
22569
+ *
22570
+ * @returns {Boolean} Returns ````true```` if mouse and touch input is enabled.
22571
+ */function get(){return this._configs.pointerEnabled;}/**
22572
+ * Sets whether the {@link Camera} follows the mouse/touch pointer.
22573
+ *
22574
+ * In orbiting mode, the Camera will orbit about the pointer, and will dolly to and from the pointer.
22575
+ *
22576
+ * In fly-to mode, the Camera will dolly to and from the pointer, however the World will always rotate about the Camera position.
22577
+ *
22578
+ * In plan-view mode, the Camera will dolly to and from the pointer, however the Camera will not rotate.
22579
+ *
22580
+ * Default is ````true````.
22581
+ *
22582
+ * See class comments for more info.
22583
+ *
22584
+ * @param {Boolean} value Set ````true```` to enable the Camera to follow the pointer.
22585
+ */,set:function set(value){this._reset();this._configs.pointerEnabled=!!value;}},{key:"_reset",value:function _reset(){for(var _i467=0,len=this._handlers.length;_i467<len;_i467++){var handler=this._handlers[_i467];if(handler.reset){handler.reset();}}this._updates.panDeltaX=0;this._updates.panDeltaY=0;this._updates.rotateDeltaX=0;this._updates.rotateDeltaY=0;this._updates.dolyDelta=0;}},{key:"followPointer",get:/**
22586
+ * Sets whether the {@link Camera} follows the mouse/touch pointer.
22587
+ *
22588
+ * In orbiting mode, the Camera will orbit about the pointer, and will dolly to and from the pointer.
22589
+ *
22590
+ * In fly-to mode, the Camera will dolly to and from the pointer, however the World will always rotate about the Camera position.
22591
+ *
22592
+ * In plan-view mode, the Camera will dolly to and from the pointer, however the Camera will not rotate.
22593
+ *
22594
+ * Default is ````true````.
22595
+ *
22596
+ * See class comments for more info.
22597
+ *
22598
+ * @returns {Boolean} Returns ````true```` if the Camera follows the pointer.
22599
+ */function get(){return this._configs.followPointer;}/**
22600
+ * Sets the current World-space 3D target position.
22601
+ *
22602
+ * Only applies when {@link CameraControl#followPointer} is ````true````.
22603
+ *
22604
+ * @param {Number[]} worldPos The new World-space 3D target position.
22605
+ */,set:function set(value){this._configs.followPointer=value!==false;}},{key:"pivotPos",get:/**
22606
+ * Gets the current World-space 3D pivot position.
22607
+ *
22608
+ * Only applies when {@link CameraControl#followPointer} is ````true````.
22609
+ *
22610
+ * @return {Number[]} worldPos The current World-space 3D pivot position.
22611
+ */function get(){return this._controllers.pivotController.getPivotPos();}/**
22612
+ * @deprecated
22613
+ * @param {Boolean} value Set ````true```` to enable dolly-to-pointer behaviour.
22614
+ */,set:function set(worldPos){this._controllers.pivotController.setPivotPos(worldPos);}},{key:"dollyToPointer",get:/**
22615
+ * @deprecated
22616
+ * @returns {Boolean} Returns ````true```` if dolly-to-pointer behaviour is enabled.
22617
+ */function get(){this.warn("dollyToPointer property is deprecated - replaced with followPointer");return this.followPointer;}/**
22618
+ * @deprecated
22619
+ * @param {Boolean} value Set ````true```` to enable dolly-to-pointer behaviour.
22620
+ */,set:function set(value){this.warn("dollyToPointer property is deprecated - replaced with followPointer");this.followPointer=value;}},{key:"panToPointer",get:/**
22621
+ * @deprecated
22622
+ * @returns {Boolean} Returns ````true```` if dolly-to-pointer behaviour is enabled.
22623
+ */function get(){this.warn("panToPointer property is deprecated - replaced with followPointer");return false;}/**
22624
+ * Sets whether this ````CameraControl```` is in plan-view mode.
22625
+ *
22626
+ * When in plan-view mode, rotation is disabled.
22627
+ *
22628
+ * Default is ````false````.
22629
+ *
22630
+ * Deprecated - use {@link CameraControl#navMode} instead.
22631
+ *
22632
+ * @param {Boolean} value Set ````true```` to enable plan-view mode.
22633
+ * @deprecated
22634
+ */,set:function set(value){this.warn("panToPointer property is deprecated - replaced with followPointer");}},{key:"planView",get:/**
22635
+ * Gets whether this ````CameraControl```` is in plan-view mode.
22636
+ *
22637
+ * When in plan-view mode, rotation is disabled.
22638
+ *
22639
+ * Default is ````false````.
22640
+ *
22641
+ * Deprecated - use {@link CameraControl#navMode} instead.
22642
+ *
22643
+ * @returns {Boolean} Returns ````true```` if plan-view mode is enabled.
22644
+ * @deprecated
22645
+ */function get(){this.warn("planView property is deprecated - replaced with navMode");return this._configs.planView;}/**
22646
+ * Sets whether this ````CameraControl```` is in first-person mode.
22647
+ *
22648
+ * In "first person" mode (disabled by default) the look position rotates about the eye position. Otherwise, {@link Camera#eye} rotates about {@link Camera#look}.
22649
+ *
22650
+ * Default is ````false````.
22651
+ *
22652
+ * Deprecated - use {@link CameraControl#navMode} instead.
22653
+ *
22654
+ * @param {Boolean} value Set ````true```` to enable first-person mode.
22655
+ * @deprecated
22656
+ */,set:function set(value){this._configs.planView=!!value;this._configs.firstPerson=false;if(this._configs.planView){this._controllers.pivotController.hidePivot();this._controllers.pivotController.endPivot();}this.warn("planView property is deprecated - replaced with navMode");}},{key:"firstPerson",get:/**
22657
+ * Gets whether this ````CameraControl```` is in first-person mode.
22658
+ *
22659
+ * In "first person" mode (disabled by default) the look position rotates about the eye position. Otherwise, {@link Camera#eye} rotates about {@link Camera#look}.
22660
+ *
22661
+ * Default is ````false````.
22662
+ *
22663
+ * Deprecated - use {@link CameraControl#navMode} instead.
22664
+ *
22665
+ * @returns {Boolean} Returns ````true```` if first-person mode is enabled.
22666
+ * @deprecated
22667
+ */function get(){this.warn("firstPerson property is deprecated - replaced with navMode");return this._configs.firstPerson;}/**
22668
+ * Sets whether to vertically constrain the {@link Camera} position for first-person navigation.
22669
+ *
22670
+ * When set ````true````, this constrains {@link Camera#eye} to its current vertical position.
22671
+ *
22672
+ * Only applies when {@link CameraControl#navMode} is ````"firstPerson"````.
22673
+ *
22674
+ * Default is ````false````.
22675
+ *
22676
+ * @param {Boolean} value Set ````true```` to vertically constrain the Camera.
22677
+ */,set:function set(value){this.warn("firstPerson property is deprecated - replaced with navMode");this._configs.firstPerson=!!value;this._configs.planView=false;if(this._configs.firstPerson){this._controllers.pivotController.hidePivot();this._controllers.pivotController.endPivot();}}},{key:"constrainVertical",get:/**
22678
+ * Gets whether to vertically constrain the {@link Camera} position for first-person navigation.
22679
+ *
22680
+ * When set ````true````, this constrains {@link Camera#eye} to its current vertical position.
22681
+ *
22682
+ * Only applies when {@link CameraControl#navMode} is ````"firstPerson"````.
22683
+ *
22684
+ * Default is ````false````.
22685
+ *
22686
+ * @returns {Boolean} ````true```` when Camera is vertically constrained.
22687
+ */function get(){return this._configs.constrainVertical;}/**
22688
+ * Sets whether double-picking an {@link Entity} causes the {@link Camera} to fly to its boundary.
22689
+ *
22690
+ * Default is ````false````.
22691
+ *
22692
+ * @param {Boolean} value Set ````true```` to enable double-pick-fly-to mode.
22693
+ */,set:function set(value){this._configs.constrainVertical=!!value;}},{key:"doublePickFlyTo",get:/**
22694
+ * Gets whether double-picking an {@link Entity} causes the {@link Camera} to fly to its boundary.
22695
+ *
22696
+ * Default is ````false````.
22697
+ *
22698
+ * @returns {Boolean} Returns ````true```` when double-pick-fly-to mode is enabled.
22699
+ */function get(){return this._configs.doublePickFlyTo;}/**
22700
+ * Sets whether either right-clicking (true) or middle-clicking (false) pans the {@link Camera}.
22701
+ *
22702
+ * Default is ````true````.
22703
+ *
22704
+ * @param {Boolean} value Set ````false```` to disable pan on right-click.
22705
+ */,set:function set(value){this._configs.doublePickFlyTo=value!==false;}},{key:"panRightClick",get:/**
22706
+ * Gets whether right-clicking pans the {@link Camera}.
22707
+ *
22708
+ * Default is ````true````.
22709
+ *
22710
+ * @returns {Boolean} Returns ````false```` when pan on right-click is disabled.
22711
+ */function get(){return this._configs.panRightClick;}/**
22712
+ * Sets a factor in range ````[0..1]```` indicating how much the {@link Camera} keeps moving after you finish rotating it.
22713
+ *
22714
+ * A value of ````0.0```` causes it to immediately stop, ````0.5```` causes its movement to decay 50% on each tick,
22715
+ * while ````1.0```` causes no decay, allowing it continue moving, by the current rate of rotation.
22716
+ *
22717
+ * You may choose an inertia of zero when you want be able to precisely rotate the Camera,
22718
+ * without interference from inertia. Zero inertia can also mean that less frames are rendered while
22719
+ * you are rotating the Camera.
22720
+ *
22721
+ * Default is ````0.0````.
22722
+ *
22723
+ * Does not apply when {@link CameraControl#navMode} is ````"planView"````, which disallows rotation.
22724
+ *
22725
+ * @param {Number} rotationInertia New inertial factor.
22726
+ */,set:function set(value){this._configs.panRightClick=value!==false;}},{key:"rotationInertia",get:/**
22727
+ * Gets the rotation inertia factor.
22728
+ *
22729
+ * Default is ````0.0````.
22730
+ *
22731
+ * Does not apply when {@link CameraControl#navMode} is ````"planView"````, which disallows rotation.
22732
+ *
22733
+ * @returns {Number} The inertia factor.
22734
+ */function get(){return this._configs.rotationInertia;}/**
22735
+ * Sets how much the {@link Camera} pans each second with keyboard input.
22736
+ *
22737
+ * Default is ````5.0````, to pan the Camera ````5.0```` World-space units every second that
22738
+ * a panning key is depressed. See the ````CameraControl```` class documentation for which keys control
22739
+ * panning.
22740
+ *
22741
+ * Panning direction is aligned to our Camera's orientation. When we pan horizontally, we pan
22742
+ * to our left and right, when we pan vertically, we pan upwards and downwards, and when we pan forwards
22743
+ * and backwards, we pan along the direction the Camera is pointing.
22744
+ *
22745
+ * Unlike dollying when {@link followPointer} is ````true````, panning does not follow the pointer.
22746
+ *
22747
+ * @param {Number} keyboardPanRate The new keyboard pan rate.
22748
+ */,set:function set(rotationInertia){this._configs.rotationInertia=rotationInertia!==undefined&&rotationInertia!==null?rotationInertia:0.0;}},{key:"keyboardPanRate",get:/**
22749
+ * Gets how much the {@link Camera} pans each second with keyboard input.
22750
+ *
22751
+ * Default is ````5.0````.
22752
+ *
22753
+ * @returns {Number} The current keyboard pan rate.
22754
+ */function get(){return this._configs.keyboardPanRate;}/**
22755
+ * Sets how many degrees per second the {@link Camera} rotates/orbits with keyboard input.
22756
+ *
22757
+ * Default is ````90.0````, to rotate/orbit the Camera ````90.0```` degrees every second that
22758
+ * a rotation key is depressed. See the ````CameraControl```` class documentation for which keys control
22759
+ * rotation/orbit.
22760
+ *
22761
+ * @param {Number} keyboardRotationRate The new keyboard rotation rate.
22762
+ */,set:function set(keyboardPanRate){this._configs.keyboardPanRate=keyboardPanRate!==null&&keyboardPanRate!==undefined?keyboardPanRate:5.0;}/**
22763
+ * Sets how fast the camera pans on touch panning
22764
+ *
22765
+ * @param {Number} touchPanRate The new touch pan rate.
22766
+ */},{key:"touchPanRate",get:/**
22767
+ * Gets how fast the {@link Camera} pans on touch panning
22768
+ *
22769
+ * Default is ````1.0````.
22770
+ *
22771
+ * @returns {Number} The current touch pan rate.
22772
+ */function get(){return this._configs.touchPanRate;},set:function set(touchPanRate){this._configs.touchPanRate=touchPanRate!==null&&touchPanRate!==undefined?touchPanRate:1.0;}},{key:"keyboardRotationRate",get:/**
22773
+ * Sets how many degrees per second the {@link Camera} rotates/orbits with keyboard input.
22774
+ *
22775
+ * Default is ````90.0````.
22776
+ *
22777
+ * @returns {Number} The current keyboard rotation rate.
22778
+ */function get(){return this._configs.keyboardRotationRate;}/**
22779
+ * Sets the current drag rotation rate.
22780
+ *
22781
+ * This configures how many degrees the {@link Camera} rotates/orbits for a full sweep of the canvas by mouse or touch dragging.
22782
+ *
22783
+ * For example, a value of ````360.0```` indicates that the ````Camera```` rotates/orbits ````360.0```` degrees horizontally
22784
+ * when we sweep the entire width of the canvas.
22785
+ *
22786
+ * ````CameraControl```` makes vertical rotation half as sensitive as horizontal rotation, so that we don't tend to
22787
+ * flip upside-down. Therefore, a value of ````360.0```` rotates/orbits the ````Camera```` through ````180.0```` degrees
22788
+ * vertically when we sweep the entire height of the canvas.
22789
+ *
22790
+ * Default is ````360.0````.
22791
+ *
22792
+ * @param {Number} dragRotationRate The new drag rotation rate.
22793
+ */,set:function set(keyboardRotationRate){this._configs.keyboardRotationRate=keyboardRotationRate!==null&&keyboardRotationRate!==undefined?keyboardRotationRate:90.0;}},{key:"dragRotationRate",get:/**
22794
+ * Gets the current drag rotation rate.
22795
+ *
22796
+ * Default is ````360.0````.
22797
+ *
22798
+ * @returns {Number} The current drag rotation rate.
22799
+ */function get(){return this._configs.dragRotationRate;}/**
22800
+ * Sets how much the {@link Camera} dollys each second with keyboard input.
22801
+ *
22802
+ * Default is ````15.0````, to dolly the {@link Camera} ````15.0```` World-space units per second while we hold down
22803
+ * the ````+```` and ````-```` keys.
22804
+ *
22805
+ * @param {Number} keyboardDollyRate The new keyboard dolly rate.
22806
+ */,set:function set(dragRotationRate){this._configs.dragRotationRate=dragRotationRate!==null&&dragRotationRate!==undefined?dragRotationRate:360.0;}},{key:"keyboardDollyRate",get:/**
22807
+ * Gets how much the {@link Camera} dollys each second with keyboard input.
22808
+ *
22809
+ * Default is ````15.0````.
22810
+ *
22811
+ * @returns {Number} The current keyboard dolly rate.
22812
+ */function get(){return this._configs.keyboardDollyRate;}/**
22813
+ * Sets how much the {@link Camera} dollys with touch input.
22814
+ *
22815
+ * Default is ````0.2````
22816
+ *
22817
+ * @param {Number} touchDollyRate The new touch dolly rate.
22818
+ */,set:function set(keyboardDollyRate){this._configs.keyboardDollyRate=keyboardDollyRate!==null&&keyboardDollyRate!==undefined?keyboardDollyRate:15.0;}},{key:"touchDollyRate",get:/**
22819
+ * Gets how much the {@link Camera} dollys each second with touch input.
22820
+ *
22821
+ * Default is ````0.2````.
22822
+ *
22823
+ * @returns {Number} The current touch dolly rate.
22824
+ */function get(){return this._configs.touchDollyRate;}/**
22825
+ * Sets how much the {@link Camera} dollys each second while the mouse wheel is spinning.
22826
+ *
22827
+ * Default is ````100.0````, to dolly the {@link Camera} ````10.0```` World-space units per second as we spin
22828
+ * the mouse wheel.
22829
+ *
22830
+ * @param {Number} mouseWheelDollyRate The new mouse wheel dolly rate.
22831
+ */,set:function set(touchDollyRate){this._configs.touchDollyRate=touchDollyRate!==null&&touchDollyRate!==undefined?touchDollyRate:0.2;}},{key:"mouseWheelDollyRate",get:/**
22832
+ * Gets how much the {@link Camera} dollys each second while the mouse wheel is spinning.
22833
+ *
22834
+ * Default is ````100.0````.
22835
+ *
22836
+ * @returns {Number} The current mouseWheel dolly rate.
22837
+ */function get(){return this._configs.mouseWheelDollyRate;}/**
22838
+ * Sets the dolly inertia factor.
22839
+ *
22840
+ * This factor configures how much the {@link Camera} keeps moving after you finish dollying it.
22841
+ *
22842
+ * This factor is a value in range ````[0..1]````. A value of ````0.0```` causes dollying to immediately stop,
22843
+ * ````0.5```` causes dollying to decay 50% on each animation frame, while ````1.0```` causes no decay, which allows dollying
22844
+ * to continue until further input stops it.
22845
+ *
22846
+ * You might set ````dollyInertia```` to zero when you want be able to precisely position or rotate the Camera,
22847
+ * without interference from inertia. This also means that xeokit renders less frames while dollying the Camera,
22848
+ * which can improve rendering performance.
22849
+ *
22850
+ * Default is ````0````.
22851
+ *
22852
+ * @param {Number} dollyInertia New dolly inertia factor.
22853
+ */,set:function set(mouseWheelDollyRate){this._configs.mouseWheelDollyRate=mouseWheelDollyRate!==null&&mouseWheelDollyRate!==undefined?mouseWheelDollyRate:100.0;}},{key:"dollyInertia",get:/**
22854
+ * Gets the dolly inertia factor.
22855
+ *
22856
+ * Default is ````0````.
22857
+ *
22858
+ * @returns {Number} The current dolly inertia factor.
22859
+ */function get(){return this._configs.dollyInertia;}/**
22860
+ * Sets the proximity to the closest object below which dolly speed decreases, and above which dolly speed increases.
22861
+ *
22862
+ * Default is ````35.0````.
22863
+ *
22864
+ * @param {Number} dollyProximityThreshold New dolly proximity threshold.
22865
+ */,set:function set(dollyInertia){this._configs.dollyInertia=dollyInertia!==undefined&&dollyInertia!==null?dollyInertia:0;}},{key:"dollyProximityThreshold",get:/**
22866
+ * Gets the proximity to the closest object below which dolly speed decreases, and above which dolly speed increases.
22867
+ *
22868
+ * Default is ````35.0````.
22869
+ *
22870
+ * @returns {Number} The current dolly proximity threshold.
22871
+ */function get(){return this._configs.dollyProximityThreshold;}/**
22872
+ * Sets the minimum dolly speed.
22873
+ *
22874
+ * Default is ````0.04````.
22875
+ *
22876
+ * @param {Number} dollyMinSpeed New dolly minimum speed.
22877
+ */,set:function set(dollyProximityThreshold){this._configs.dollyProximityThreshold=dollyProximityThreshold!==undefined&&dollyProximityThreshold!==null?dollyProximityThreshold:35.0;}},{key:"dollyMinSpeed",get:/**
22878
+ * Gets the minimum dolly speed.
22879
+ *
22880
+ * Default is ````0.04````.
22881
+ *
22882
+ * @returns {Number} The current minimum dolly speed.
22883
+ */function get(){return this._configs.dollyMinSpeed;}/**
22884
+ * Sets the pan inertia factor.
22885
+ *
22886
+ * This factor configures how much the {@link Camera} keeps moving after you finish panning it.
22887
+ *
22888
+ * This factor is a value in range ````[0..1]````. A value of ````0.0```` causes panning to immediately stop,
22889
+ * ````0.5```` causes panning to decay 50% on each animation frame, while ````1.0```` causes no decay, which allows panning
22890
+ * to continue until further input stops it.
22891
+ *
22892
+ * You might set ````panInertia```` to zero when you want be able to precisely position or rotate the Camera,
22893
+ * without interference from inertia. This also means that xeokit renders less frames while panning the Camera,
22894
+ * wich can improve rendering performance.
22895
+ *
22896
+ * Default is ````0.5````.
22897
+ *
22898
+ * @param {Number} panInertia New pan inertia factor.
22899
+ */,set:function set(dollyMinSpeed){this._configs.dollyMinSpeed=dollyMinSpeed!==undefined&&dollyMinSpeed!==null?dollyMinSpeed:0.04;}},{key:"panInertia",get:/**
22900
+ * Gets the pan inertia factor.
22901
+ *
22902
+ * Default is ````0.5````.
22903
+ *
22904
+ * @returns {Number} The current pan inertia factor.
22905
+ */function get(){return this._configs.panInertia;}/**
22906
+ * Sets the keyboard layout.
22907
+ *
22908
+ * Supported layouts are:
22909
+ *
22910
+ * * ````"qwerty"```` (default)
22911
+ * * ````"azerty"````
22912
+ *
22913
+ * @deprecated
22914
+ * @param {String} value Selects the keyboard layout.
22915
+ */,set:function set(panInertia){this._configs.panInertia=panInertia!==undefined&&panInertia!==null?panInertia:0.5;}},{key:"keyboardLayout",get:/**
22916
+ * Gets the keyboard layout.
22917
+ *
22918
+ * Supported layouts are:
22919
+ *
22920
+ * * ````"qwerty"```` (default)
22921
+ * * ````"azerty"````
22922
+ *
22923
+ * @deprecated
22924
+ * @returns {String} The current keyboard layout.
22925
+ */function get(){return this._configs.keyboardLayout;}/**
22926
+ * Sets a sphere as the representation of the pivot position.
22927
+ *
22928
+ * @param {Object} [cfg] Sphere configuration.
22929
+ * @param {String} [cfg.size=1] Optional size factor of the sphere. Defaults to 1.
22930
+ * @param {String} [cfg.material=PhongMaterial] Optional size factor of the sphere. Defaults to a red opaque material.
22931
+ */,set:function set(value){// this.warn("keyboardLayout property is deprecated - use keyMap property instead");
22922
22932
  value=value||"qwerty";if(value!=="qwerty"&&value!=="azerty"){this.error("Unsupported value for keyboardLayout - defaulting to 'qwerty'");value="qwerty";}this._configs.keyboardLayout=value;this.keyMap=this._configs.keyboardLayout;}},{key:"enablePivotSphere",value:function enablePivotSphere(){var cfg=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};this._controllers.pivotController.enablePivotSphere(cfg);}/**
22923
- * Remove the sphere as the representation of the pivot position.
22924
- *
22925
- */},{key:"disablePivotSphere",value:function disablePivotSphere(){this._controllers.pivotController.disablePivotSphere();}/**
22926
- * Sets whether smart default pivoting is enabled.
22927
- *
22928
- * When ````true````, we'll pivot by default about the 3D position of the mouse/touch pointer on an
22929
- * imaginary sphere that's centered at {@link Camera#eye} and sized to the {@link Scene} boundary.
22930
- *
22931
- * When ````false````, we'll pivot by default about {@link Camera#look}.
22932
- *
22933
- * Default is ````false````.
22934
- *
22935
- * @param {Boolean} enabled Set ````true```` to pivot by default about the selected point on the virtual sphere, or ````false```` to pivot by default about {@link Camera#look}.
22936
- */},{key:"smartPivot",get:/**
22937
- * Gets whether smart default pivoting is enabled.
22938
- *
22939
- * When ````true````, we'll pivot by default about the 3D position of the mouse/touch pointer on an
22940
- * imaginary sphere that's centered at {@link Camera#eye} and sized to the {@link Scene} boundary.
22941
- *
22942
- * When ````false````, we'll pivot by default about {@link Camera#look}.
22943
- *
22944
- * Default is ````false````.
22945
- *
22946
- * @returns {Boolean} Returns ````true```` when pivoting by default about the selected point on the virtual sphere, or ````false```` when pivoting by default about {@link Camera#look}.
22947
- */function get(){return this._configs.smartPivot;}/**
22948
- * Sets the double click time frame length in milliseconds.
22949
- *
22950
- * If two mouse click events occur within this time frame, it is considered a double click.
22951
- *
22952
- * Default is ````250````
22953
- *
22954
- * @param {Number} value New double click time frame.
22955
- */,set:function set(enabled){this._configs.smartPivot=enabled!==false;}},{key:"doubleClickTimeFrame",get:/**
22956
- * Gets the double click time frame length in milliseconds.
22957
- *
22958
- * Default is ````250````
22959
- *
22960
- * @param {Number} value Current double click time frame.
22961
- */function get(){return this._configs.doubleClickTimeFrame;}/**
22962
- * Destroys this ````CameraControl````.
22963
- * @private
22964
- */,set:function set(value){this._configs.doubleClickTimeFrame=value!==undefined&&value!==null?value:250;}},{key:"destroy",value:function destroy(){this._destroyHandlers();this._destroyControllers();this._cameraUpdater.destroy();_get(_getPrototypeOf(CameraControl.prototype),"destroy",this).call(this);}},{key:"_destroyHandlers",value:function _destroyHandlers(){for(var _i468=0,len=this._handlers.length;_i468<len;_i468++){var handler=this._handlers[_i468];if(handler.destroy){handler.destroy();}}}},{key:"_destroyControllers",value:function _destroyControllers(){for(var _i469=0,len=this._controllers.length;_i469<len;_i469++){var controller=this._controllers[_i469];if(controller.destroy){controller.destroy();}}}}]);return CameraControl;}(Component);/**
22933
+ * Remove the sphere as the representation of the pivot position.
22934
+ *
22935
+ */},{key:"disablePivotSphere",value:function disablePivotSphere(){this._controllers.pivotController.disablePivotSphere();}/**
22936
+ * Sets whether smart default pivoting is enabled.
22937
+ *
22938
+ * When ````true````, we'll pivot by default about the 3D position of the mouse/touch pointer on an
22939
+ * imaginary sphere that's centered at {@link Camera#eye} and sized to the {@link Scene} boundary.
22940
+ *
22941
+ * When ````false````, we'll pivot by default about {@link Camera#look}.
22942
+ *
22943
+ * Default is ````false````.
22944
+ *
22945
+ * @param {Boolean} enabled Set ````true```` to pivot by default about the selected point on the virtual sphere, or ````false```` to pivot by default about {@link Camera#look}.
22946
+ */},{key:"smartPivot",get:/**
22947
+ * Gets whether smart default pivoting is enabled.
22948
+ *
22949
+ * When ````true````, we'll pivot by default about the 3D position of the mouse/touch pointer on an
22950
+ * imaginary sphere that's centered at {@link Camera#eye} and sized to the {@link Scene} boundary.
22951
+ *
22952
+ * When ````false````, we'll pivot by default about {@link Camera#look}.
22953
+ *
22954
+ * Default is ````false````.
22955
+ *
22956
+ * @returns {Boolean} Returns ````true```` when pivoting by default about the selected point on the virtual sphere, or ````false```` when pivoting by default about {@link Camera#look}.
22957
+ */function get(){return this._configs.smartPivot;}/**
22958
+ * Sets the double click time frame length in milliseconds.
22959
+ *
22960
+ * If two mouse click events occur within this time frame, it is considered a double click.
22961
+ *
22962
+ * Default is ````250````
22963
+ *
22964
+ * @param {Number} value New double click time frame.
22965
+ */,set:function set(enabled){this._configs.smartPivot=enabled!==false;}},{key:"doubleClickTimeFrame",get:/**
22966
+ * Gets the double click time frame length in milliseconds.
22967
+ *
22968
+ * Default is ````250````
22969
+ *
22970
+ * @param {Number} value Current double click time frame.
22971
+ */function get(){return this._configs.doubleClickTimeFrame;}/**
22972
+ * Destroys this ````CameraControl````.
22973
+ * @private
22974
+ */,set:function set(value){this._configs.doubleClickTimeFrame=value!==undefined&&value!==null?value:250;}},{key:"destroy",value:function destroy(){this._destroyHandlers();this._destroyControllers();this._cameraUpdater.destroy();_get(_getPrototypeOf(CameraControl.prototype),"destroy",this).call(this);}},{key:"_destroyHandlers",value:function _destroyHandlers(){for(var _i468=0,len=this._handlers.length;_i468<len;_i468++){var handler=this._handlers[_i468];if(handler.destroy){handler.destroy();}}}},{key:"_destroyControllers",value:function _destroyControllers(){for(var _i469=0,len=this._controllers.length;_i469<len;_i469++){var controller=this._controllers[_i469];if(controller.destroy){controller.destroy();}}}}]);return CameraControl;}(Component);/**
22965
22975
  * @desc A property within a {@link PropertySet}.
22966
22976
  *
22967
22977
  * @class Property