12 |
- var BABYLON;!(function(t){!(function(e){var i=(function(i){function r(r,n,s,o,h,a){void 0===n&&(n=0),void 0===s&&(s=0),void 0===h&&(h=!1),void 0===a&&(a=t.Texture.NEAREST_SAMPLINGMODE);var _=i.call(this,r,{width:n,height:s},o,h,a,t.Engine.TEXTUREFORMAT_RGBA)||this;return _._isDirty=!1,_._rootContainer=new e.Container("root"),_._linkedControls=new Array,_._isFullscreen=!1,_._fullscreenViewport=new t.Viewport(0,0,1,1),_._idealWidth=0,_._idealHeight=0,_._renderObserver=_.getScene().onBeforeCameraRenderObservable.add((function(t){return _._checkUpdate(t)})),_._rootContainer._link(null,_),_.hasAlpha=!0,n&&s||(_._resizeObserver=_.getScene().getEngine().onResizeObservable.add((function(){return _._onResize()})),_._onResize()),_._texture.isReady=!0,_}return __extends(r,i),Object.defineProperty(r.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this.markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"idealWidth",{get:function(){return this._idealWidth},set:function(t){this._idealWidth!==t&&(this._idealWidth=t,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"idealHeight",{get:function(){return this._idealHeight},set:function(t){this._idealHeight!==t&&(this._idealHeight=t,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"layer",{get:function(){return this._layerToDispose},enumerable:!0,configurable:!0}),r.prototype.markAsDirty=function(){this._isDirty=!0},r.prototype.addControl=function(t){return this._rootContainer.addControl(t),this},r.prototype.removeControl=function(t){return this._rootContainer.removeControl(t),this},r.prototype.dispose=function(){this.getScene().onBeforeCameraRenderObservable.remove(this._renderObserver),this._resizeObserver&&this.getScene().getEngine().onResizeObservable.remove(this._resizeObserver),this._pointerMoveObserver&&this.getScene().onPrePointerObservable.remove(this._pointerMoveObserver),this._pointerObserver&&this.getScene().onPointerObservable.remove(this._pointerObserver),this._canvasBlurObserver&&this.getScene().getEngine().onCanvasBlurObservable.remove(this._canvasBlurObserver),this._layerToDispose&&(this._layerToDispose.texture=null,this._layerToDispose.dispose(),this._layerToDispose=null),i.prototype.dispose.call(this)},r.prototype._onResize=function(){var t=this.getScene().getEngine(),e=this.getSize(),i=t.getRenderWidth(),r=t.getRenderHeight();e.width===i&&e.height===r||(this.scaleTo(i,r),this.markAsDirty(),(this._idealWidth||this._idealHeight)&&this._rootContainer._markAllAsDirty())},r.prototype._checkUpdate=function(e){if(!this._layerToDispose||0!=(e.layerMask&this._layerToDispose.layerMask)){if(this._isFullscreen&&this._linkedControls.length)for(var i=this.getScene(),r=i.getEngine(),n=this._fullscreenViewport.toGlobal(r.getRenderWidth(),r.getRenderHeight()),s=0,o=this._linkedControls;s<o.length;s++){var h=o[s],a=h._linkedMesh,_=a.getBoundingInfo().boundingSphere.center,u=t.Vector3.Project(_,a.getWorldMatrix(),i.getTransformMatrix(),n);h._moveToProjectedPosition(u)}(this._isDirty||this._rootContainer.isDirty)&&(this._isDirty=!1,this._render(),this.update())}},r.prototype._render=function(){var t=this.getSize(),i=t.width,r=t.height,n=this.getContext();n.clearRect(0,0,i,r),this._background&&(n.save(),n.fillStyle=this._background,n.fillRect(0,0,i,r),n.restore()),n.font="18px Arial";var s=new e.Measure(0,0,i,r);this._rootContainer._draw(s,n)},r.prototype._doPicking=function(e,i,r){if(this._capturingControl)return void this._capturingControl._processObservables(r,e,i);this._rootContainer._processPicking(e,i,r)||r===t.PointerEventTypes.POINTERMOVE&&(this._lastControlOver&&this._lastControlOver.onPointerOutObservable.hasObservers()&&this._lastControlOver.onPointerOutObservable.notifyObservers(this._lastControlOver),this._lastControlOver=null)},r.prototype.attach=function(){var e=this,i=this.getScene();this._pointerMoveObserver=i.onPrePointerObservable.add((function(r,n){r.type!==t.PointerEventTypes.POINTERMOVE&&r.type!==t.PointerEventTypes.POINTERUP&&r.type!==t.PointerEventTypes.POINTERDOWN||(e._shouldBlockPointer=!1,e._doPicking(i.pointerX,i.pointerY,r.type),r.skipOnPointerObservable=e._shouldBlockPointer&&r.type!==t.PointerEventTypes.POINTERUP)})),this._canvasBlurObserver=i.getEngine().onCanvasBlurObservable.add((function(){e._lastControlOver&&e._lastControlOver.onPointerOutObservable.hasObservers()&&e._lastControlOver.onPointerOutObservable.notifyObservers(e._lastControlOver),e._lastControlOver=null,e._lastControlDown&&e._lastControlDown.forcePointerUp(),e._lastControlDown=null}))},r.prototype.attachToMesh=function(e){var i=this,r=this.getScene();this._pointerObserver=r.onPointerObservable.add((function(r,n){if((r.type===t.PointerEventTypes.POINTERUP||r.type===t.PointerEventTypes.POINTERDOWN)&&r.pickInfo.hit&&r.pickInfo.pickedMesh===e){var s=r.pickInfo.getTextureCoordinates(),o=i.getSize();i._doPicking(s.x*o.width,(1-s.y)*o.height,r.type)}}))},r.CreateForMesh=function(e,i,n){void 0===i&&(i=1024),void 0===n&&(n=1024);var s=new r(e.name+" AdvancedDynamicTexture",i,n,e.getScene(),!0,t.Texture.TRILINEAR_SAMPLINGMODE),o=new t.StandardMaterial("AdvancedDynamicTextureMaterial",e.getScene());return o.backFaceCulling=!1,o.diffuseColor=t.Color3.Black(),o.specularColor=t.Color3.Black(),o.emissiveTexture=s,o.opacityTexture=s,e.material=o,s.attachToMesh(e),s},r.CreateFullscreenUI=function(e,i,n){void 0===i&&(i=!0),void 0===n&&(n=null);var s=new r(e,0,0,n),o=new t.Layer(e+"_layer",null,n,!i);return o.texture=s,s._layerToDispose=o,s._isFullscreen=!0,s.attach(),s},r})(t.DynamicTexture);e.AdvancedDynamicTexture=i})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var BABYLON;!(function(t){!(function(t){var e=(function(){function t(t,e,i,r){this.left=t,this.top=e,this.width=i,this.height=r}return t.prototype.copyFrom=function(t){this.left=t.left,this.top=t.top,this.width=t.width,this.height=t.height},t.prototype.isEqualsTo=function(t){return this.left===t.left&&(this.top===t.top&&(this.width===t.width&&this.height===t.height))},t.Empty=function(){return new t(0,0,0,0)},t})();t.Measure=e})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var BABYLON;!(function(t){!(function(e){var i=(function(){function e(t,e,i,r,n,s){this.m=new Float32Array(6),this.fromValues(t,e,i,r,n,s)}return e.prototype.fromValues=function(t,e,i,r,n,s){return this.m[0]=t,this.m[1]=e,this.m[2]=i,this.m[3]=r,this.m[4]=n,this.m[5]=s,this},e.prototype.determinant=function(){return this.m[0]*this.m[3]-this.m[1]*this.m[2]},e.prototype.invertToRef=function(e){var i=this.m[0],r=this.m[1],n=this.m[2],s=this.m[3],o=this.m[4],h=this.m[5],a=this.determinant();if(a<t.Epsilon*t.Epsilon)return e.m[0]=0,e.m[1]=0,e.m[2]=0,e.m[3]=0,e.m[4]=0,e.m[5]=0,this;var _=1/a,u=n*h-s*o,c=r*o-i*h;return e.m[0]=s*_,e.m[1]=-r*_,e.m[2]=-n*_,e.m[3]=i*_,e.m[4]=u*_,e.m[5]=c*_,this},e.prototype.multiplyToRef=function(t,e){var i=this.m[0],r=this.m[1],n=this.m[2],s=this.m[3],o=this.m[4],h=this.m[5],a=t.m[0],_=t.m[1],u=t.m[2],c=t.m[3],l=t.m[4],p=t.m[5];return e.m[0]=i*a+r*u,e.m[1]=i*_+r*c,e.m[2]=n*a+s*u,e.m[3]=n*_+s*c,e.m[4]=o*a+h*u+l,e.m[5]=o*_+h*c+p,this},e.prototype.transformCoordinates=function(t,e,i){return i.x=t*this.m[0]+e*this.m[2]+this.m[4],i.y=t*this.m[1]+e*this.m[3]+this.m[5],this},e.Identity=function(){return new e(1,0,0,1,0,0)},e.TranslationToRef=function(t,e,i){i.fromValues(1,0,0,1,t,e)},e.ScalingToRef=function(t,e,i){i.fromValues(t,0,0,e,0,0)},e.RotationToRef=function(t,e){var i=Math.sin(t),r=Math.cos(t);e.fromValues(r,i,-i,r,0,0)},e.ComposeToRef=function(t,i,r,n,s,o,h){e.TranslationToRef(t,i,e._TempPreTranslationMatrix),e.ScalingToRef(n,s,e._TempScalingMatrix),e.RotationToRef(r,e._TempRotationMatrix),e.TranslationToRef(-t,-i,e._TempPostTranslationMatrix),e._TempPreTranslationMatrix.multiplyToRef(e._TempScalingMatrix,e._TempCompose0),e._TempCompose0.multiplyToRef(e._TempRotationMatrix,e._TempCompose1),o?(e._TempCompose1.multiplyToRef(e._TempPostTranslationMatrix,e._TempCompose2),e._TempCompose2.multiplyToRef(o,h)):e._TempCompose1.multiplyToRef(e._TempPostTranslationMatrix,h)},e})();i._TempPreTranslationMatrix=i.Identity(),i._TempPostTranslationMatrix=i.Identity(),i._TempRotationMatrix=i.Identity(),i._TempScalingMatrix=i.Identity(),i._TempCompose0=i.Identity(),i._TempCompose1=i.Identity(),i._TempCompose2=i.Identity(),e.Matrix2D=i})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var BABYLON;!(function(t){!(function(t){var e=(function(){function t(e,i,r){void 0===i&&(i=t.UNITMODE_PIXEL),void 0===r&&(r=!0),this.unit=i,this.negativeValueAllowed=r,this._value=1,this.ignoreAdaptiveScaling=!1,this._value=e}return Object.defineProperty(t.prototype,"isPercentage",{get:function(){return this.unit===t.UNITMODE_PERCENTAGE},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isPixel",{get:function(){return this.unit===t.UNITMODE_PIXEL},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"internalValue",{get:function(){return this._value},enumerable:!0,configurable:!0}),t.prototype.getValue=function(e){if(e&&!this.ignoreAdaptiveScaling&&this.unit!==t.UNITMODE_PERCENTAGE){if(e.idealWidth)return this._value*e.getSize().width/e.idealWidth;if(e.idealHeight)return this._value*e.getSize().height/e.idealHeight}return this._value},t.prototype.toString=function(e){switch(this.unit){case t.UNITMODE_PERCENTAGE:return this.getValue(e)+"%";case t.UNITMODE_PIXEL:return this.getValue(e)+"px"}return this.unit.toString()},t.prototype.fromString=function(e){var i=t._Regex.exec(e.toString());if(!i||0===i.length)return!1;var r=parseFloat(i[1]),n=this.unit;if(this.negativeValueAllowed||r<0&&(r=0),4===i.length)switch(i[3]){case"px":n=t.UNITMODE_PIXEL;break;case"%":n=t.UNITMODE_PERCENTAGE,r/=100}return(r!==this._value||n!==this.unit)&&(this._value=r,this.unit=n,!0)},Object.defineProperty(t,"UNITMODE_PERCENTAGE",{get:function(){return t._UNITMODE_PERCENTAGE},enumerable:!0,configurable:!0}),Object.defineProperty(t,"UNITMODE_PIXEL",{get:function(){return t._UNITMODE_PIXEL},enumerable:!0,configurable:!0}),t})();e._Regex=/(^-?\d*(\.\d+)?)(%|px)?/,e._UNITMODE_PERCENTAGE=0,e._UNITMODE_PIXEL=1,t.ValueAndUnit=e})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var BABYLON;!(function(t){!(function(e){var i=(function(){function i(r){this.name=r,this._alpha=1,this._zIndex=0,this._currentMeasure=e.Measure.Empty(),this._fontFamily="Arial",this._fontSize=new e.ValueAndUnit(18,e.ValueAndUnit.UNITMODE_PIXEL,!1),this._width=new e.ValueAndUnit(1,e.ValueAndUnit.UNITMODE_PERCENTAGE,!1),this._height=new e.ValueAndUnit(1,e.ValueAndUnit.UNITMODE_PERCENTAGE,!1),this._color="white",this._horizontalAlignment=i.HORIZONTAL_ALIGNMENT_CENTER,this._verticalAlignment=i.VERTICAL_ALIGNMENT_CENTER,this._isDirty=!0,this._cachedParentMeasure=e.Measure.Empty(),this._paddingLeft=new e.ValueAndUnit(0),this._paddingRight=new e.ValueAndUnit(0),this._paddingTop=new e.ValueAndUnit(0),this._paddingBottom=new e.ValueAndUnit(0),this._left=new e.ValueAndUnit(0),this._top=new e.ValueAndUnit(0),this._scaleX=1,this._scaleY=1,this._rotation=0,this._transformCenterX=.5,this._transformCenterY=.5,this._transformMatrix=e.Matrix2D.Identity(),this._invertTransformMatrix=e.Matrix2D.Identity(),this._transformedPosition=t.Vector2.Zero(),this._isMatrixDirty=!0,this._isVisible=!0,this._fontSet=!1,this._dummyVector2=t.Vector2.Zero(),this.isHitTestVisible=!0,this.isPointerBlocker=!1,this._linkOffsetX=new e.ValueAndUnit(0),this._linkOffsetY=new e.ValueAndUnit(0),this.onPointerMoveObservable=new t.Observable,this.onPointerOutObservable=new t.Observable,this.onPointerDownObservable=new t.Observable,this.onPointerUpObservable=new t.Observable,this.onPointerEnterObservable=new t.Observable,this.onDirtyObservable=new t.Observable}return Object.defineProperty(i.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this._alpha!==t&&(this._alpha=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"scaleX",{get:function(){return this._scaleX},set:function(t){this._scaleX!==t&&(this._scaleX=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"scaleY",{get:function(){return this._scaleY},set:function(t){this._scaleY!==t&&(this._scaleY=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation!==t&&(this._rotation=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"transformCenterY",{get:function(){return this._transformCenterY},set:function(t){this._transformCenterY!==t&&(this._transformCenterY=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"transformCenterX",{get:function(){return this._transformCenterX},set:function(t){this._transformCenterX!==t&&(this._transformCenterX=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"horizontalAlignment",{get:function(){return this._horizontalAlignment},set:function(t){this._horizontalAlignment!==t&&(this._horizontalAlignment=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"verticalAlignment",{get:function(){return this._verticalAlignment},set:function(t){this._verticalAlignment!==t&&(this._verticalAlignment=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"width",{get:function(){return this._width.toString(this._host)},set:function(t){this._width.toString(this._host)!==t&&this._width.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"height",{get:function(){return this._height.toString(this._host)},set:function(t){this._height.toString(this._host)!==t&&this._height.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(t){this._fontFamily!==t&&(this._fontFamily=t,this._fontSet=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"fontSize",{get:function(){return this._fontSize.toString(this._host)},set:function(t){this._fontSize.toString(this._host)!==t&&this._fontSize.fromString(t)&&(this._markAsDirty(),this._fontSet=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"color",{get:function(){return this._color},set:function(t){this._color!==t&&(this._color=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"zIndex",{get:function(){return this._zIndex},set:function(t){this.zIndex!==t&&(this._zIndex=t,this._root&&this._root._reOrderControl(this))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isVisible",{get:function(){return this._isVisible},set:function(t){this._isVisible!==t&&(this._isVisible=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isDirty",{get:function(){return this._isDirty},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"paddingLeft",{get:function(){return this._paddingLeft.toString(this._host)},set:function(t){this._paddingLeft.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"paddingRight",{get:function(){return this._paddingRight.toString(this._host)},set:function(t){this._paddingRight.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"paddingTop",{get:function(){return this._paddingTop.toString(this._host)},set:function(t){this._paddingTop.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"paddingBottom",{get:function(){return this._paddingBottom.toString(this._host)},set:function(t){this._paddingBottom.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"left",{get:function(){return this._left.toString(this._host)},set:function(t){this._left.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"top",{get:function(){return this._top.toString(this._host)},set:function(t){this._top.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"linkOffsetX",{get:function(){return this._linkOffsetX.toString(this._host)},set:function(t){this._linkOffsetX.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"linkOffsetY",{get:function(){return this._linkOffsetY.toString(this._host)},set:function(t){this._linkOffsetY.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"centerX",{get:function(){return this._currentMeasure.left+this._currentMeasure.width/2},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"centerY",{get:function(){return this._currentMeasure.top+this._currentMeasure.height/2},enumerable:!0,configurable:!0}),i.prototype.linkWithMesh=function(e){if(!this._host||this._root!==this._host._rootContainer)return void t.Tools.Error("Cannot link a control to a mesh if the control is not at root level");-1===this._host._linkedControls.indexOf(this)&&(this.horizontalAlignment=t.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT,this.verticalAlignment=t.GUI.Control.VERTICAL_ALIGNMENT_TOP,this._linkedMesh=e,this._host._linkedControls.push(this))},i.prototype._moveToProjectedPosition=function(t){this.left=t.x+this._linkOffsetX.getValue(this._host)-this._currentMeasure.width/2+"px",this.top=t.y+this._linkOffsetY.getValue(this._host)-this._currentMeasure.height/2+"px",this._left.ignoreAdaptiveScaling=!0,this._top.ignoreAdaptiveScaling=!0},i.prototype._markMatrixAsDirty=function(){this._isMatrixDirty=!0,this._markAsDirty()},i.prototype._markAsDirty=function(){this._isDirty=!0,this._host&&this._host.markAsDirty()},i.prototype._markAllAsDirty=function(){this._markAsDirty(),this._font&&this._prepareFont()},i.prototype._link=function(t,e){this._root=t,this._host=e},i.prototype._transform=function(t){if(this._isMatrixDirty||1!==this._scaleX||1!==this._scaleY||0!==this._rotation){var i=this._currentMeasure.width*this._transformCenterX+this._currentMeasure.left,r=this._currentMeasure.height*this._transformCenterY+this._currentMeasure.top;t.translate(i,r),t.rotate(this._rotation),t.scale(this._scaleX,this._scaleY),t.translate(-i,-r),(this._isMatrixDirty||this._cachedOffsetX!==i||this._cachedOffsetY!==r)&&(this._cachedOffsetX=i,this._cachedOffsetY=r,this._isMatrixDirty=!1,e.Matrix2D.ComposeToRef(-i,-r,this._rotation,this._scaleX,this._scaleY,this._root?this._root._transformMatrix:null,this._transformMatrix),this._transformMatrix.invertToRef(this._invertTransformMatrix))}},i.prototype._applyStates=function(t){this._fontSet&&(this._fontSet=!1,this._prepareFont()),this._font&&(t.font=this._font),this._color&&(t.fillStyle=this._color),t.globalAlpha=this._alpha},i.prototype._processMeasures=function(t,e){return!this._isDirty&&this._cachedParentMeasure.isEqualsTo(t)||(this._isDirty=!1,this._currentMeasure.copyFrom(t),this._preMeasure(t,e),this._measure(),this._computeAlignment(t,e),this._currentMeasure.left=0|this._currentMeasure.left,this._currentMeasure.top=0|this._currentMeasure.top,this._currentMeasure.width=0|this._currentMeasure.width,this._currentMeasure.height=0|this._currentMeasure.height,this._additionalProcessing(t,e),this._cachedParentMeasure.copyFrom(t),this.onDirtyObservable.hasObservers()&&this.onDirtyObservable.notifyObservers(this)),!(this._currentMeasure.left>t.left+t.width)&&(!(this._currentMeasure.left+this._currentMeasure.width<t.left)&&(!(this._currentMeasure.top>t.top+t.height)&&(!(this._currentMeasure.top+this._currentMeasure.height<t.top)&&(this._transform(e),this._clip(e),e.clip(),!0))))},i.prototype._clip=function(t){t.beginPath(),t.rect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)},i.prototype._measure=function(){this._width.isPixel?this._currentMeasure.width=this._width.getValue(this._host):this._currentMeasure.width*=this._width.getValue(this._host),this._height.isPixel?this._currentMeasure.height=this._height.getValue(this._host):this._currentMeasure.height*=this._height.getValue(this._host)},i.prototype._computeAlignment=function(t,e){var r=this._currentMeasure.width,n=this._currentMeasure.height,s=t.width,o=t.height,h=0,a=0;switch(this.horizontalAlignment){case i.HORIZONTAL_ALIGNMENT_LEFT:h=0;break;case i.HORIZONTAL_ALIGNMENT_RIGHT:h=s-r;break;case i.HORIZONTAL_ALIGNMENT_CENTER:h=(s-r)/2}switch(this.verticalAlignment){case i.VERTICAL_ALIGNMENT_TOP:a=0;break;case i.VERTICAL_ALIGNMENT_BOTTOM:a=o-n;break;case i.VERTICAL_ALIGNMENT_CENTER:a=(o-n)/2}this._paddingLeft.isPixel?(this._currentMeasure.left+=this._paddingLeft.getValue(this._host),this._currentMeasure.width-=this._paddingLeft.getValue(this._host)):(this._currentMeasure.left+=s*this._paddingLeft.getValue(this._host),this._currentMeasure.width-=s*this._paddingLeft.getValue(this._host)),this._paddingRight.isPixel?this._currentMeasure.width-=this._paddingRight.getValue(this._host):this._currentMeasure.width-=s*this._paddingRight.getValue(this._host),this._paddingTop.isPixel?(this._currentMeasure.top+=this._paddingTop.getValue(this._host),this._currentMeasure.height-=this._paddingTop.getValue(this._host)):(this._currentMeasure.top+=o*this._paddingTop.getValue(this._host),this._currentMeasure.height-=o*this._paddingTop.getValue(this._host)),this._paddingBottom.isPixel?this._currentMeasure.height-=this._paddingBottom.getValue(this._host):this._currentMeasure.height-=o*this._paddingBottom.getValue(this._host),this._left.isPixel?this._currentMeasure.left+=this._left.getValue(this._host):this._currentMeasure.left+=s*this._left.getValue(this._host),this._top.isPixel?this._currentMeasure.top+=this._top.getValue(this._host):this._currentMeasure.top+=o*this._top.getValue(this._host),this._currentMeasure.left+=h,this._currentMeasure.top+=a},i.prototype._preMeasure=function(t,e){},i.prototype._additionalProcessing=function(t,e){},i.prototype._draw=function(t,e){},i.prototype.contains=function(t,e){return this._invertTransformMatrix.transformCoordinates(t,e,this._transformedPosition),t=this._transformedPosition.x,e=this._transformedPosition.y,!(t<this._currentMeasure.left)&&(!(t>this._currentMeasure.left+this._currentMeasure.width)&&(!(e<this._currentMeasure.top)&&(!(e>this._currentMeasure.top+this._currentMeasure.height)&&(this.isPointerBlocker&&(this._host._shouldBlockPointer=!0),!0))))},i.prototype._processPicking=function(t,e,i){return!!this.isHitTestVisible&&(!!this.contains(t,e)&&(this._processObservables(i,t,e),!0))},i.prototype._onPointerMove=function(t){this.onPointerMoveObservable.hasObservers()&&this.onPointerMoveObservable.notifyObservers(t)},i.prototype._onPointerEnter=function(){this.onPointerEnterObservable.hasObservers()&&this.onPointerEnterObservable.notifyObservers(this)},i.prototype._onPointerOut=function(){this.onPointerOutObservable.hasObservers()&&this.onPointerOutObservable.notifyObservers(this)},i.prototype._onPointerDown=function(t){this.onPointerDownObservable.hasObservers()&&this.onPointerDownObservable.notifyObservers(t)},i.prototype._onPointerUp=function(t){this.onPointerUpObservable.hasObservers()&&this.onPointerUpObservable.notifyObservers(t)},i.prototype.forcePointerUp=function(){this._onPointerUp(t.Vector2.Zero())},i.prototype._processObservables=function(e,i,r){if(this._dummyVector2.copyFromFloats(i,r),e===t.PointerEventTypes.POINTERMOVE){this._onPointerMove(this._dummyVector2);var n=this._host._lastControlOver;return n&&n!==this&&n._onPointerOut(),n!==this&&this._onPointerEnter(),this._host._lastControlOver=this,!0}return e===t.PointerEventTypes.POINTERDOWN?(this._onPointerDown(this._dummyVector2),this._host._lastControlDown=this,!0):e===t.PointerEventTypes.POINTERUP&&(this._host._lastControlDown&&this._host._lastControlDown._onPointerUp(this._dummyVector2),this._host._lastControlDown=null,!0)},i.prototype._prepareFont=function(){this._fontFamily&&(this._font=this._fontSize.getValue(this._host)+"px "+this._fontFamily,this._fontOffset=i._GetFontOffset(this._font))},Object.defineProperty(i,"HORIZONTAL_ALIGNMENT_LEFT",{get:function(){return i._HORIZONTAL_ALIGNMENT_LEFT},enumerable:!0,configurable:!0}),Object.defineProperty(i,"HORIZONTAL_ALIGNMENT_RIGHT",{get:function(){return i._HORIZONTAL_ALIGNMENT_RIGHT},enumerable:!0,configurable:!0}),Object.defineProperty(i,"HORIZONTAL_ALIGNMENT_CENTER",{get:function(){return i._HORIZONTAL_ALIGNMENT_CENTER},enumerable:!0,configurable:!0}),Object.defineProperty(i,"VERTICAL_ALIGNMENT_TOP",{get:function(){return i._VERTICAL_ALIGNMENT_TOP},enumerable:!0,configurable:!0}),Object.defineProperty(i,"VERTICAL_ALIGNMENT_BOTTOM",{get:function(){return i._VERTICAL_ALIGNMENT_BOTTOM},enumerable:!0,configurable:!0}),Object.defineProperty(i,"VERTICAL_ALIGNMENT_CENTER",{get:function(){return i._VERTICAL_ALIGNMENT_CENTER},enumerable:!0,configurable:!0}),i._GetFontOffset=function(t){if(i._FontHeightSizes[t])return i._FontHeightSizes[t];var e=document.createElement("span");e.innerHTML="Hg",e.style.font=t;var r=document.createElement("div");r.style.display="inline-block",r.style.width="1px",r.style.height="0px",r.style.verticalAlign="bottom";var n=document.createElement("div");n.appendChild(e),n.appendChild(r),document.body.appendChild(n);var s=0,o=0;try{o=r.getBoundingClientRect().top-e.getBoundingClientRect().top,r.style.verticalAlign="baseline",s=r.getBoundingClientRect().top-e.getBoundingClientRect().top}finally{n.remove()}var h={ascent:s,height:o,descent:o-s};return i._FontHeightSizes[t]=h,h},i.AddHeader=function(e,r,n,s){var o=new t.GUI.StackPanel("panel"),h=!s||s.isHorizontal,a=!!s&&s.controlFirst;o.isVertical=!h;var _=new t.GUI.TextBlock("header");return _.text=r,_.textHorizontalAlignment=i.HORIZONTAL_ALIGNMENT_LEFT,h?_.width=n:_.height=n,a?(o.addControl(e),o.addControl(_),_.paddingLeft="5px"):(o.addControl(_),o.addControl(e),_.paddingRight="5px"),o},i})();i._HORIZONTAL_ALIGNMENT_LEFT=0,i._HORIZONTAL_ALIGNMENT_RIGHT=1,i._HORIZONTAL_ALIGNMENT_CENTER=2,i._VERTICAL_ALIGNMENT_TOP=0,i._VERTICAL_ALIGNMENT_BOTTOM=1,i._VERTICAL_ALIGNMENT_CENTER=2,i._FontHeightSizes={},e.Control=i})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var BABYLON;!(function(t){!(function(t){var e=(function(e){function i(i){var r=e.call(this,i)||this;return r.name=i,r._children=new Array,r._measureForChildren=t.Measure.Empty(),r}return __extends(i,e),Object.defineProperty(i.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"children",{get:function(){return this._children},enumerable:!0,configurable:!0}),i.prototype.getChildByName=function(t){for(var e=0,i=this._children;e<i.length;e++){var r=i[e];if(r.name===t)return r}return null},i.prototype.containsControl=function(t){return-1!==this._children.indexOf(t)},i.prototype.addControl=function(t){return-1!==this._children.indexOf(t)?this:(t._link(this,this._host),this._reOrderControl(t),this._markAsDirty(),this)},i.prototype.removeControl=function(t){var e=this._children.indexOf(t);return-1!==e&&this._children.splice(e,1),this._markAsDirty(),this},i.prototype._reOrderControl=function(t){this.removeControl(t);for(var e=0;e<this._children.length;e++)if(this._children[e].zIndex>t.zIndex)return void this._children.splice(e,0,t);this._children.push(t),this._markAsDirty()},i.prototype._markMatrixAsDirty=function(){e.prototype._markMatrixAsDirty.call(this);for(var t=0;t<this._children.length;t++)this._children[t]._markMatrixAsDirty()},i.prototype._markAllAsDirty=function(){e.prototype._markAllAsDirty.call(this);for(var t=0;t<this._children.length;t++)this._children[t]._markAllAsDirty()},i.prototype._localDraw=function(t){this._background&&(t.fillStyle=this._background,t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height))},i.prototype._link=function(t,i){e.prototype._link.call(this,t,i);for(var r=0,n=this._children;r<n.length;r++){n[r]._link(t,i)}},i.prototype._draw=function(t,e){if(e.save(),this._applyStates(e),this._processMeasures(t,e)){this._localDraw(e),this._clipForChildren(e);for(var i=0,r=this._children;i<r.length;i++){var n=r[i];n.isVisible&&n._draw(this._measureForChildren,e)}}e.restore()},i.prototype._processPicking=function(t,i,r){if(!e.prototype.contains.call(this,t,i))return!1;for(var n=this._children.length-1;n>=0;n--){if(this._children[n]._processPicking(t,i,r))return!0}return this._processObservables(r,t,i)},i.prototype._clipForChildren=function(t){},i.prototype._additionalProcessing=function(t,i){e.prototype._additionalProcessing.call(this,t,i),this._measureForChildren.copyFrom(this._currentMeasure)},i})(t.Control);t.Container=e})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var BABYLON;!(function(t){!(function(e){var i=(function(i){function r(t){var r=i.call(this,t)||this;return r.name=t,r._isVertical=!0,r._tempMeasureStore=e.Measure.Empty(),r}return __extends(r,i),Object.defineProperty(r.prototype,"isVertical",{get:function(){return this._isVertical},set:function(t){this._isVertical!==t&&(this._isVertical=t,this._markAsDirty())},enumerable:!0,configurable:!0}),r.prototype._preMeasure=function(e,r){for(var n=0,s=0,o=this._children;s<o.length;s++){var h=o[s];this._tempMeasureStore.copyFrom(h._currentMeasure),h._currentMeasure.copyFrom(e),h._measure(),this._isVertical?(h.top=n+"px",h._top.ignoreAdaptiveScaling||h._markAsDirty(),h._top.ignoreAdaptiveScaling=!0,n+=h._currentMeasure.height,h.verticalAlignment=t.GUI.Control.VERTICAL_ALIGNMENT_TOP):(h.left=n+"px",h._left.ignoreAdaptiveScaling||h._markAsDirty(),h._left.ignoreAdaptiveScaling=!0,n+=h._currentMeasure.width,h.horizontalAlignment=t.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT),h._currentMeasure.copyFrom(this._tempMeasureStore)}var a=!1;if(this._isVertical){var _=this.height;this.height=n+"px",a=_!==this.height||!this._height.ignoreAdaptiveScaling,this._height.ignoreAdaptiveScaling=!0}else{var u=this.width;this.width=n+"px",a=u!==this.width||!this._width.ignoreAdaptiveScaling,this._width.ignoreAdaptiveScaling=!0}a&&this._markAllAsDirty(),i.prototype._preMeasure.call(this,e,r)},r})(e.Container);e.StackPanel=i})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var BABYLON;!(function(t){!(function(t){var e=(function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._thickness=1,i._cornerRadius=0,i}return __extends(e,t),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cornerRadius",{get:function(){return this._cornerRadius},set:function(t){t<0&&(t=0),this._cornerRadius!==t&&(this._cornerRadius=t,this._markAsDirty())},enumerable:!0,configurable:!0}),e.prototype._localDraw=function(t){t.save(),this._background&&(t.fillStyle=this._background,this._cornerRadius?(this._drawRoundedRect(t,this._thickness/2),t.fill()):t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),this._thickness&&(this.color&&(t.strokeStyle=this.color),t.lineWidth=this._thickness,this._cornerRadius?(this._drawRoundedRect(t,this._thickness/2),t.stroke()):t.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,this._currentMeasure.width-this._thickness,this._currentMeasure.height-this._thickness)),t.restore()},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),
- this._measureForChildren.width-=2*this._thickness,this._measureForChildren.height-=2*this._thickness,this._measureForChildren.left+=this._thickness,this._measureForChildren.top+=this._thickness},e.prototype._drawRoundedRect=function(t,e){void 0===e&&(e=0);var i=this._currentMeasure.left+e,r=this._currentMeasure.top+e,n=this._currentMeasure.width-2*e,s=this._currentMeasure.height-2*e,o=Math.min(s/2-2,Math.min(n/2-2,this._cornerRadius));t.beginPath(),t.moveTo(i+o,r),t.lineTo(i+n-o,r),t.quadraticCurveTo(i+n,r,i+n,r+o),t.lineTo(i+n,r+s-o),t.quadraticCurveTo(i+n,r+s,i+n-o,r+s),t.lineTo(i+o,r+s),t.quadraticCurveTo(i,r+s,i,r+s-o),t.lineTo(i,r+o),t.quadraticCurveTo(i,r,i+o,r),t.closePath()},e.prototype._clipForChildren=function(t){this._cornerRadius&&(this._drawRoundedRect(t,this._thickness),t.clip())},e})(t.Container);t.Rectangle=e})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var BABYLON;!(function(t){!(function(t){var e=(function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._thickness=1,i}return __extends(e,t),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!0,configurable:!0}),e.prototype._localDraw=function(t){t.save(),t.beginPath(),t.ellipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,this._currentMeasure.width/2-this._thickness/2,this._currentMeasure.height/2-this._thickness/2,0,0,2*Math.PI),t.closePath(),this._background&&(t.fillStyle=this._background,t.fill()),this._thickness&&(this.color&&(t.strokeStyle=this.color),t.lineWidth=this._thickness,t.stroke()),t.restore()},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),this._measureForChildren.width-=2*this._thickness,this._measureForChildren.height-=2*this._thickness,this._measureForChildren.left+=this._thickness,this._measureForChildren.top+=this._thickness},e.prototype._clipForChildren=function(t){t.beginPath(),t.ellipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,this._currentMeasure.width/2,this._currentMeasure.height/2,0,0,2*Math.PI),t.clip()},e})(t.Container);t.Ellipse=e})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var DOMImage=Image,BABYLON;!(function(t){!(function(t){var e=(function(e){function i(i){var r=e.call(this,i)||this;return r.name=i,r._lineWidth=1,r._x1=new t.ValueAndUnit(0),r._y1=new t.ValueAndUnit(0),r._x2=new t.ValueAndUnit(0),r._y2=new t.ValueAndUnit(0),r._dash=new Array,r.isHitTestVisible=!1,r._horizontalAlignment=t.Control.HORIZONTAL_ALIGNMENT_LEFT,r._verticalAlignment=t.Control.VERTICAL_ALIGNMENT_TOP,r}return __extends(i,e),Object.defineProperty(i.prototype,"dash",{get:function(){return this._dash},set:function(t){this._dash!==t&&(this._dash=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"connectedControl",{get:function(){return this._connectedControl},set:function(t){var e=this;this._connectedControl!==t&&(this._connectedControlDirtyObserver&&this._connectedControl&&(this._connectedControl.onDirtyObservable.remove(this._connectedControlDirtyObserver),this._connectedControlDirtyObserver=null),t&&(this._connectedControlDirtyObserver=t.onDirtyObservable.add((function(){return e._markAsDirty()}))),this._connectedControl=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"x1",{get:function(){return this._x1.toString(this._host)},set:function(t){this._x1.toString(this._host)!==t&&this._x1.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"y1",{get:function(){return this._y1.toString(this._host)},set:function(t){this._y1.toString(this._host)!==t&&this._y1.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"x2",{get:function(){return this._x2.toString(this._host)},set:function(t){this._x2.toString(this._host)!==t&&this._x2.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"y2",{get:function(){return this._y2.toString(this._host)},set:function(t){this._y2.toString(this._host)!==t&&this._y2.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lineWidth",{get:function(){return this._lineWidth},set:function(t){this._lineWidth!==t&&(this._lineWidth=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"horizontalAlignment",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"verticalAlignment",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_effectiveX2",{get:function(){return(this._connectedControl?this._connectedControl.centerX:0)+this._x2.getValue(this._host)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_effectiveY2",{get:function(){return(this._connectedControl?this._connectedControl.centerY:0)+this._y2.getValue(this._host)},enumerable:!0,configurable:!0}),i.prototype._draw=function(t,e){e.save(),this._applyStates(e),this._processMeasures(t,e)&&(e.strokeStyle=this.color,e.lineWidth=this._lineWidth,e.setLineDash(this._dash),e.beginPath(),e.moveTo(this._x1.getValue(this._host),this._y1.getValue(this._host)),e.lineTo(this._effectiveX2,this._effectiveY2),e.stroke()),e.restore()},i.prototype._measure=function(){this._currentMeasure.width=Math.abs(this._x1.getValue(this._host)-this._effectiveX2)+this._lineWidth,this._currentMeasure.height=Math.abs(this._y1.getValue(this._host)-this._effectiveY2)+this._lineWidth},i.prototype._computeAlignment=function(t,e){this._currentMeasure.left=Math.min(this._x1.getValue(this._host),this._effectiveX2)-this._lineWidth/2,this._currentMeasure.top=Math.min(this._y1.getValue(this._host),this._effectiveY2)-this._lineWidth/2},i.prototype._moveToProjectedPosition=function(t){this.x1=t.x+this._linkOffsetX.getValue(this._host)+"px",this.y1=t.y+this._linkOffsetY.getValue(this._host)+"px",this._x1.ignoreAdaptiveScaling=!0,this._y1.ignoreAdaptiveScaling=!0},i})(t.Control);t.Line=e})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var DOMImage=Image,BABYLON;!(function(t){!(function(e){var i=(function(i){function r(r){var n=i.call(this,r)||this;return n.name=r,n._thumbWidth=new e.ValueAndUnit(30,e.ValueAndUnit.UNITMODE_PIXEL,!1),n._minimum=0,n._maximum=100,n._value=50,n._background="black",n._borderColor="white",n._barOffset=new e.ValueAndUnit(5,e.ValueAndUnit.UNITMODE_PIXEL,!1),n.onValueChangedObservable=new t.Observable,n._pointerIsDown=!1,n.isPointerBlocker=!0,n}return __extends(r,i),Object.defineProperty(r.prototype,"borderColor",{get:function(){return this._borderColor},set:function(t){this._borderColor!==t&&(this._borderColor=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"barOffset",{get:function(){return this._barOffset.toString(this._host)},set:function(t){this._barOffset.toString(this._host)!==t&&this._barOffset.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"thumbWidth",{get:function(){return this._thumbWidth.toString(this._host)},set:function(t){this._thumbWidth.toString(this._host)!==t&&this._thumbWidth.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"minimum",{get:function(){return this._minimum},set:function(t){this._minimum!==t&&(this._minimum=t,this._markAsDirty(),this.value=Math.max(Math.min(this.value,this._maximum),this._minimum))},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"maximum",{get:function(){return this._maximum},set:function(t){this._maximum!==t&&(this._maximum=t,this._markAsDirty(),this.value=Math.max(Math.min(this.value,this._maximum),this._minimum))},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"value",{get:function(){return this._value},set:function(t){t=Math.max(Math.min(t,this._maximum),this._minimum),this._value!==t&&(this._value=t,this._markAsDirty(),this.onValueChangedObservable.notifyObservers(this._value))},enumerable:!0,configurable:!0}),r.prototype._draw=function(t,e){if(e.save(),this._applyStates(e),this._processMeasures(t,e)){var i,r;i=this._thumbWidth.isPixel?Math.min(this._thumbWidth.getValue(this._host),this._currentMeasure.height):this._currentMeasure.height*this._thumbWidth.getValue(this._host),r=this._barOffset.isPixel?Math.min(this._barOffset.getValue(this._host),this._currentMeasure.height):this._currentMeasure.height*this._barOffset.getValue(this._host);var n=this._currentMeasure.left+i/2,s=this._currentMeasure.width-i,o=(this._value-this._minimum)/(this._maximum-this._minimum)*s;e.fillStyle=this._background,e.fillRect(n,this._currentMeasure.top+r,s,this._currentMeasure.height-2*r),e.fillStyle=this.color,e.fillRect(n,this._currentMeasure.top+r,o,this._currentMeasure.height-2*r),e.fillRect(n+o-i/2,this._currentMeasure.top,i,this._currentMeasure.height),e.strokeStyle=this._borderColor,e.strokeRect(n+o-i/2,this._currentMeasure.top,i,this._currentMeasure.height)}e.restore()},r.prototype._updateValueFromPointer=function(t){this.value=this._minimum+(t-this._currentMeasure.left)/this._currentMeasure.width*(this._maximum-this._minimum)},r.prototype._onPointerDown=function(t){this._pointerIsDown=!0,this._updateValueFromPointer(t.x),this._host._capturingControl=this,i.prototype._onPointerDown.call(this,t)},r.prototype._onPointerMove=function(t){this._pointerIsDown&&this._updateValueFromPointer(t.x)},r.prototype._onPointerUp=function(t){this._pointerIsDown=!1,this._host._capturingControl=null,i.prototype._onPointerUp.call(this,t)},r})(e.Control);e.Slider=i})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var DOMImage=Image,BABYLON;!(function(t){!(function(e){var i=(function(e){function i(i){var r=e.call(this,i)||this;return r.name=i,r._isChecked=!1,r._background="black",r._checkSizeRatio=.8,r._thickness=1,r.onIsCheckedChangedObservable=new t.Observable,r.isPointerBlocker=!0,r}return __extends(i,e),Object.defineProperty(i.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"checkSizeRatio",{get:function(){return this._checkSizeRatio},set:function(t){t=Math.max(Math.min(1,t),0),this._checkSizeRatio!==t&&(this._checkSizeRatio=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isChecked",{get:function(){return this._isChecked},set:function(t){this._isChecked!==t&&(this._isChecked=t,this._markAsDirty(),this.onIsCheckedChangedObservable.notifyObservers(t))},enumerable:!0,configurable:!0}),i.prototype._draw=function(t,e){if(e.save(),this._applyStates(e),this._processMeasures(t,e)){var i=this._currentMeasure.width-this._thickness,r=this._currentMeasure.height-this._thickness;if(e.fillStyle=this._background,e.fillRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,i,r),this._isChecked){e.fillStyle=this.color;var n=i*this._checkSizeRatio,s=r*this._checkSizeRatio;e.fillRect(this._currentMeasure.left+this._thickness/2+(i-n)/2,this._currentMeasure.top+this._thickness/2+(r-s)/2,n,s)}e.strokeStyle=this.color,e.lineWidth=this._thickness,e.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,i,r)}e.restore()},i.prototype._onPointerDown=function(t){this.isChecked=!this.isChecked,e.prototype._onPointerDown.call(this,t)},i})(e.Control);e.Checkbox=i})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var BABYLON;!(function(t){!(function(t){var e=(function(e){function i(i,r){void 0===r&&(r="");var n=e.call(this,i)||this;return n.name=i,n._text="",n._textWrapping=!1,n._textHorizontalAlignment=t.Control.HORIZONTAL_ALIGNMENT_CENTER,n._textVerticalAlignment=t.Control.VERTICAL_ALIGNMENT_CENTER,n.text=r,n}return __extends(i,e),Object.defineProperty(i.prototype,"textWrapping",{get:function(){return this._textWrapping},set:function(t){this._textWrapping!==t&&(this._textWrapping=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"text",{get:function(){return this._text},set:function(t){this._text!==t&&(this._text=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textHorizontalAlignment",{get:function(){return this._textHorizontalAlignment},set:function(t){this._textHorizontalAlignment!==t&&(this._textHorizontalAlignment=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textVerticalAlignment",{get:function(){return this._textVerticalAlignment},set:function(t){this._textVerticalAlignment!==t&&(this._textVerticalAlignment=t,this._markAsDirty())},enumerable:!0,configurable:!0}),i.prototype._drawText=function(e,i,r,n){var s=this._currentMeasure.width,o=0;switch(this._textHorizontalAlignment){case t.Control.HORIZONTAL_ALIGNMENT_LEFT:o=0;break;case t.Control.HORIZONTAL_ALIGNMENT_RIGHT:o=s-i;break;case t.Control.HORIZONTAL_ALIGNMENT_CENTER:o=(s-i)/2}n.fillText(e,this._currentMeasure.left+o,r)},i.prototype._draw=function(t,e){e.save(),this._applyStates(e),this._processMeasures(t,e)&&this._renderLines(e),e.restore()},i.prototype._additionalProcessing=function(t,e){if(this._lines=[],this._textWrapping){for(var i=this.text.split(" "),r="",n=this._currentMeasure.width,s=0,o=0;o<i.length;o++){var h=o>0?r+" "+i[o]:i[0],a=e.measureText(h),_=a.width;_>n&&o>0?(this._lines.push({text:r,width:s}),r=i[o],s=e.measureText(r).width):(s=_,r=h)}this._lines.push({text:r,width:s})}else this._lines.push({text:this.text,width:e.measureText(this.text).width})},i.prototype._renderLines=function(e){var i=(this._currentMeasure.width,this._currentMeasure.height);this._fontOffset||(this._fontOffset=t.Control._GetFontOffset(e.font));var r=0;switch(this._textVerticalAlignment){case t.Control.VERTICAL_ALIGNMENT_TOP:r=this._fontOffset.ascent;break;case t.Control.VERTICAL_ALIGNMENT_BOTTOM:r=i-this._fontOffset.height*(this._lines.length-1)-this._fontOffset.descent;break;case t.Control.VERTICAL_ALIGNMENT_CENTER:r=this._fontOffset.ascent+(i-this._fontOffset.height*this._lines.length)/2}r+=this._currentMeasure.top;for(var n=0,s=this._lines;n<s.length;n++){var o=s[n];this._drawText(o.text,o.width,r,e),r+=this._fontOffset.height}},i})(t.Control);t.TextBlock=e})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var DOMImage=Image,BABYLON;!(function(t){!(function(t){var e=(function(t){function e(i,r){var n=t.call(this,i)||this;return n.name=i,n._loaded=!1,n._stretch=e.STRETCH_FILL,n._autoScale=!1,n.source=r,n}return __extends(e,t),Object.defineProperty(e.prototype,"autoScale",{get:function(){return this._autoScale},set:function(t){this._autoScale!==t&&(this._autoScale=t,t&&this._loaded&&this.synchronizeSizeWithContent())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"stretch",{get:function(){return this._stretch},set:function(t){this._stretch!==t&&(this._stretch=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"domImage",{get:function(){return this._domImage},set:function(t){var e=this;this._domImage=t,this._loaded=!1,this._domImage.width?this._onImageLoaded():this._domImage.onload=function(){e._onImageLoaded()}},enumerable:!0,configurable:!0}),e.prototype._onImageLoaded=function(){this._imageWidth=this._domImage.width,this._imageHeight=this._domImage.height,this._loaded=!0,this._autoScale&&this.synchronizeSizeWithContent(),this._markAsDirty()},Object.defineProperty(e.prototype,"source",{set:function(t){var e=this;this._source!==t&&(this._loaded=!1,this._source=t,this._domImage=new DOMImage,this._domImage.onload=function(){e._onImageLoaded()},this._domImage.src=t)},enumerable:!0,configurable:!0}),e.prototype.synchronizeSizeWithContent=function(){this._loaded&&(this.width=this._domImage.width+"px",this.height=this._domImage.height+"px")},e.prototype._draw=function(t,i){if(i.save(),this._applyStates(i),this._processMeasures(t,i)&&this._loaded)switch(this._stretch){case e.STRETCH_NONE:i.drawImage(this._domImage,this._currentMeasure.left,this._currentMeasure.top);break;case e.STRETCH_FILL:i.drawImage(this._domImage,0,0,this._imageWidth,this._imageHeight,this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height);break;case e.STRETCH_UNIFORM:var r=this._currentMeasure.width/this._imageWidth,n=this._currentMeasure.height/this._imageHeight,s=Math.min(r,n),o=(this._currentMeasure.width-this._imageWidth*s)/2,h=(this._currentMeasure.height-this._imageHeight*s)/2;i.drawImage(this._domImage,0,0,this._imageWidth,this._imageHeight,this._currentMeasure.left+o,this._currentMeasure.top+h,this._imageWidth*s,this._imageHeight*s);break;case e.STRETCH_EXTEND:i.drawImage(this._domImage,this._currentMeasure.left,this._currentMeasure.top),this._autoScale&&this.synchronizeSizeWithContent(),this._root.width=this.width,this._root.height=this.height}i.restore()},Object.defineProperty(e,"STRETCH_NONE",{get:function(){return e._STRETCH_NONE},enumerable:!0,configurable:!0}),Object.defineProperty(e,"STRETCH_FILL",{get:function(){return e._STRETCH_FILL},enumerable:!0,configurable:!0}),Object.defineProperty(e,"STRETCH_UNIFORM",{get:function(){return e._STRETCH_UNIFORM},enumerable:!0,configurable:!0}),Object.defineProperty(e,"STRETCH_EXTEND",{get:function(){return e._STRETCH_EXTEND},enumerable:!0,configurable:!0}),e})(t.Control);e._STRETCH_NONE=0,e._STRETCH_FILL=1,e._STRETCH_UNIFORM=2,e._STRETCH_EXTEND=3,t.Image=e})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var BABYLON;!(function(t){!(function(e){var i=(function(e){function i(t){var i=e.call(this,t)||this;return i.name=t,i.thickness=1,i.isPointerBlocker=!0,i.pointerEnterAnimation=function(){i.alpha-=.1},i.pointerOutAnimation=function(){i.alpha+=.1},i.pointerDownAnimation=function(){i.scaleX-=.05,i.scaleY-=.05},i.pointerUpAnimation=function(){i.scaleX+=.05,i.scaleY+=.05},i}return __extends(i,e),i.prototype._processPicking=function(t,e,i){return!!this.contains(t,e)&&(this._processObservables(i,t,e),!0)},i.prototype._onPointerEnter=function(){this.pointerEnterAnimation&&this.pointerEnterAnimation(),e.prototype._onPointerEnter.call(this)},i.prototype._onPointerOut=function(){this.pointerOutAnimation&&this.pointerOutAnimation(),e.prototype._onPointerOut.call(this)},i.prototype._onPointerDown=function(t){this.pointerDownAnimation&&this.pointerDownAnimation(),e.prototype._onPointerDown.call(this,t)},i.prototype._onPointerUp=function(t){this.pointerUpAnimation&&this.pointerUpAnimation(),e.prototype._onPointerUp.call(this,t)},i.CreateImageButton=function(e,r,n){var s=new i(e),o=new t.GUI.TextBlock(e+"_button",r);o.textWrapping=!0,o.textHorizontalAlignment=t.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER,o.paddingLeft="20%",s.addControl(o);var h=new t.GUI.Image(e+"_icon",n);return h.width="20%",h.stretch=t.GUI.Image.STRETCH_UNIFORM,h.horizontalAlignment=t.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT,s.addControl(h),s},i.CreateImageOnlyButton=function(e,r){var n=new i(e),s=new t.GUI.Image(e+"_icon",r);return s.stretch=t.GUI.Image.STRETCH_FILL,s.horizontalAlignment=t.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT,n.addControl(s),n},i.CreateSimpleButton=function(e,r){var n=new i(e),s=new t.GUI.TextBlock(e+"_button",r);return s.textWrapping=!0,s.textHorizontalAlignment=t.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER,n.addControl(s),n},i})(e.Rectangle);e.Button=i})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));
|