babylon.gui.min.js 143 KB

12345
  1. !(function(t,e){var i=[],r=t.BABYLON||this.BABYLON;"object"==typeof exports&&"object"==typeof module?(r=r||require("babylonjs"),module.exports=e(r)):"function"==typeof define&&define.amd?(i.push("babylonjs"),define("babylonjs-gui",i,e)):"object"==typeof exports?(r=r||require("babylonjs"),exports["babylonjs-gui"]=e(r)):t.BABYLON.GUI=e(r)})(this,(function(t){t=t||this.BABYLON;var e=this&&this.__decorate||function(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},i=this&&this.__extends||(function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}})();t.Effect.ShadersStore.fluentVertexShader="precision highp float;\n\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n\nuniform mat4 world;\nuniform mat4 viewProjection;\nvarying vec2 vUV;\n#ifdef BORDER\nvarying vec2 scaleInfo;\nuniform float borderWidth;\nuniform vec3 scaleFactor;\n#endif\n#ifdef HOVERLIGHT\nvarying vec3 worldPosition;\n#endif\nvoid main(void) {\nvUV=uv;\n#ifdef BORDER\nvec3 scale=scaleFactor;\nfloat minScale=min(min(scale.x,scale.y),scale.z);\nfloat maxScale=max(max(scale.x,scale.y),scale.z);\nfloat minOverMiddleScale=minScale/(scale.x+scale.y+scale.z-minScale-maxScale);\nfloat areaYZ=scale.y*scale.z;\nfloat areaXZ=scale.x*scale.z;\nfloat areaXY=scale.x*scale.y;\nfloat scaledBorderWidth=borderWidth; \nif (abs(normal.x) == 1.0) \n{\nscale.x=scale.y;\nscale.y=scale.z;\nif (areaYZ>areaXZ && areaYZ>areaXY)\n{\nscaledBorderWidth*=minOverMiddleScale;\n}\n}\nelse if (abs(normal.y) == 1.0) \n{\nscale.x=scale.z;\nif (areaXZ>areaXY && areaXZ>areaYZ)\n{\nscaledBorderWidth*=minOverMiddleScale;\n}\n}\nelse \n{\nif (areaXY>areaYZ && areaXY>areaXZ)\n{\nscaledBorderWidth*=minOverMiddleScale;\n}\n}\nfloat scaleRatio=min(scale.x,scale.y)/max(scale.x,scale.y);\nif (scale.x>scale.y)\n{\nscaleInfo.x=1.0-(scaledBorderWidth*scaleRatio);\nscaleInfo.y=1.0-scaledBorderWidth;\n}\nelse\n{\nscaleInfo.x=1.0-scaledBorderWidth;\nscaleInfo.y=1.0-(scaledBorderWidth*scaleRatio);\n} \n#endif \nvec4 worldPos=world*vec4(position,1.0);\n#ifdef HOVERLIGHT\nworldPosition=worldPos.xyz;\n#endif\ngl_Position=viewProjection*worldPos;\n}\n",t.Effect.ShadersStore.fluentPixelShader="precision highp float;\nvarying vec2 vUV;\nuniform vec4 albedoColor;\n#ifdef INNERGLOW\nuniform vec4 innerGlowColor;\n#endif\n#ifdef BORDER\nvarying vec2 scaleInfo;\nuniform float edgeSmoothingValue;\nuniform float borderMinValue;\n#endif\n#ifdef HOVERLIGHT\nvarying vec3 worldPosition;\nuniform vec3 hoverPosition;\nuniform vec4 hoverColor;\nuniform float hoverRadius;\n#endif\nvoid main(void) {\nvec3 albedo=albedoColor.rgb;\nfloat alpha=albedoColor.a;\n#ifdef HOVERLIGHT\nfloat pointToHover=(1.0-clamp(length(hoverPosition-worldPosition)/hoverRadius,0.,1.))*hoverColor.a;\nalbedo=clamp(albedo+hoverColor.rgb*pointToHover,0.,1.);\n#else\nfloat pointToHover=1.0;\n#endif\n#ifdef BORDER \nfloat borderPower=10.0;\nfloat inverseBorderPower=1.0/borderPower;\nvec3 borderColor=albedo*borderPower;\nvec2 distanceToEdge;\ndistanceToEdge.x=abs(vUV.x-0.5)*2.0;\ndistanceToEdge.y=abs(vUV.y-0.5)*2.0;\nfloat borderValue=max(smoothstep(scaleInfo.x-edgeSmoothingValue,scaleInfo.x+edgeSmoothingValue,distanceToEdge.x),\nsmoothstep(scaleInfo.y-edgeSmoothingValue,scaleInfo.y+edgeSmoothingValue,distanceToEdge.y));\nborderColor=borderColor*borderValue*max(borderMinValue*inverseBorderPower,pointToHover); \nalbedo+=borderColor;\nalpha=max(alpha,borderValue);\n#endif\n#ifdef INNERGLOW\n\nvec2 uvGlow=(vUV-vec2(0.5,0.5))*(innerGlowColor.a*2.0);\nuvGlow=uvGlow*uvGlow;\nuvGlow=uvGlow*uvGlow;\nalbedo+=mix(vec3(0.0,0.0,0.0),innerGlowColor.rgb,uvGlow.x+uvGlow.y); \n#endif\ngl_FragColor=vec4(albedo,alpha);\n}";var t;!(function(t){!(function(e){var i=(function(){function i(i){this._fontFamily="Arial",this._fontStyle="",this._fontWeight="",this._fontSize=new e.ValueAndUnit(18,e.ValueAndUnit.UNITMODE_PIXEL,!1),this.onChangedObservable=new t.Observable,this._host=i}return 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.onChangedObservable.notifyObservers(this)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(t){this._fontFamily!==t&&(this._fontFamily=t,this.onChangedObservable.notifyObservers(this))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(t){this._fontStyle!==t&&(this._fontStyle=t,this.onChangedObservable.notifyObservers(this))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(t){this._fontWeight!==t&&(this._fontWeight=t,this.onChangedObservable.notifyObservers(this))},enumerable:!0,configurable:!0}),i.prototype.dispose=function(){this.onChangedObservable.clear()},i})();e.Style=i})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(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.getValueInPixel=function(t,e){return this.isPixel?this.getValue(t):this.getValue(t)*e},t.prototype.getValue=function(e){if(e&&!this.ignoreAdaptiveScaling&&this.unit!==t.UNITMODE_PERCENTAGE){var i=0,r=0;if(e.idealWidth&&(i=this._value*e.getSize().width/e.idealWidth),e.idealHeight&&(r=this._value*e.getSize().height/e.idealHeight),e.useSmallestIdeal&&e.idealWidth&&e.idealHeight)return window.innerWidth<window.innerHeight?i:r;if(e.idealWidth)return i;if(e.idealHeight)return r}return this._value},t.prototype.toString=function(e){switch(this.unit){case t.UNITMODE_PERCENTAGE:return 100*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._Regex=/(^-?\d*(\.\d+)?)(%|px)?/,t._UNITMODE_PERCENTAGE=0,t._UNITMODE_PIXEL=1,t})();t.ValueAndUnit=e})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(e){var r=(function(r){function n(i,n,o,s,h,a){void 0===n&&(n=0),void 0===o&&(o=0),void 0===h&&(h=!1),void 0===a&&(a=t.Texture.NEAREST_SAMPLINGMODE);var l=r.call(this,i,{width:n,height:o},s,h,a,t.Engine.TEXTUREFORMAT_RGBA)||this;return l._isDirty=!1,l._rootContainer=new e.Container("root"),l._lastControlOver={},l._lastControlDown={},l._capturingControl={},l._linkedControls=new Array,l._isFullscreen=!1,l._fullscreenViewport=new t.Viewport(0,0,1,1),l._idealWidth=0,l._idealHeight=0,l._useSmallestIdeal=!1,l._renderAtIdealSize=!1,l._blockNextFocusCheck=!1,l._renderScale=1,l.premulAlpha=!1,(s=l.getScene())&&l._texture?(l._renderObserver=s.onBeforeCameraRenderObservable.add((function(t){return l._checkUpdate(t)})),l._preKeyboardObserver=s.onPreKeyboardObservable.add((function(e){l._focusedControl&&(e.type===t.KeyboardEventTypes.KEYDOWN&&l._focusedControl.processKeyboard(e.event),e.skipOnPointerObservable=!0)})),l._rootContainer._link(null,l),l.hasAlpha=!0,n&&o||(l._resizeObserver=s.getEngine().onResizeObservable.add((function(){return l._onResize()})),l._onResize()),l._texture.isReady=!0,l):l}return i(n,r),Object.defineProperty(n.prototype,"renderScale",{get:function(){return this._renderScale},set:function(t){t!==this._renderScale&&(this._renderScale=t,this._onResize())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this.markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(n.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(n.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(n.prototype,"useSmallestIdeal",{get:function(){return this._useSmallestIdeal},set:function(t){this._useSmallestIdeal!==t&&(this._useSmallestIdeal=t,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"renderAtIdealSize",{get:function(){return this._renderAtIdealSize},set:function(t){this._renderAtIdealSize!==t&&(this._renderAtIdealSize=t,this._onResize())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"layer",{get:function(){return this._layerToDispose},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"rootContainer",{get:function(){return this._rootContainer},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"focusedControl",{get:function(){return this._focusedControl},set:function(t){this._focusedControl!=t&&(this._focusedControl&&this._focusedControl.onBlur(),t&&t.onFocus(),this._focusedControl=t)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"isForeground",{get:function(){return!this.layer||!this.layer.isBackground},set:function(t){this.layer&&this.layer.isBackground!==!t&&(this.layer.isBackground=!t)},enumerable:!0,configurable:!0}),n.prototype.executeOnAllControls=function(t,e){e||(e=this._rootContainer);for(var i=0,r=e.children;i<r.length;i++){var n=r[i];n.children?this.executeOnAllControls(t,n):t(n)}},n.prototype.markAsDirty=function(){this._isDirty=!0,this.executeOnAllControls((function(t){t._isFontSizeInPercentage&&t._resetFontCache()}))},n.prototype.createStyle=function(){return new e.Style(this)},n.prototype.addControl=function(t){return this._rootContainer.addControl(t),this},n.prototype.removeControl=function(t){return this._rootContainer.removeControl(t),this},n.prototype.dispose=function(){var t=this.getScene();t&&(t.onBeforeCameraRenderObservable.remove(this._renderObserver),this._resizeObserver&&t.getEngine().onResizeObservable.remove(this._resizeObserver),this._pointerMoveObserver&&t.onPrePointerObservable.remove(this._pointerMoveObserver),this._pointerObserver&&t.onPointerObservable.remove(this._pointerObserver),this._preKeyboardObserver&&t.onPreKeyboardObservable.remove(this._preKeyboardObserver),this._canvasPointerOutObserver&&t.getEngine().onCanvasPointerOutObservable.remove(this._canvasPointerOutObserver),this._layerToDispose&&(this._layerToDispose.texture=null,this._layerToDispose.dispose(),this._layerToDispose=null),this._rootContainer.dispose(),r.prototype.dispose.call(this))},n.prototype._onResize=function(){var t=this.getScene();if(t){var e=t.getEngine(),i=this.getSize(),r=e.getRenderWidth()*this._renderScale,n=e.getRenderHeight()*this._renderScale;this._renderAtIdealSize&&(this._idealWidth?(n=n*this._idealWidth/r,r=this._idealWidth):this._idealHeight&&(r=r*this._idealHeight/n,n=this._idealHeight)),i.width===r&&i.height===n||(this.scaleTo(r,n),this.markAsDirty(),(this._idealWidth||this._idealHeight)&&this._rootContainer._markAllAsDirty())}},n.prototype._getGlobalViewport=function(t){var e=t.getEngine();return this._fullscreenViewport.toGlobal(e.getRenderWidth(),e.getRenderHeight())},n.prototype.getProjectedPosition=function(e,i){var r=this.getScene();if(!r)return t.Vector2.Zero();var n=this._getGlobalViewport(r),o=t.Vector3.Project(e,i,r.getTransformMatrix(),n);return o.scaleInPlace(this.renderScale),new t.Vector2(o.x,o.y)},n.prototype._checkUpdate=function(e){if(!this._layerToDispose||0!=(e.layerMask&this._layerToDispose.layerMask)){if(this._isFullscreen&&this._linkedControls.length){var i=this.getScene();if(!i)return;for(var r=this._getGlobalViewport(i),n=0,o=this._linkedControls;n<o.length;n++){var s=o[n];if(s.isVisible){var h=s._linkedMesh;if(h&&!h.isDisposed()){var a=h.getBoundingInfo().boundingSphere.center,l=t.Vector3.Project(a,h.getWorldMatrix(),i.getTransformMatrix(),r);l.z<0||l.z>1?s.notRenderable=!0:(s.notRenderable=!1,l.scaleInPlace(this.renderScale),s._moveToProjectedPosition(l))}else t.Tools.SetImmediate((function(){s.linkWithMesh(null)}))}}}(this._isDirty||this._rootContainer.isDirty)&&(this._isDirty=!1,this._render(),this.update(!0,this.premulAlpha))}},n.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",n.strokeStyle="white";var o=new e.Measure(0,0,i,r);this._rootContainer._draw(o,n)},n.prototype._doPicking=function(e,i,r,n,o){var s=this.getScene();if(s){var h=s.getEngine(),a=this.getSize();if(this._isFullscreen&&(e*=a.width/h.getRenderWidth(),i*=a.height/h.getRenderHeight()),this._capturingControl[n])return void this._capturingControl[n]._processObservables(r,e,i,n,o);this._rootContainer._processPicking(e,i,r,n,o)||r===t.PointerEventTypes.POINTERMOVE&&(this._lastControlOver[n]&&this._lastControlOver[n]._onPointerOut(this._lastControlOver[n]),delete this._lastControlOver[n]),this._manageFocus()}},n.prototype._cleanControlAfterRemovalFromList=function(t,e){for(var i in t)if(t.hasOwnProperty(i)){var r=t[i];r===e&&delete t[i]}},n.prototype._cleanControlAfterRemoval=function(t){this._cleanControlAfterRemovalFromList(this._lastControlDown,t),this._cleanControlAfterRemovalFromList(this._lastControlOver,t)},n.prototype.attach=function(){var e=this,i=this.getScene();i&&(this._pointerMoveObserver=i.onPrePointerObservable.add((function(r,n){if(!i.isPointerCaptured(r.event.pointerId)&&(r.type===t.PointerEventTypes.POINTERMOVE||r.type===t.PointerEventTypes.POINTERUP||r.type===t.PointerEventTypes.POINTERDOWN)&&i){var o=i.cameraToUseForPointers||i.activeCamera;if(o){var s=i.getEngine(),h=o.viewport,a=(i.pointerX/s.getHardwareScalingLevel()-h.x*s.getRenderWidth())/h.width,l=(i.pointerY/s.getHardwareScalingLevel()-h.y*s.getRenderHeight())/h.height;e._shouldBlockPointer=!1,e._doPicking(a,l,r.type,r.event.pointerId||0,r.event.button),r.skipOnPointerObservable=e._shouldBlockPointer}}})),this._attachToOnPointerOut(i))},n.prototype.attachToMesh=function(e,i){var r=this;void 0===i&&(i=!0);var n=this.getScene();n&&(this._pointerObserver=n.onPointerObservable.add((function(i,n){if(i.type===t.PointerEventTypes.POINTERMOVE||i.type===t.PointerEventTypes.POINTERUP||i.type===t.PointerEventTypes.POINTERDOWN){var o=i.event.pointerId||0;if(i.pickInfo&&i.pickInfo.hit&&i.pickInfo.pickedMesh===e){var s=i.pickInfo.getTextureCoordinates();if(s){var h=r.getSize();r._doPicking(s.x*h.width,(1-s.y)*h.height,i.type,o,i.event.button)}}else i.type===t.PointerEventTypes.POINTERUP?(r._lastControlDown[o]&&r._lastControlDown[o]._forcePointerUp(o),delete r._lastControlDown[o],r.focusedControl=null):i.type===t.PointerEventTypes.POINTERMOVE&&(r._lastControlOver[o]&&r._lastControlOver[o]._onPointerOut(r._lastControlOver[o]),delete r._lastControlOver[o])}})),e.enablePointerMoveEvents=i,this._attachToOnPointerOut(n))},n.prototype.moveFocusToControl=function(t){this.focusedControl=t,this._lastPickedControl=t,this._blockNextFocusCheck=!0},n.prototype._manageFocus=function(){if(this._blockNextFocusCheck)return this._blockNextFocusCheck=!1,void(this._lastPickedControl=this._focusedControl);if(this._focusedControl&&this._focusedControl!==this._lastPickedControl){if(this._lastPickedControl.isFocusInvisible)return;this.focusedControl=null}},n.prototype._attachToOnPointerOut=function(t){var e=this;this._canvasPointerOutObserver=t.getEngine().onCanvasPointerOutObservable.add((function(t){e._lastControlOver[t.pointerId]&&e._lastControlOver[t.pointerId]._onPointerOut(e._lastControlOver[t.pointerId]),delete e._lastControlOver[t.pointerId],e._lastControlDown[t.pointerId]&&e._lastControlDown[t.pointerId]._forcePointerUp(),delete e._lastControlDown[t.pointerId]}))},n.CreateForMesh=function(e,i,r,o){void 0===i&&(i=1024),void 0===r&&(r=1024),void 0===o&&(o=!0);var s=new n(e.name+" AdvancedDynamicTexture",i,r,e.getScene(),!0,t.Texture.TRILINEAR_SAMPLINGMODE),h=new t.StandardMaterial("AdvancedDynamicTextureMaterial",e.getScene());return h.backFaceCulling=!1,h.diffuseColor=t.Color3.Black(),h.specularColor=t.Color3.Black(),h.emissiveTexture=s,h.opacityTexture=s,e.material=h,s.attachToMesh(e,o),s},n.CreateFullscreenUI=function(e,i,r,o){void 0===i&&(i=!0),void 0===r&&(r=null),void 0===o&&(o=t.Texture.BILINEAR_SAMPLINGMODE);var s=new n(e,0,0,r,!1,o),h=new t.Layer(e+"_layer",null,r,!i);return h.texture=s,s._layerToDispose=h,s._isFullscreen=!0,s.attach(),s},n})(t.DynamicTexture);e.AdvancedDynamicTexture=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(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={}))})(t||(t={}));var t;!(function(t){!(function(e){var r=(function(t){function e(e,i){void 0===i&&(i=0);var r=t.call(this,e.x,e.y)||this;return r.buttonIndex=i,r}return i(e,t),e})(t.Vector2);e.Vector2WithInfo=r;var n=(function(){function e(t,e,i,r,n,o){this.m=new Float32Array(6),this.fromValues(t,e,i,r,n,o)}return e.prototype.fromValues=function(t,e,i,r,n,o){return this.m[0]=t,this.m[1]=e,this.m[2]=i,this.m[3]=r,this.m[4]=n,this.m[5]=o,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],o=this.m[3],s=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 l=1/a,u=n*h-o*s,c=r*s-i*h;return e.m[0]=o*l,e.m[1]=-r*l,e.m[2]=-n*l,e.m[3]=i*l,e.m[4]=u*l,e.m[5]=c*l,this},e.prototype.multiplyToRef=function(t,e){var i=this.m[0],r=this.m[1],n=this.m[2],o=this.m[3],s=this.m[4],h=this.m[5],a=t.m[0],l=t.m[1],u=t.m[2],c=t.m[3],_=t.m[4],f=t.m[5];return e.m[0]=i*a+r*u,e.m[1]=i*l+r*c,e.m[2]=n*a+o*u,e.m[3]=n*l+o*c,e.m[4]=s*a+h*u+_,e.m[5]=s*l+h*c+f,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,o,s,h){e.TranslationToRef(t,i,e._TempPreTranslationMatrix),e.ScalingToRef(n,o,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),s?(e._TempCompose1.multiplyToRef(e._TempPostTranslationMatrix,e._TempCompose2),e._TempCompose2.multiplyToRef(s,h)):e._TempCompose1.multiplyToRef(e._TempPostTranslationMatrix,h)},e._TempPreTranslationMatrix=e.Identity(),e._TempPostTranslationMatrix=e.Identity(),e._TempRotationMatrix=e.Identity(),e._TempScalingMatrix=e.Identity(),e._TempCompose0=e.Identity(),e._TempCompose1=e.Identity(),e._TempCompose2=e.Identity(),e})();e.Matrix2D=n})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(e){var i=(function(){function i(i){this._multiLine=i,this._x=new e.ValueAndUnit(0),this._y=new e.ValueAndUnit(0),this._point=new t.Vector2(0,0)}return Object.defineProperty(i.prototype,"x",{get:function(){return this._x.toString(this._multiLine._host)},set:function(t){this._x.toString(this._multiLine._host)!==t&&this._x.fromString(t)&&this._multiLine._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"y",{get:function(){return this._y.toString(this._multiLine._host)},set:function(t){this._y.toString(this._multiLine._host)!==t&&this._y.fromString(t)&&this._multiLine._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"control",{get:function(){return this._control},set:function(t){this._control!==t&&(this._control&&this._controlObserver&&(this._control.onDirtyObservable.remove(this._controlObserver),this._controlObserver=null),this._control=t,this._control&&(this._controlObserver=this._control.onDirtyObservable.add(this._multiLine.onPointUpdate)),this._multiLine._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"mesh",{get:function(){return this._mesh},set:function(t){this._mesh!==t&&(this._mesh&&this._meshObserver&&this._mesh.getScene().onAfterCameraRenderObservable.remove(this._meshObserver),this._mesh=t,this._mesh&&(this._meshObserver=this._mesh.getScene().onAfterCameraRenderObservable.add(this._multiLine.onPointUpdate)),this._multiLine._markAsDirty())},enumerable:!0,configurable:!0}),i.prototype.translate=function(){return this._point=this._translatePoint(),this._point},i.prototype._translatePoint=function(){if(null!=this._mesh)return this._multiLine._host.getProjectedPosition(this._mesh.getBoundingInfo().boundingSphere.center,this._mesh.getWorldMatrix());if(null!=this._control)return new t.Vector2(this._control.centerX,this._control.centerY);var e=this._multiLine._host,i=this._x.getValueInPixel(e,Number(e._canvas.width)),r=this._y.getValueInPixel(e,Number(e._canvas.height));return new t.Vector2(i,r)},i.prototype.dispose=function(){this.control=null,this.mesh=null},i})();e.MultiLinePoint=i})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(e){var i=(function(){function i(r){this.name=r,this._alpha=1,this._alphaSet=!1,this._zIndex=0,this._currentMeasure=e.Measure.Empty(),this._fontFamily="Arial",this._fontStyle="",this._fontWeight="",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="",this._style=null,this._horizontalAlignment=i.HORIZONTAL_ALIGNMENT_CENTER,this._verticalAlignment=i.VERTICAL_ALIGNMENT_CENTER,this._isDirty=!0,this._tempParentMeasure=e.Measure.Empty(),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._onlyMeasureMode=!1,this._isMatrixDirty=!0,this._isVisible=!0,this._fontSet=!1,this._dummyVector2=t.Vector2.Zero(),this._downCount=0,this._enterCount=-1,this._doNotRender=!1,this._downPointerIds={},this.isHitTestVisible=!0,this.isPointerBlocker=!1,this.isFocusInvisible=!1,this.shadowOffsetX=0,this.shadowOffsetY=0,this.shadowBlur=0,this.shadowColor="#000",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.onPointerClickObservable=new t.Observable,this.onPointerEnterObservable=new t.Observable,this.onDirtyObservable=new t.Observable,this.onAfterDrawObservable=new t.Observable}return Object.defineProperty(i.prototype,"typeName",{get:function(){return this._getTypeName()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"fontOffset",{get:function(){return this._fontOffset},set:function(t){this._fontOffset=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this._alpha!==t&&(this._alphaSet=!0,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,"widthInPixels",{get:function(){return this._width.getValueInPixel(this._host,this._cachedParentMeasure.width)},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,"heightInPixels",{get:function(){return this._height.getValueInPixel(this._host,this._cachedParentMeasure.height)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(t){this._fontFamily!==t&&(this._fontFamily=t,this._resetFontCache())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(t){this._fontStyle!==t&&(this._fontStyle=t,this._resetFontCache())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(t){this._fontWeight!==t&&(this._fontWeight=t,this._resetFontCache())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"style",{get:function(){return this._style},set:function(t){var e=this;this._style&&(this._style.onChangedObservable.remove(this._styleObserver),this._styleObserver=null),this._style=t,this._style&&(this._styleObserver=this._style.onChangedObservable.add((function(){e._markAsDirty(),e._resetFontCache()}))),this._markAsDirty(),this._resetFontCache()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_isFontSizeInPercentage",{get:function(){return this._fontSize.isPercentage},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"fontSizeInPixels",{get:function(){var t=this._style?this._style._fontSize:this._fontSize;return t.isPixel?t.getValue(this._host):t.getValueInPixel(this._host,this._tempParentMeasure.height||this._cachedParentMeasure.height)},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._resetFontCache())},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,"notRenderable",{get:function(){return this._doNotRender},set:function(t){this._doNotRender!==t&&(this._doNotRender=t,this._markAsDirty())},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,"paddingLeftInPixels",{get:function(){return this._paddingLeft.getValueInPixel(this._host,this._cachedParentMeasure.width)},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,"paddingRightInPixels",{get:function(){return this._paddingRight.getValueInPixel(this._host,this._cachedParentMeasure.width)},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,"paddingTopInPixels",{get:function(){return this._paddingTop.getValueInPixel(this._host,this._cachedParentMeasure.height)},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,"paddingBottomInPixels",{get:function(){
  2. return this._paddingBottom.getValueInPixel(this._host,this._cachedParentMeasure.height)},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,"leftInPixels",{get:function(){return this._left.getValueInPixel(this._host,this._cachedParentMeasure.width)},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,"topInPixels",{get:function(){return this._top.getValueInPixel(this._host,this._cachedParentMeasure.height)},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,"linkOffsetXInPixels",{get:function(){return this._linkOffsetX.getValueInPixel(this._host,this._cachedParentMeasure.width)},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,"linkOffsetYInPixels",{get:function(){return this._linkOffsetY.getValueInPixel(this._host,this._cachedParentMeasure.height)},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._getTypeName=function(){return"Control"},i.prototype._resetFontCache=function(){this._fontSet=!0},i.prototype.getLocalCoordinates=function(e){var i=t.Vector2.Zero();return this.getLocalCoordinatesToRef(e,i),i},i.prototype.getLocalCoordinatesToRef=function(t,e){return e.x=t.x-this._currentMeasure.left,e.y=t.y-this._currentMeasure.top,this},i.prototype.getParentLocalCoordinates=function(e){var i=t.Vector2.Zero();return i.x=e.x-this._cachedParentMeasure.left,i.y=e.y-this._cachedParentMeasure.top,i},i.prototype.moveToVector3=function(e,i){if(!this._host||this._root!==this._host._rootContainer)return void t.Tools.Error("Cannot move a control to a vector3 if the control is not at root level");this.horizontalAlignment=t.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT,this.verticalAlignment=t.GUI.Control.VERTICAL_ALIGNMENT_TOP;var r=this._host._getGlobalViewport(i),n=t.Vector3.Project(e,t.Matrix.Identity(),i.getTransformMatrix(),r);if(this._moveToProjectedPosition(n),n.z<0||n.z>1)return void(this.notRenderable=!0);this.notRenderable=!1},i.prototype.linkWithMesh=function(e){if(!this._host||this._root&&this._root!==this._host._rootContainer)return void(e&&t.Tools.Error("Cannot link a control to a mesh if the control is not at root level"));var i=this._host._linkedControls.indexOf(this);if(-1!==i)return this._linkedMesh=e,void(e||this._host._linkedControls.splice(i,1));e&&(this.horizontalAlignment=t.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT,this.verticalAlignment=t.GUI.Control.VERTICAL_ALIGNMENT_TOP,this._linkedMesh=e,this._onlyMeasureMode=!0,this._host._linkedControls.push(this))},i.prototype._moveToProjectedPosition=function(t){var e=this._left.getValue(this._host),i=this._top.getValue(this._host),r=t.x+this._linkOffsetX.getValue(this._host)-this._currentMeasure.width/2,n=t.y+this._linkOffsetY.getValue(this._host)-this._currentMeasure.height/2;this._left.ignoreAdaptiveScaling&&this._top.ignoreAdaptiveScaling&&(Math.abs(r-e)<.5&&(r=e),Math.abs(n-i)<.5&&(n=i)),this.left=r+"px",this.top=n+"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._prepareFont(),this._fontSet=!1),this._font&&(t.font=this._font),this._color&&(t.fillStyle=this._color),this._alphaSet&&(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._onlyMeasureMode?(this._onlyMeasureMode=!1,!1):(this._clip(e),e.clip(),!0)))))},i.prototype._clip=function(t){if(t.beginPath(),this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY){var e=this.shadowOffsetX,i=this.shadowOffsetY,r=this.shadowBlur,n=Math.min(Math.min(e,0)-2*r,0),o=Math.max(Math.max(e,0)+2*r,0),s=Math.min(Math.min(i,0)-2*r,0),h=Math.max(Math.max(i,0)+2*r,0);t.rect(this._currentMeasure.left+n,this._currentMeasure.top+s,this._currentMeasure.width+o-n,this._currentMeasure.height+h-s)}else 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,o=t.width,s=t.height,h=0,a=0;switch(this.horizontalAlignment){case i.HORIZONTAL_ALIGNMENT_LEFT:h=0;break;case i.HORIZONTAL_ALIGNMENT_RIGHT:h=o-r;break;case i.HORIZONTAL_ALIGNMENT_CENTER:h=(o-r)/2}switch(this.verticalAlignment){case i.VERTICAL_ALIGNMENT_TOP:a=0;break;case i.VERTICAL_ALIGNMENT_BOTTOM:a=s-n;break;case i.VERTICAL_ALIGNMENT_CENTER:a=(s-n)/2}this._paddingLeft.isPixel?(this._currentMeasure.left+=this._paddingLeft.getValue(this._host),this._currentMeasure.width-=this._paddingLeft.getValue(this._host)):(this._currentMeasure.left+=o*this._paddingLeft.getValue(this._host),this._currentMeasure.width-=o*this._paddingLeft.getValue(this._host)),this._paddingRight.isPixel?this._currentMeasure.width-=this._paddingRight.getValue(this._host):this._currentMeasure.width-=o*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+=s*this._paddingTop.getValue(this._host),this._currentMeasure.height-=s*this._paddingTop.getValue(this._host)),this._paddingBottom.isPixel?this._currentMeasure.height-=this._paddingBottom.getValue(this._host):this._currentMeasure.height-=s*this._paddingBottom.getValue(this._host),this._left.isPixel?this._currentMeasure.left+=this._left.getValue(this._host):this._currentMeasure.left+=o*this._left.getValue(this._host),this._top.isPixel?this._currentMeasure.top+=this._top.getValue(this._host):this._currentMeasure.top+=s*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,r,n){return!(!this.isHitTestVisible||!this.isVisible||this._doNotRender)&&(!!this.contains(t,e)&&(this._processObservables(i,t,e,r,n),!0))},i.prototype._onPointerMove=function(t,e){this.onPointerMoveObservable.notifyObservers(e,-1,t,this)&&null!=this.parent&&this.parent._onPointerMove(t,e)},i.prototype._onPointerEnter=function(t){return!(this._enterCount>0)&&(-1===this._enterCount&&(this._enterCount=0),this._enterCount++,this.onPointerEnterObservable.notifyObservers(this,-1,t,this)&&null!=this.parent&&this.parent._onPointerEnter(t),!0)},i.prototype._onPointerOut=function(t){this._enterCount=0,this.onPointerOutObservable.notifyObservers(this,-1,t,this)&&null!=this.parent&&this.parent._onPointerOut(t)},i.prototype._onPointerDown=function(t,i,r,n){return 0===this._downCount&&(this._downCount++,this._downPointerIds[r]=!0,this.onPointerDownObservable.notifyObservers(new e.Vector2WithInfo(i,n),-1,t,this)&&null!=this.parent&&this.parent._onPointerDown(t,i,r,n),!0)},i.prototype._onPointerUp=function(t,i,r,n,o){this._downCount=0,delete this._downPointerIds[r];var s=o;o&&(this._enterCount>0||-1===this._enterCount)&&(s=this.onPointerClickObservable.notifyObservers(new e.Vector2WithInfo(i,n),-1,t,this)),this.onPointerUpObservable.notifyObservers(new e.Vector2WithInfo(i,n),-1,t,this)&&null!=this.parent&&this.parent._onPointerUp(t,i,r,n,s)},i.prototype._forcePointerUp=function(e){if(void 0===e&&(e=null),null!==e)this._onPointerUp(this,t.Vector2.Zero(),e,0,!0);else for(var i in this._downPointerIds)this._onPointerUp(this,t.Vector2.Zero(),+i,0,!0)},i.prototype._processObservables=function(e,i,r,n,o){if(this._dummyVector2.copyFromFloats(i,r),e===t.PointerEventTypes.POINTERMOVE){this._onPointerMove(this,this._dummyVector2);var s=this._host._lastControlOver[n];return s&&s!==this&&s._onPointerOut(this),s!==this&&this._onPointerEnter(this),this._host._lastControlOver[n]=this,!0}return e===t.PointerEventTypes.POINTERDOWN?(this._onPointerDown(this,this._dummyVector2,n,o),this._host._lastControlDown[n]=this,this._host._lastPickedControl=this,!0):e===t.PointerEventTypes.POINTERUP&&(this._host._lastControlDown[n]&&this._host._lastControlDown[n]._onPointerUp(this,this._dummyVector2,n,o,!0),delete this._host._lastControlDown[n],!0)},i.prototype._prepareFont=function(){(this._font||this._fontSet)&&(this._style?this._font=(this._style.fontWeight?this._style.fontWeight:this._style.fontStyle)+" "+this.fontSizeInPixels+"px "+this._style.fontFamily:this._font=(this._fontWeight?this._fontWeight:this._fontStyle)+" "+this.fontSizeInPixels+"px "+this._fontFamily,this._fontOffset=i._GetFontOffset(this._font))},i.prototype.dispose=function(){this.onDirtyObservable.clear(),this.onAfterDrawObservable.clear(),this.onPointerDownObservable.clear(),this.onPointerEnterObservable.clear(),this.onPointerMoveObservable.clear(),this.onPointerOutObservable.clear(),this.onPointerUpObservable.clear(),this.onPointerClickObservable.clear(),this._styleObserver&&this._style&&(this._style.onChangedObservable.remove(this._styleObserver),this._styleObserver=null),this._root&&(this._root.removeControl(this),this._root=null),this._host._linkedControls.indexOf(this)>-1&&this.linkWithMesh(null)},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 o=0,s=0;try{s=r.getBoundingClientRect().top-e.getBoundingClientRect().top,r.style.verticalAlign="baseline",o=r.getBoundingClientRect().top-e.getBoundingClientRect().top}finally{document.body.removeChild(n)}var h={ascent:o,height:s,descent:s-o};return i._FontHeightSizes[t]=h,h},i.AddHeader=function(e,r,n,o){var s=new t.GUI.StackPanel("panel"),h=!o||o.isHorizontal,a=!o||o.controlFirst;s.isVertical=!h;var l=new t.GUI.TextBlock("header");return l.text=r,l.textHorizontalAlignment=i.HORIZONTAL_ALIGNMENT_LEFT,h?l.width=n:l.height=n,a?(s.addControl(e),s.addControl(l),l.paddingLeft="5px"):(s.addControl(l),s.addControl(e),l.paddingRight="5px"),l.shadowBlur=e.shadowBlur,l.shadowColor=e.shadowColor,l.shadowOffsetX=e.shadowOffsetX,l.shadowOffsetY=e.shadowOffsetY,s},i.drawEllipse=function(t,e,i,r,n){n.translate(t,e),n.scale(i,r),n.beginPath(),n.arc(0,0,1,0,2*Math.PI),n.closePath(),n.scale(1/i,1/r),n.translate(-t,-e)},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={},i})();e.Control=i})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(t){var e=(function(e){function r(i){var r=e.call(this,i)||this;return r.name=i,r._children=new Array,r._measureForChildren=t.Measure.Empty(),r._adaptWidthToChildren=!1,r._adaptHeightToChildren=!1,r}return i(r,e),Object.defineProperty(r.prototype,"adaptHeightToChildren",{get:function(){return this._adaptHeightToChildren},set:function(t){this._adaptHeightToChildren!==t&&(this._adaptHeightToChildren=t,t&&(this.height="100%"),this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"adaptWidthToChildren",{get:function(){return this._adaptWidthToChildren},set:function(t){this._adaptWidthToChildren!==t&&(this._adaptWidthToChildren=t,t&&(this.width="100%"),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,"children",{get:function(){return this._children},enumerable:!0,configurable:!0}),r.prototype._getTypeName=function(){return"Container"},r.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},r.prototype.getChildByType=function(t,e){for(var i=0,r=this.children;i<r.length;i++){var n=r[i];if(n.typeName===e)return n}return null},r.prototype.containsControl=function(t){return-1!==this.children.indexOf(t)},r.prototype.addControl=function(t){return t?-1!==this._children.indexOf(t)?this:(t._link(this,this._host),t._markAllAsDirty(),this._reOrderControl(t),this._markAsDirty(),this):this},r.prototype.removeControl=function(t){var e=this._children.indexOf(t);return-1!==e&&(this._children.splice(e,1),t.parent=null),t.linkWithMesh(null),this._host&&this._host._cleanControlAfterRemoval(t),this._markAsDirty(),this},r.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),t.parent=this,this._markAsDirty()},r.prototype._markMatrixAsDirty=function(){e.prototype._markMatrixAsDirty.call(this);for(var t=0;t<this._children.length;t++)this._children[t]._markMatrixAsDirty()},r.prototype._markAllAsDirty=function(){e.prototype._markAllAsDirty.call(this);for(var t=0;t<this._children.length;t++)this._children[t]._markAllAsDirty()},r.prototype._localDraw=function(t){this._background&&((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),t.fillStyle=this._background,t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0))},r.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)}},r.prototype._draw=function(t,e){if(this.isVisible&&!this.notRenderable){if(e.save(),this._applyStates(e),this._processMeasures(t,e)){this._localDraw(e),this._clipForChildren(e);for(var i=-1,r=-1,n=0,o=this._children;n<o.length;n++){var s=o[n];s.isVisible&&!s.notRenderable&&(s._tempParentMeasure.copyFrom(this._measureForChildren),s._draw(this._measureForChildren,e),s.onAfterDrawObservable.hasObservers()&&s.onAfterDrawObservable.notifyObservers(s),this.adaptWidthToChildren&&s._width.isPixel&&(i=Math.max(i,s._currentMeasure.width)),this.adaptHeightToChildren&&s._height.isPixel&&(r=Math.max(r,s._currentMeasure.height)))}this.adaptWidthToChildren&&i>=0&&(this.width=i+"px"),this.adaptHeightToChildren&&r>=0&&(this.height=r+"px")}e.restore(),this.onAfterDrawObservable.hasObservers()&&this.onAfterDrawObservable.notifyObservers(this)}},r.prototype._processPicking=function(t,i,r,n,o){if(!this.isVisible||this.notRenderable)return!1;if(!e.prototype.contains.call(this,t,i))return!1;for(var s=this._children.length-1;s>=0;s--){if(this._children[s]._processPicking(t,i,r,n,o))return!0}return!!this.isHitTestVisible&&this._processObservables(r,t,i,n,o)},r.prototype._clipForChildren=function(t){},r.prototype._additionalProcessing=function(t,i){e.prototype._additionalProcessing.call(this,t,i),this._measureForChildren.copyFrom(this._currentMeasure)},r.prototype.dispose=function(){e.prototype.dispose.call(this);for(var t=0,i=this._children;t<i.length;t++){i[t].dispose()}},r})(t.Control);t.Container=e})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(e){var r=(function(r){function n(t){var i=r.call(this,t)||this;return i.name=t,i._isVertical=!0,i._manualWidth=!1,i._manualHeight=!1,i._doNotTrackManualChanges=!1,i._tempMeasureStore=e.Measure.Empty(),i}return i(n,r),Object.defineProperty(n.prototype,"isVertical",{get:function(){return this._isVertical},set:function(t){this._isVertical!==t&&(this._isVertical=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"width",{get:function(){return this._width.toString(this._host)},set:function(t){this._doNotTrackManualChanges||(this._manualWidth=!0),this._width.toString(this._host)!==t&&this._width.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){return this._height.toString(this._host)},set:function(t){this._doNotTrackManualChanges||(this._manualHeight=!0),this._height.toString(this._host)!==t&&this._height.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),n.prototype._getTypeName=function(){return"StackPanel"},n.prototype._preMeasure=function(e,i){for(var n=0,o=0,s=0,h=this._children;s<h.length;s++){var a=h[s];this._tempMeasureStore.copyFrom(a._currentMeasure),a._currentMeasure.copyFrom(e),a._measure(),this._isVertical?(a.top=o+"px",a._top.ignoreAdaptiveScaling||a._markAsDirty(),a._top.ignoreAdaptiveScaling=!0,o+=a._currentMeasure.height,a._currentMeasure.width>n&&(n=a._currentMeasure.width),a.verticalAlignment=t.GUI.Control.VERTICAL_ALIGNMENT_TOP):(a.left=n+"px",a._left.ignoreAdaptiveScaling||a._markAsDirty(),a._left.ignoreAdaptiveScaling=!0,n+=a._currentMeasure.width,a._currentMeasure.height>o&&(o=a._currentMeasure.height),a.horizontalAlignment=t.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT),a._currentMeasure.copyFrom(this._tempMeasureStore)}this._doNotTrackManualChanges=!0;var l=!1,u=!1,c=this.height,_=this.width;this._manualHeight||(this.height=o+"px"),this._manualWidth||(this.width=n+"px"),l=_!==this.width||!this._width.ignoreAdaptiveScaling,u=c!==this.height||!this._height.ignoreAdaptiveScaling,u&&(this._height.ignoreAdaptiveScaling=!0),l&&(this._width.ignoreAdaptiveScaling=!0),this._doNotTrackManualChanges=!1,(l||u)&&this._markAllAsDirty(),r.prototype._preMeasure.call(this,e,i)},n})(e.Container);e.StackPanel=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(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 i(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._getTypeName=function(){return"Rectangle"},e.prototype._localDraw=function(t){t.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),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.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),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,o=this._currentMeasure.height-2*e,s=Math.min(o/2-2,Math.min(n/2-2,this._cornerRadius));t.beginPath(),t.moveTo(i+s,r),t.lineTo(i+n-s,r),t.quadraticCurveTo(i+n,r,i+n,r+s),t.lineTo(i+n,r+o-s),t.quadraticCurveTo(i+n,r+o,i+n-s,r+o),t.lineTo(i+s,r+o),t.quadraticCurveTo(i,r+o,i,r+o-s),t.lineTo(i,r+s),t.quadraticCurveTo(i,r,i+s,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={}))})(t||(t={}));var t;!(function(t){!(function(t){var e=(function(e){function r(t){var i=e.call(this,t)||this;return i.name=t,i._thickness=1,i}return i(r,e),Object.defineProperty(r.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!0,configurable:!0}),r.prototype._getTypeName=function(){return"Ellipse"},r.prototype._localDraw=function(e){e.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),t.Control.drawEllipse(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,e),this._background&&(e.fillStyle=this._background,e.fill()),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),this._thickness&&(this.color&&(e.strokeStyle=this.color),e.lineWidth=this._thickness,e.stroke()),e.restore()},r.prototype._additionalProcessing=function(t,i){e.prototype._additionalProcessing.call(this,t,i),this._measureForChildren.width-=2*this._thickness,this._measureForChildren.height-=2*this._thickness,this._measureForChildren.left+=this._thickness,this._measureForChildren.top+=this._thickness},r.prototype._clipForChildren=function(e){t.Control.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,this._currentMeasure.width/2,this._currentMeasure.height/2,e),e.clip()},r})(t.Container);t.Ellipse=e})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(e){var r=(function(r){function n(t){var i=r.call(this,t)||this;return i.name=t,i._lineWidth=1,i._x1=new e.ValueAndUnit(0),i._y1=new e.ValueAndUnit(0),i._x2=new e.ValueAndUnit(0),i._y2=new e.ValueAndUnit(0),i._dash=new Array,i.isHitTestVisible=!1,i._horizontalAlignment=e.Control.HORIZONTAL_ALIGNMENT_LEFT,i._verticalAlignment=e.Control.VERTICAL_ALIGNMENT_TOP,i}return i(n,r),Object.defineProperty(n.prototype,"dash",{get:function(){return this._dash},set:function(t){this._dash!==t&&(this._dash=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(n.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(n.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(n.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(n.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(n.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(n.prototype,"lineWidth",{get:function(){return this._lineWidth},set:function(t){this._lineWidth!==t&&(this._lineWidth=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"horizontalAlignment",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"verticalAlignment",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"_effectiveX2",{get:function(){return(this._connectedControl?this._connectedControl.centerX:0)+this._x2.getValue(this._host)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"_effectiveY2",{get:function(){return(this._connectedControl?this._connectedControl.centerY:0)+this._y2.getValue(this._host)},enumerable:!0,configurable:!0}),n.prototype._getTypeName=function(){return"Line"},n.prototype._draw=function(t,e){e.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),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()},n.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},n.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},n.prototype.moveToVector3=function(e,i,r){if(void 0===r&&(r=!1),!this._host||this._root!==this._host._rootContainer)return void t.Tools.Error("Cannot move a control to a vector3 if the control is not at root level");var n=this._host._getGlobalViewport(i),o=t.Vector3.Project(e,t.Matrix.Identity(),i.getTransformMatrix(),n);if(this._moveToProjectedPosition(o,r),o.z<0||o.z>1)return void(this.notRenderable=!0);this.notRenderable=!1},n.prototype._moveToProjectedPosition=function(t,e){void 0===e&&(e=!1);var i=t.x+this._linkOffsetX.getValue(this._host)+"px",r=t.y+this._linkOffsetY.getValue(this._host)+"px";e?(this.x2=i,this.y2=r,this._x2.ignoreAdaptiveScaling=!0,this._y2.ignoreAdaptiveScaling=!0):(this.x1=i,this.y1=r,this._x1.ignoreAdaptiveScaling=!0,this._y1.ignoreAdaptiveScaling=!0)},n})(e.Control);e.Line=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(e){var r=(function(r){function n(i){var n=r.call(this,i)||this;return n.name=i,n._thumbWidth=new e.ValueAndUnit(20,e.ValueAndUnit.UNITMODE_PIXEL,!1),n._minimum=0,n._maximum=100,n._value=50,n._isVertical=!1,n._background="black",n._borderColor="white",n._barOffset=new e.ValueAndUnit(5,e.ValueAndUnit.UNITMODE_PIXEL,!1),n._isThumbCircle=!1,n._isThumbClamped=!1,n.onValueChangedObservable=new t.Observable,n._pointerIsDown=!1,n.isPointerBlocker=!0,n}return i(n,r),Object.defineProperty(n.prototype,"borderColor",{get:function(){return this._borderColor},set:function(t){this._borderColor!==t&&(this._borderColor=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(n.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()
  3. },enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"barOffsetInPixels",{get:function(){return this._barOffset.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!0,configurable:!0}),Object.defineProperty(n.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(n.prototype,"thumbWidthInPixels",{get:function(){return this._thumbWidth.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!0,configurable:!0}),Object.defineProperty(n.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(n.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(n.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}),Object.defineProperty(n.prototype,"isVertical",{get:function(){return this._isVertical},set:function(t){this._isVertical!==t&&(this._isVertical=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"isThumbCircle",{get:function(){return this._isThumbCircle},set:function(t){this._isThumbCircle!==t&&(this._isThumbCircle=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"isThumbClamped",{get:function(){return this._isThumbClamped},set:function(t){this._isThumbClamped!==t&&(this._isThumbClamped=t,this._markAsDirty())},enumerable:!0,configurable:!0}),n.prototype._getTypeName=function(){return"Slider"},n.prototype._getThumbThickness=function(t,e){var i=0;switch(t){case"circle":i=this._thumbWidth.isPixel?Math.max(this._thumbWidth.getValue(this._host),e):e*this._thumbWidth.getValue(this._host);break;case"rectangle":i=this._thumbWidth.isPixel?Math.min(this._thumbWidth.getValue(this._host),e):e*this._thumbWidth.getValue(this._host)}return i},n.prototype._draw=function(t,e){if(e.save(),this._applyStates(e),this._processMeasures(t,e)){var i=0,r=this.isThumbCircle?"circle":"rectangle",n=this._currentMeasure.left,o=this._currentMeasure.top,s=this._currentMeasure.width,h=this._currentMeasure.height,a=Math.max(this._currentMeasure.width,this._currentMeasure.height),l=Math.min(this._currentMeasure.width,this._currentMeasure.height),u=this._getThumbThickness(r,l);a-=u;var c=0;if(this._isVertical&&this._currentMeasure.height<this._currentMeasure.width)return void console.error("Height should be greater than width");i=this._barOffset.isPixel?Math.min(this._barOffset.getValue(this._host),l):l*this._barOffset.getValue(this._host),l-=2*i,this._isVertical?(n+=i,this.isThumbClamped||(o+=u/2),h=a,s=l):(o+=i,this.isThumbClamped||(n+=u/2),h=l,s=a),this.isThumbClamped&&this.isThumbCircle?(this._isVertical?o+=u/2:n+=u/2,c=l/2):c=(u-i)/2,(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY);var _=this._isVertical?(this._maximum-this._value)/(this._maximum-this._minimum)*a:(this._value-this._minimum)/(this._maximum-this._minimum)*a;e.fillStyle=this._background,this._isVertical?this.isThumbClamped?this.isThumbCircle?(e.beginPath(),e.arc(n+l/2,o,c,Math.PI,2*Math.PI),e.fill(),e.fillRect(n,o,s,h)):e.fillRect(n,o,s,h+u):e.fillRect(n,o,s,h):this.isThumbClamped?this.isThumbCircle?(e.beginPath(),e.arc(n+a,o+l/2,c,0,2*Math.PI),e.fill(),e.fillRect(n,o,s,h)):e.fillRect(n,o,s+u,h):e.fillRect(n,o,s,h),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),e.fillStyle=this.color,this._isVertical?this.isThumbClamped?this.isThumbCircle?(e.beginPath(),e.arc(n+l/2,o+a,c,0,2*Math.PI),e.fill(),e.fillRect(n,o+_,s,h-_)):e.fillRect(n,o+_,s,this._currentMeasure.height-_):e.fillRect(n,o+_,s,h-_):this.isThumbClamped&&this.isThumbCircle?(e.beginPath(),e.arc(n,o+l/2,c,0,2*Math.PI),e.fill(),e.fillRect(n,o,_,h)):e.fillRect(n,o,_,h),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),this._isThumbCircle?(e.beginPath(),this._isVertical?e.arc(n+l/2,o+_,c,0,2*Math.PI):e.arc(n+_,o+l/2,c,0,2*Math.PI),e.fill(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),e.strokeStyle=this._borderColor,e.stroke()):(this._isVertical?e.fillRect(n-i,this._currentMeasure.top+_,this._currentMeasure.width,u):e.fillRect(this._currentMeasure.left+_,this._currentMeasure.top,u,this._currentMeasure.height),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),e.strokeStyle=this._borderColor,this._isVertical?e.strokeRect(n-i,this._currentMeasure.top+_,this._currentMeasure.width,u):e.strokeRect(this._currentMeasure.left+_,this._currentMeasure.top,u,this._currentMeasure.height))}e.restore()},n.prototype._updateValueFromPointer=function(t,e){0!=this.rotation&&(this._invertTransformMatrix.transformCoordinates(t,e,this._transformedPosition),t=this._transformedPosition.x,e=this._transformedPosition.y),this._isVertical?this.value=this._minimum+(1-(e-this._currentMeasure.top)/this._currentMeasure.height)*(this._maximum-this._minimum):this.value=this._minimum+(t-this._currentMeasure.left)/this._currentMeasure.width*(this._maximum-this._minimum)},n.prototype._onPointerDown=function(t,e,i,n){return!!r.prototype._onPointerDown.call(this,t,e,i,n)&&(this._pointerIsDown=!0,this._updateValueFromPointer(e.x,e.y),this._host._capturingControl[i]=this,!0)},n.prototype._onPointerMove=function(t,e){this._pointerIsDown&&this._updateValueFromPointer(e.x,e.y),r.prototype._onPointerMove.call(this,t,e)},n.prototype._onPointerUp=function(t,e,i,n,o){this._pointerIsDown=!1,delete this._host._capturingControl[i],r.prototype._onPointerUp.call(this,t,e,i,n,o)},n})(e.Control);e.Slider=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(e){var r=(function(e){function r(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 i(r,e),Object.defineProperty(r.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(r.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(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,"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}),r.prototype._getTypeName=function(){return"CheckBox"},r.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((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),e.fillStyle=this._background,e.fillRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,i,r),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),this._isChecked){e.fillStyle=this.color;var n=i*this._checkSizeRatio,o=r*this._checkSizeRatio;e.fillRect(this._currentMeasure.left+this._thickness/2+(i-n)/2,this._currentMeasure.top+this._thickness/2+(r-o)/2,n,o)}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()},r.prototype._onPointerDown=function(t,i,r,n){return!!e.prototype._onPointerDown.call(this,t,i,r,n)&&(this.isChecked=!this.isChecked,!0)},r})(e.Control);e.Checkbox=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(e){var r=(function(r){function n(e){var i=r.call(this,e)||this;return i.name=e,i._isChecked=!1,i._background="black",i._checkSizeRatio=.8,i._thickness=1,i.group="",i.onIsCheckedChangedObservable=new t.Observable,i.isPointerBlocker=!0,i}return i(n,r),Object.defineProperty(n.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(n.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(n.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"isChecked",{get:function(){return this._isChecked},set:function(t){var e=this;this._isChecked!==t&&(this._isChecked=t,this._markAsDirty(),this.onIsCheckedChangedObservable.notifyObservers(t),this._isChecked&&this._host.executeOnAllControls((function(t){if(t!==e&&void 0!==t.group){var i=t;i.group===e.group&&(i.isChecked=!1)}})))},enumerable:!0,configurable:!0}),n.prototype._getTypeName=function(){return"RadioButton"},n.prototype._draw=function(t,i){if(i.save(),this._applyStates(i),this._processMeasures(t,i)){var r=this._currentMeasure.width-this._thickness,n=this._currentMeasure.height-this._thickness;if((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(i.shadowColor=this.shadowColor,i.shadowBlur=this.shadowBlur,i.shadowOffsetX=this.shadowOffsetX,i.shadowOffsetY=this.shadowOffsetY),e.Control.drawEllipse(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,i),i.fillStyle=this._background,i.fill(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0),i.strokeStyle=this.color,i.lineWidth=this._thickness,i.stroke(),this._isChecked){i.fillStyle=this.color;var o=r*this._checkSizeRatio,s=n*this._checkSizeRatio;e.Control.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,o/2-this._thickness/2,s/2-this._thickness/2,i),i.fill()}}i.restore()},n.prototype._onPointerDown=function(t,e,i,n){return!!r.prototype._onPointerDown.call(this,t,e,i,n)&&(this.isChecked||(this.isChecked=!0),!0)},n})(e.Control);e.RadioButton=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(e){var r=(function(r){function n(i,n){void 0===n&&(n="");var o=r.call(this,i)||this;return o.name=i,o._text="",o._textWrapping=!1,o._textHorizontalAlignment=e.Control.HORIZONTAL_ALIGNMENT_CENTER,o._textVerticalAlignment=e.Control.VERTICAL_ALIGNMENT_CENTER,o._resizeToFit=!1,o._lineSpacing=new e.ValueAndUnit(0),o._outlineWidth=0,o._outlineColor="white",o.onTextChangedObservable=new t.Observable,o.onLinesReadyObservable=new t.Observable,o.text=n,o}return i(n,r),Object.defineProperty(n.prototype,"lines",{get:function(){return this._lines},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"resizeToFit",{get:function(){return this._resizeToFit},set:function(t){this._resizeToFit=t,this._resizeToFit&&(this._width.ignoreAdaptiveScaling=!0,this._height.ignoreAdaptiveScaling=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"textWrapping",{get:function(){return this._textWrapping},set:function(t){this._textWrapping!==t&&(this._textWrapping=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"text",{get:function(){return this._text},set:function(t){this._text!==t&&(this._text=t,this._markAsDirty(),this.onTextChangedObservable.notifyObservers(this))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"textHorizontalAlignment",{get:function(){return this._textHorizontalAlignment},set:function(t){this._textHorizontalAlignment!==t&&(this._textHorizontalAlignment=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"textVerticalAlignment",{get:function(){return this._textVerticalAlignment},set:function(t){this._textVerticalAlignment!==t&&(this._textVerticalAlignment=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"lineSpacing",{get:function(){return this._lineSpacing.toString(this._host)},set:function(t){this._lineSpacing.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"outlineWidth",{get:function(){return this._outlineWidth},set:function(t){this._outlineWidth!==t&&(this._outlineWidth=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"outlineColor",{get:function(){return this._outlineColor},set:function(t){this._outlineColor!==t&&(this._outlineColor=t,this._markAsDirty())},enumerable:!0,configurable:!0}),n.prototype._getTypeName=function(){return"TextBlock"},n.prototype._drawText=function(t,i,r,n){var o=this._currentMeasure.width,s=0;switch(this._textHorizontalAlignment){case e.Control.HORIZONTAL_ALIGNMENT_LEFT:s=0;break;case e.Control.HORIZONTAL_ALIGNMENT_RIGHT:s=o-i;break;case e.Control.HORIZONTAL_ALIGNMENT_CENTER:s=(o-i)/2}(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(n.shadowColor=this.shadowColor,n.shadowBlur=this.shadowBlur,n.shadowOffsetX=this.shadowOffsetX,n.shadowOffsetY=this.shadowOffsetY),this.outlineWidth&&n.strokeText(t,this._currentMeasure.left+s,r),n.fillText(t,this._currentMeasure.left+s,r)},n.prototype._draw=function(t,e){e.save(),this._applyStates(e),this._processMeasures(t,e)&&this._renderLines(e),e.restore()},n.prototype._applyStates=function(t){r.prototype._applyStates.call(this,t),this.outlineWidth&&(t.lineWidth=this.outlineWidth,t.strokeStyle=this.outlineColor)},n.prototype._additionalProcessing=function(t,e){this._lines=[];var i=this.text.split("\n");if(this._textWrapping&&!this._resizeToFit)for(var r=0,n=i;r<n.length;r++){var o=n[r];this._lines.push(this._parseLineWithTextWrapping(o,e))}else for(var s=0,h=i;s<h.length;s++){var o=h[s];this._lines.push(this._parseLine(o,e))}this.onLinesReadyObservable.notifyObservers(this)},n.prototype._parseLine=function(t,e){return void 0===t&&(t=""),{text:t,width:e.measureText(t).width}},n.prototype._parseLineWithTextWrapping=function(t,e){void 0===t&&(t="");for(var i=t.split(" "),r=this._currentMeasure.width,n=0,o=0;o<i.length;o++){var s=o>0?t+" "+i[o]:i[0],h=e.measureText(s),a=h.width;a>r&&o>0?(this._lines.push({text:t,width:n}),t=i[o],n=e.measureText(t).width):(n=a,t=s)}return{text:t,width:n}},n.prototype._renderLines=function(t){var i=this._currentMeasure.height;this._fontOffset||(this._fontOffset=e.Control._GetFontOffset(t.font));var r=0;switch(this._textVerticalAlignment){case e.Control.VERTICAL_ALIGNMENT_TOP:r=this._fontOffset.ascent;break;case e.Control.VERTICAL_ALIGNMENT_BOTTOM:r=i-this._fontOffset.height*(this._lines.length-1)-this._fontOffset.descent;break;case e.Control.VERTICAL_ALIGNMENT_CENTER:r=this._fontOffset.ascent+(i-this._fontOffset.height*this._lines.length)/2}r+=this._currentMeasure.top;for(var n=0,o=0;o<this._lines.length;o++){var s=this._lines[o];0!==o&&0!==this._lineSpacing.internalValue&&(this._lineSpacing.isPixel?r+=this._lineSpacing.getValue(this._host):r+=this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height)),this._drawText(s.text,s.width,r,t),r+=this._fontOffset.height,s.width>n&&(n=s.width)}this._resizeToFit&&(this.width=this.paddingLeftInPixels+this.paddingRightInPixels+n+"px",this.height=this.paddingTopInPixels+this.paddingBottomInPixels+this._fontOffset.height*this._lines.length+"px")},n.prototype.dispose=function(){r.prototype.dispose.call(this),this.onTextChangedObservable.clear()},n})(e.Control);e.TextBlock=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t,r=Image;!(function(t){!(function(e){var n=(function(e){function n(t,i){void 0===i&&(i=null);var r=e.call(this,t)||this;return r.name=t,r._loaded=!1,r._stretch=n.STRETCH_FILL,r._autoScale=!1,r._sourceLeft=0,r._sourceTop=0,r._sourceWidth=0,r._sourceHeight=0,r._cellWidth=0,r._cellHeight=0,r._cellId=-1,r.source=i,r}return i(n,e),Object.defineProperty(n.prototype,"sourceLeft",{get:function(){return this._sourceLeft},set:function(t){this._sourceLeft!==t&&(this._sourceLeft=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"sourceTop",{get:function(){return this._sourceTop},set:function(t){this._sourceTop!==t&&(this._sourceTop=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"sourceWidth",{get:function(){return this._sourceWidth},set:function(t){this._sourceWidth!==t&&(this._sourceWidth=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"sourceHeight",{get:function(){return this._sourceHeight},set:function(t){this._sourceHeight!==t&&(this._sourceHeight=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(n.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(n.prototype,"stretch",{get:function(){return this._stretch},set:function(t){this._stretch!==t&&(this._stretch=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(n.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}),n.prototype._onImageLoaded=function(){this._imageWidth=this._domImage.width,this._imageHeight=this._domImage.height,this._loaded=!0,this._autoScale&&this.synchronizeSizeWithContent(),this._markAsDirty()},Object.defineProperty(n.prototype,"source",{set:function(e){var i=this;this._source!==e&&(this._loaded=!1,this._source=e,this._domImage=new r,this._domImage.onload=function(){i._onImageLoaded()},e&&(t.Tools.SetCorsBehavior(e,this._domImage),this._domImage.src=e))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"cellWidth",{get:function(){return this._cellWidth},set:function(t){this._cellWidth!==t&&(this._cellWidth=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"cellHeight",{get:function(){return this._cellHeight},set:function(t){this._cellHeight!==t&&(this._cellHeight=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"cellId",{get:function(){return this._cellId},set:function(t){this._cellId!==t&&(this._cellId=t,this._markAsDirty())},enumerable:!0,configurable:!0}),n.prototype._getTypeName=function(){return"Image"},n.prototype.synchronizeSizeWithContent=function(){this._loaded&&(this.width=this._domImage.width+"px",this.height=this._domImage.height+"px")},n.prototype._draw=function(t,e){e.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY);var i,r,o,s;if(-1==this.cellId)i=this._sourceLeft,r=this._sourceTop,o=this._sourceWidth?this._sourceWidth:this._imageWidth,s=this._sourceHeight?this._sourceHeight:this._imageHeight;else{var h=this._domImage.naturalWidth/this.cellWidth,a=this.cellId/h>>0,l=this.cellId%h;i=this.cellWidth*l,r=this.cellHeight*a,o=this.cellWidth,s=this.cellHeight}if(this._applyStates(e),this._processMeasures(t,e)&&this._loaded)switch(this._stretch){case n.STRETCH_NONE:case n.STRETCH_FILL:e.drawImage(this._domImage,i,r,o,s,this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height);break;case n.STRETCH_UNIFORM:var u=this._currentMeasure.width/o,c=this._currentMeasure.height/s,_=Math.min(u,c),f=(this._currentMeasure.width-o*_)/2,d=(this._currentMeasure.height-s*_)/2;e.drawImage(this._domImage,i,r,o,s,this._currentMeasure.left+f,this._currentMeasure.top+d,o*_,s*_);break;case n.STRETCH_EXTEND:e.drawImage(this._domImage,i,r,o,s,this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height),this._autoScale&&this.synchronizeSizeWithContent(),this._root&&this._root.parent&&(this._root.width=this.width,this._root.height=this.height)}e.restore()},Object.defineProperty(n,"STRETCH_NONE",{get:function(){return n._STRETCH_NONE},enumerable:!0,configurable:!0}),Object.defineProperty(n,"STRETCH_FILL",{get:function(){return n._STRETCH_FILL},enumerable:!0,configurable:!0}),Object.defineProperty(n,"STRETCH_UNIFORM",{get:function(){return n._STRETCH_UNIFORM},enumerable:!0,configurable:!0}),Object.defineProperty(n,"STRETCH_EXTEND",{get:function(){return n._STRETCH_EXTEND},enumerable:!0,configurable:!0}),n._STRETCH_NONE=0,n._STRETCH_FILL=1,n._STRETCH_UNIFORM=2,n._STRETCH_EXTEND=3,n})(e.Control);e.Image=n})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(e){var r=(function(e){function r(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 i(r,e),r.prototype._getTypeName=function(){return"Button"},r.prototype._processPicking=function(t,i,r,n,o){return!(!this.isHitTestVisible||!this.isVisible||this.notRenderable)&&(!!e.prototype.contains.call(this,t,i)&&(this._processObservables(r,t,i,n,o),!0))},r.prototype._onPointerEnter=function(t){return!!e.prototype._onPointerEnter.call(this,t)&&(this.pointerEnterAnimation&&this.pointerEnterAnimation(),!0)},r.prototype._onPointerOut=function(t){this.pointerOutAnimation&&this.pointerOutAnimation(),e.prototype._onPointerOut.call(this,t)},r.prototype._onPointerDown=function(t,i,r,n){return!!e.prototype._onPointerDown.call(this,t,i,r,n)&&(this.pointerDownAnimation&&this.pointerDownAnimation(),!0)},r.prototype._onPointerUp=function(t,i,r,n,o){this.pointerUpAnimation&&this.pointerUpAnimation(),e.prototype._onPointerUp.call(this,t,i,r,n,o)},r.CreateImageButton=function(e,i,n){var o=new r(e),s=new t.GUI.TextBlock(e+"_button",i);s.textWrapping=!0,s.textHorizontalAlignment=t.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER,s.paddingLeft="20%",o.addControl(s);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,o.addControl(h),o},r.CreateImageOnlyButton=function(e,i){var n=new r(e),o=new t.GUI.Image(e+"_icon",i);return o.stretch=t.GUI.Image.STRETCH_FILL,o.horizontalAlignment=t.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT,n.addControl(o),n},r.CreateSimpleButton=function(e,i){var n=new r(e),o=new t.GUI.TextBlock(e+"_button",i);return o.textWrapping=!0,o.textHorizontalAlignment=t.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER,n.addControl(o),n},r.CreateImageWithCenterTextButton=function(e,i,n){var o=new r(e),s=new t.GUI.Image(e+"_icon",n);s.stretch=t.GUI.Image.STRETCH_FILL,o.addControl(s);var h=new t.GUI.TextBlock(e+"_button",i);return h.textWrapping=!0,h.textHorizontalAlignment=t.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER,o.addControl(h),o},r})(e.Rectangle);e.Button=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(e){var r=(function(e){function r(i){var r=e.call(this,i)||this;return r.name=i,r._value=t.Color3.Red(),r._tmpColor=new t.Color3,r._pointerStartedOnSquare=!1,r._pointerStartedOnWheel=!1,r._squareLeft=0,r._squareTop=0,r._squareSize=0,r._h=360,r._s=1,r._v=1,r.onValueChangedObservable=new t.Observable,r._pointerIsDown=!1,r.value=new t.Color3(.88,.1,.1),r.size="200px",r.isPointerBlocker=!0,r}return i(r,e),Object.defineProperty(r.prototype,"value",{get:function(){return this._value},set:function(t){this._value.equals(t)||(this._value.copyFrom(t),this._RGBtoHSV(this._value,this._tmpColor),this._h=this._tmpColor.r,this._s=Math.max(this._tmpColor.g,1e-5),this._v=Math.max(this._tmpColor.b,1e-5),this._markAsDirty(),this.onValueChangedObservable.notifyObservers(this._value))},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"width",{set:function(t){this._width.toString(this._host)!==t&&this._width.fromString(t)&&(this._height.fromString(t),this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"height",{set:function(t){this._height.toString(this._host)!==t&&this._height.fromString(t)&&(this._width.fromString(t),this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"size",{get:function(){return this.width},set:function(t){this.width=t},enumerable:!0,configurable:!0}),r.prototype._getTypeName=function(){return"ColorPicker"},r.prototype._updateSquareProps=function(){var t=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),e=.2*t,i=2*(t-e),r=i/Math.sqrt(2),n=t-.5*r;this._squareLeft=this._currentMeasure.left+n,this._squareTop=this._currentMeasure.top+n,this._squareSize=r},r.prototype._drawGradientSquare=function(t,e,i,r,n,o){var s=o.createLinearGradient(e,i,r+e,i);s.addColorStop(0,"#fff"),s.addColorStop(1,"hsl("+t+", 100%, 50%)"),o.fillStyle=s,o.fillRect(e,i,r,n);var h=o.createLinearGradient(e,i,e,n+i);h.addColorStop(0,"rgba(0,0,0,0)"),h.addColorStop(1,"#000"),o.fillStyle=h,o.fillRect(e,i,r,n)},r.prototype._drawCircle=function(t,e,i,r){r.beginPath(),r.arc(t,e,i+1,0,2*Math.PI,!1),r.lineWidth=3,r.strokeStyle="#333333",r.stroke(),r.beginPath(),r.arc(t,e,i,0,2*Math.PI,!1),r.lineWidth=3,r.strokeStyle="#ffffff",r.stroke()},r.prototype._createColorWheelCanvas=function(t,e){var i=document.createElement("canvas");i.width=2*t,i.height=2*t;for(var r=i.getContext("2d"),n=r.getImageData(0,0,2*t,2*t),o=n.data,s=this._tmpColor,h=t*t,a=t-e,l=a*a,u=-t;u<t;u++)for(var c=-t;c<t;c++){var _=u*u+c*c;if(!(_>h||_<l)){var f=Math.sqrt(_),d=Math.atan2(c,u);this._HSVtoRGB(180*d/Math.PI+180,f/t,1,s);var p=4*(u+t+2*(c+t)*t);o[p]=255*s.r,o[p+1]=255*s.g,o[p+2]=255*s.b;var g=(f-a)/(t-a),m=.2;m=t<50?.2:t>150?.04:-.16*(t-50)/100+.2;var g=(f-a)/(t-a);o[p+3]=g<m?g/m*255:g>1-m?255*(1-(g-(1-m))/m):255}}return r.putImageData(n,0,0),i},r.prototype._RGBtoHSV=function(t,e){var i=t.r,r=t.g,n=t.b,o=Math.max(i,r,n),s=Math.min(i,r,n),h=0,a=0,l=o,u=o-s;0!==o&&(a=u/o),o!=s&&(o==i?(h=(r-n)/u,r<n&&(h+=6)):o==r?h=(n-i)/u+2:o==n&&(h=(i-r)/u+4),h*=60),e.r=h,e.g=a,e.b=l},r.prototype._HSVtoRGB=function(t,e,i,r){var n=i*e,o=t/60,s=n*(1-Math.abs(o%2-1)),h=0,a=0,l=0;o>=0&&o<=1?(h=n,a=s):o>=1&&o<=2?(h=s,a=n):o>=2&&o<=3?(a=n,l=s):o>=3&&o<=4?(a=s,l=n):o>=4&&o<=5?(h=s,l=n):o>=5&&o<=6&&(h=n,l=s);var u=i-n;r.set(h+u,a+u,l+u)},r.prototype._draw=function(t,e){if(e.save(),this._applyStates(e),this._processMeasures(t,e)){var i=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),r=.2*i,n=this._currentMeasure.left,o=this._currentMeasure.top;this._colorWheelCanvas&&this._colorWheelCanvas.width==2*i||(this._colorWheelCanvas=this._createColorWheelCanvas(i,r)),this._updateSquareProps(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY,e.fillRect(this._squareLeft,this._squareTop,this._squareSize,this._squareSize)),e.drawImage(this._colorWheelCanvas,n,o),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),this._drawGradientSquare(this._h,this._squareLeft,this._squareTop,this._squareSize,this._squareSize,e);var s=this._squareLeft+this._squareSize*this._s,h=this._squareTop+this._squareSize*(1-this._v);this._drawCircle(s,h,.04*i,e);var a=i-.5*r;s=n+i+Math.cos((this._h-180)*Math.PI/180)*a,h=o+i+Math.sin((this._h-180)*Math.PI/180)*a,this._drawCircle(s,h,.35*r,e)}e.restore()},r.prototype._updateValueFromPointer=function(t,e){if(this._pointerStartedOnWheel){var i=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),r=i+this._currentMeasure.left,n=i+this._currentMeasure.top;this._h=180*Math.atan2(e-n,t-r)/Math.PI+180}else this._pointerStartedOnSquare&&(this._updateSquareProps(),this._s=(t-this._squareLeft)/this._squareSize,this._v=1-(e-this._squareTop)/this._squareSize,this._s=Math.min(this._s,1),this._s=Math.max(this._s,1e-5),this._v=Math.min(this._v,1),this._v=Math.max(this._v,1e-5));this._HSVtoRGB(this._h,this._s,this._v,this._tmpColor),this.value=this._tmpColor},r.prototype._isPointOnSquare=function(t){this._updateSquareProps();var e=this._squareLeft,i=this._squareTop,r=this._squareSize;return t.x>=e&&t.x<=e+r&&t.y>=i&&t.y<=i+r},r.prototype._isPointOnWheel=function(t){var e=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),i=e+this._currentMeasure.left,r=e+this._currentMeasure.top,n=.2*e,o=e-n,s=e*e,h=o*o,a=t.x-i,l=t.y-r,u=a*a+l*l;return u<=s&&u>=h},r.prototype._onPointerDown=function(t,i,r,n){return!!e.prototype._onPointerDown.call(this,t,i,r,n)&&(this._pointerIsDown=!0,this._pointerStartedOnSquare=!1,this._pointerStartedOnWheel=!1,this._isPointOnSquare(i)?this._pointerStartedOnSquare=!0:this._isPointOnWheel(i)&&(this._pointerStartedOnWheel=!0),this._updateValueFromPointer(i.x,i.y),this._host._capturingControl[r]=this,!0)},r.prototype._onPointerMove=function(t,i){this._pointerIsDown&&this._updateValueFromPointer(i.x,i.y),e.prototype._onPointerMove.call(this,t,i)},r.prototype._onPointerUp=function(t,i,r,n,o){this._pointerIsDown=!1,delete this._host._capturingControl[r],e.prototype._onPointerUp.call(this,t,i,r,n,o)},r})(e.Control);e.ColorPicker=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(e){var r=(function(r){function n(i,n){void 0===n&&(n="");var o=r.call(this,i)||this;return o.name=i,o._text="",o._placeholderText="",o._background="#222222",o._focusedBackground="#000000",o._placeholderColor="gray",o._thickness=1,o._margin=new e.ValueAndUnit(10,e.ValueAndUnit.UNITMODE_PIXEL),o._autoStretchWidth=!0,o._maxWidth=new e.ValueAndUnit(1,e.ValueAndUnit.UNITMODE_PERCENTAGE,!1),o._isFocused=!1,o._blinkIsEven=!1,o._cursorOffset=0,o.promptMessage="Please enter text:",o.onTextChangedObservable=new t.Observable,o.onFocusObservable=new t.Observable,o.onBlurObservable=new t.Observable,o.text=n,o}return i(n,r),Object.defineProperty(n.prototype,"maxWidth",{get:function(){return this._maxWidth.toString(this._host)},set:function(t){this._maxWidth.toString(this._host)!==t&&this._maxWidth.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"maxWidthInPixels",{get:function(){return this._maxWidth.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"margin",{get:function(){
  4. return this._margin.toString(this._host)},set:function(t){this._margin.toString(this._host)!==t&&this._margin.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"marginInPixels",{get:function(){return this._margin.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"autoStretchWidth",{get:function(){return this._autoStretchWidth},set:function(t){this._autoStretchWidth!==t&&(this._autoStretchWidth=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"focusedBackground",{get:function(){return this._focusedBackground},set:function(t){this._focusedBackground!==t&&(this._focusedBackground=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"placeholderColor",{get:function(){return this._placeholderColor},set:function(t){this._placeholderColor!==t&&(this._placeholderColor=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"placeholderText",{get:function(){return this._placeholderText},set:function(t){this._placeholderText!==t&&(this._placeholderText=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"text",{get:function(){return this._text},set:function(t){this._text!==t&&(this._text=t,this._markAsDirty(),this.onTextChangedObservable.notifyObservers(this))},enumerable:!0,configurable:!0}),Object.defineProperty(n.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(),this.autoStretchWidth=!1)},enumerable:!0,configurable:!0}),n.prototype.onBlur=function(){this._isFocused=!1,this._scrollLeft=null,this._cursorOffset=0,clearTimeout(this._blinkTimeout),this._markAsDirty(),this.onBlurObservable.notifyObservers(this)},n.prototype.onFocus=function(){if(this._scrollLeft=null,this._isFocused=!0,this._blinkIsEven=!1,this._cursorOffset=0,this._markAsDirty(),this.onFocusObservable.notifyObservers(this),-1!==navigator.userAgent.indexOf("Mobile")){var t=prompt(this.promptMessage);return null!==t&&(this.text=t),void(this._host.focusedControl=null)}},n.prototype._getTypeName=function(){return"InputText"},n.prototype.processKey=function(t,e){switch(t){case 32:e=" ";break;case 8:if(this._text&&this._text.length>0)if(0===this._cursorOffset)this.text=this._text.substr(0,this._text.length-1);else{var i=this._text.length-this._cursorOffset;i>0&&(this.text=this._text.slice(0,i-1)+this._text.slice(i))}return;case 46:if(this._text&&this._text.length>0){var i=this._text.length-this._cursorOffset;this.text=this._text.slice(0,i)+this._text.slice(i+1),this._cursorOffset--}return;case 13:return void(this._host.focusedControl=null);case 35:return this._cursorOffset=0,this._blinkIsEven=!1,void this._markAsDirty();case 36:return this._cursorOffset=this._text.length,this._blinkIsEven=!1,void this._markAsDirty();case 37:return this._cursorOffset++,this._cursorOffset>this._text.length&&(this._cursorOffset=this._text.length),this._blinkIsEven=!1,void this._markAsDirty();case 39:return this._cursorOffset--,this._cursorOffset<0&&(this._cursorOffset=0),this._blinkIsEven=!1,void this._markAsDirty()}if(-1===t||32===t||t>47&&t<58||t>64&&t<91||t>185&&t<193||t>218&&t<223||t>95&&t<112)if(0===this._cursorOffset)this.text+=e;else{var r=this._text.length-this._cursorOffset;this.text=this._text.slice(0,r)+e+this._text.slice(r)}},n.prototype.processKeyboard=function(t){this.processKey(t.keyCode,t.key)},n.prototype._draw=function(t,i){var r=this;if(i.save(),this._applyStates(i),this._processMeasures(t,i)){(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(i.shadowColor=this.shadowColor,i.shadowBlur=this.shadowBlur,i.shadowOffsetX=this.shadowOffsetX,i.shadowOffsetY=this.shadowOffsetY),this._isFocused?this._focusedBackground&&(i.fillStyle=this._focusedBackground,i.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)):this._background&&(i.fillStyle=this._background,i.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0),this._fontOffset||(this._fontOffset=e.Control._GetFontOffset(i.font));var n=this._currentMeasure.left+this._margin.getValueInPixel(this._host,t.width);this.color&&(i.fillStyle=this.color);var o=this._text;this._isFocused||this._text||!this._placeholderText||(o=this._placeholderText,this._placeholderColor&&(i.fillStyle=this._placeholderColor)),this._textWidth=i.measureText(o).width;var s=2*this._margin.getValueInPixel(this._host,t.width);this._autoStretchWidth&&(this.width=Math.min(this._maxWidth.getValueInPixel(this._host,t.width),this._textWidth+s)+"px");var h=this._fontOffset.ascent+(this._currentMeasure.height-this._fontOffset.height)/2,a=this._width.getValueInPixel(this._host,t.width)-s;if(i.save(),i.beginPath(),i.rect(n,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,a+2,this._currentMeasure.height),i.clip(),this._isFocused&&this._textWidth>a){var l=n-this._textWidth+a;this._scrollLeft||(this._scrollLeft=l)}else this._scrollLeft=n;if(i.fillText(o,this._scrollLeft,this._currentMeasure.top+h),this._isFocused){if(this._clickedCoordinate){var u=this._scrollLeft+this._textWidth,c=u-this._clickedCoordinate,_=0;this._cursorOffset=0;var f=0;do{this._cursorOffset&&(f=Math.abs(c-_)),this._cursorOffset++,_=i.measureText(o.substr(o.length-this._cursorOffset,this._cursorOffset)).width}while(_<c&&o.length>=this._cursorOffset);Math.abs(c-_)>f&&this._cursorOffset--,this._blinkIsEven=!1,this._clickedCoordinate=null}if(!this._blinkIsEven){var d=this.text.substr(this._text.length-this._cursorOffset),p=i.measureText(d).width,g=this._scrollLeft+this._textWidth-p;g<n?(this._scrollLeft+=n-g,g=n,this._markAsDirty()):g>n+a&&(this._scrollLeft+=n+a-g,g=n+a,this._markAsDirty()),i.fillRect(g,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,2,this._fontOffset.height)}clearTimeout(this._blinkTimeout),this._blinkTimeout=setTimeout((function(){r._blinkIsEven=!r._blinkIsEven,r._markAsDirty()}),500)}i.restore(),this._thickness&&(this.color&&(i.strokeStyle=this.color),i.lineWidth=this._thickness,i.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,this._currentMeasure.width-this._thickness,this._currentMeasure.height-this._thickness))}i.restore()},n.prototype._onPointerDown=function(t,e,i,n){return!!r.prototype._onPointerDown.call(this,t,e,i,n)&&(this._clickedCoordinate=e.x,this._host.focusedControl===this?(clearTimeout(this._blinkTimeout),this._markAsDirty(),!0):(this._host.focusedControl=this,!0))},n.prototype._onPointerUp=function(t,e,i,n,o){r.prototype._onPointerUp.call(this,t,e,i,n,o)},n.prototype.dispose=function(){r.prototype.dispose.call(this),this.onBlurObservable.clear(),this.onFocusObservable.clear(),this.onTextChangedObservable.clear()},n})(e.Control);e.InputText=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(e){var r=(function(){function t(){}return t})();e.KeyPropertySet=r;var n=(function(r){function n(){var e=null!==r&&r.apply(this,arguments)||this;return e.onKeyPressObservable=new t.Observable,e.defaultButtonWidth="40px",e.defaultButtonHeight="40px",e.defaultButtonPaddingLeft="2px",e.defaultButtonPaddingRight="2px",e.defaultButtonPaddingTop="2px",e.defaultButtonPaddingBottom="2px",e.defaultButtonColor="#DDD",e.defaultButtonBackground="#070707",e.shiftButtonColor="#7799FF",e.selectedShiftThickness=1,e.shiftState=0,e}return i(n,r),n.prototype._getTypeName=function(){return"VirtualKeyboard"},n.prototype._createKey=function(t,i){var r=this,n=e.Button.CreateSimpleButton(t,t);return n.width=i&&i.width?i.width:this.defaultButtonWidth,n.height=i&&i.height?i.height:this.defaultButtonHeight,n.color=i&&i.color?i.color:this.defaultButtonColor,n.background=i&&i.background?i.background:this.defaultButtonBackground,n.paddingLeft=i&&i.paddingLeft?i.paddingLeft:this.defaultButtonPaddingLeft,n.paddingRight=i&&i.paddingRight?i.paddingRight:this.defaultButtonPaddingRight,n.paddingTop=i&&i.paddingTop?i.paddingTop:this.defaultButtonPaddingTop,n.paddingBottom=i&&i.paddingBottom?i.paddingBottom:this.defaultButtonPaddingBottom,n.thickness=0,n.isFocusInvisible=!0,n.shadowColor=this.shadowColor,n.shadowBlur=this.shadowBlur,n.shadowOffsetX=this.shadowOffsetX,n.shadowOffsetY=this.shadowOffsetY,n.onPointerUpObservable.add((function(){r.onKeyPressObservable.notifyObservers(t)})),n},n.prototype.addKeysRow=function(t,i){var r=new e.StackPanel;r.isVertical=!1,r.isFocusInvisible=!0;for(var n=0;n<t.length;n++){var o=null;i&&i.length===t.length&&(o=i[n]),r.addControl(this._createKey(t[n],o))}this.addControl(r)},n.prototype.applyShiftState=function(t){if(this.children)for(var e=0;e<this.children.length;e++){var i=this.children[e];if(i&&i.children)for(var r=i,n=0;n<r.children.length;n++){var o=r.children[n];if(o&&o.children[0]){var s=o.children[0];"⇧"===s.text&&(o.color=t?this.shiftButtonColor:this.defaultButtonColor,o.thickness=t>1?this.selectedShiftThickness:0),s.text=t>0?s.text.toUpperCase():s.text.toLowerCase()}}}},Object.defineProperty(n.prototype,"connectedInputText",{get:function(){return this._connectedInputText},enumerable:!0,configurable:!0}),n.prototype.connect=function(t){var e=this;this.isVisible=!1,this._connectedInputText=t,this._onFocusObserver=t.onFocusObservable.add((function(){e.isVisible=!0})),this._onBlurObserver=t.onBlurObservable.add((function(){e.isVisible=!1})),this._onKeyPressObserver=this.onKeyPressObservable.add((function(t){if(e._connectedInputText){switch(t){case"⇧":return e.shiftState++,e.shiftState>2&&(e.shiftState=0),void e.applyShiftState(e.shiftState);case"←":return void e._connectedInputText.processKey(8);case"↵":return void e._connectedInputText.processKey(13)}e._connectedInputText.processKey(-1,e.shiftState?t.toUpperCase():t),1===e.shiftState&&(e.shiftState=0,e.applyShiftState(e.shiftState))}}))},n.prototype.disconnect=function(){this._connectedInputText&&(this._connectedInputText.onFocusObservable.remove(this._onFocusObserver),this._connectedInputText.onBlurObservable.remove(this._onBlurObserver),this.onKeyPressObservable.remove(this._onKeyPressObserver),this._connectedInputText=null)},n.CreateDefaultLayout=function(){var t=new n;return t.addKeysRow(["1","2","3","4","5","6","7","8","9","0","←"]),t.addKeysRow(["q","w","e","r","t","y","u","i","o","p"]),t.addKeysRow(["a","s","d","f","g","h","j","k","l",";","'","↵"]),t.addKeysRow(["⇧","z","x","c","v","b","n","m",",",".","/"]),t.addKeysRow([" "],[{width:"200px"}]),t},n})(e.StackPanel);e.VirtualKeyboard=n})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(e){var r=(function(r){function n(t){var i=r.call(this,t)||this;return i.name=t,i._lineWidth=1,i.onPointUpdate=function(){i._markAsDirty()},i.isHitTestVisible=!1,i._horizontalAlignment=e.Control.HORIZONTAL_ALIGNMENT_LEFT,i._verticalAlignment=e.Control.VERTICAL_ALIGNMENT_TOP,i._dash=[],i._points=[],i}return i(n,r),Object.defineProperty(n.prototype,"dash",{get:function(){return this._dash},set:function(t){this._dash!==t&&(this._dash=t,this._markAsDirty())},enumerable:!0,configurable:!0}),n.prototype.getAt=function(t){return this._points[t]||(this._points[t]=new e.MultiLinePoint(this)),this._points[t]},n.prototype.add=function(){for(var t=this,e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return e.map((function(e){return t.push(e)}))},n.prototype.push=function(i){var r=this.getAt(this._points.length);return null==i?r:(i instanceof t.AbstractMesh?r.mesh=i:i instanceof e.Control?r.control=i:null!=i.x&&null!=i.y&&(r.x=i.x,r.y=i.y),r)},n.prototype.remove=function(t){var i;if(t instanceof e.MultiLinePoint){if(-1===(i=this._points.indexOf(t)))return}else i=t;var r=this._points[i];r&&(r.dispose(),this._points.splice(i,1))},Object.defineProperty(n.prototype,"lineWidth",{get:function(){return this._lineWidth},set:function(t){this._lineWidth!==t&&(this._lineWidth=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"horizontalAlignment",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"verticalAlignment",{set:function(t){},enumerable:!0,configurable:!0}),n.prototype._getTypeName=function(){return"MultiLine"},n.prototype._draw=function(t,e){if(e.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),this._applyStates(e),this._processMeasures(t,e)){e.strokeStyle=this.color,e.lineWidth=this._lineWidth,e.setLineDash(this._dash),e.beginPath();var i=!0;this._points.forEach((function(t){t&&(i?(e.moveTo(t._point.x,t._point.y),i=!1):e.lineTo(t._point.x,t._point.y))})),e.stroke()}e.restore()},n.prototype._additionalProcessing=function(t,e){var i=this;this._minX=null,this._minY=null,this._maxX=null,this._maxY=null,this._points.forEach((function(t,e){t&&(t.translate(),(null==i._minX||t._point.x<i._minX)&&(i._minX=t._point.x),(null==i._minY||t._point.y<i._minY)&&(i._minY=t._point.y),(null==i._maxX||t._point.x>i._maxX)&&(i._maxX=t._point.x),(null==i._maxY||t._point.y>i._maxY)&&(i._maxY=t._point.y))})),null==this._minX&&(this._minX=0),null==this._minY&&(this._minY=0),null==this._maxX&&(this._maxX=0),null==this._maxY&&(this._maxY=0)},n.prototype._measure=function(){null!=this._minX&&null!=this._maxX&&null!=this._minY&&null!=this._maxY&&(this._currentMeasure.width=Math.abs(this._maxX-this._minX)+this._lineWidth,this._currentMeasure.height=Math.abs(this._maxY-this._minY)+this._lineWidth)},n.prototype._computeAlignment=function(t,e){null!=this._minX&&null!=this._minY&&(this._currentMeasure.left=this._minX-this._lineWidth/2,this._currentMeasure.top=this._minY-this._lineWidth/2)},n.prototype.dispose=function(){for(;this._points.length>0;)this.remove(this._points.length-1);r.prototype.dispose.call(this)},n})(e.Control);e.MultiLine=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(t){var e=(function(e){function r(t){var i=e.call(this,t)||this;return i.name=t,i._rowDefinitions=new Array,i._columnDefinitions=new Array,i._cells={},i._childControls=new Array,i}return i(r,e),Object.defineProperty(r.prototype,"children",{get:function(){return this._childControls},enumerable:!0,configurable:!0}),r.prototype.addRowDefinition=function(e,i){return void 0===i&&(i=!1),this._rowDefinitions.push(new t.ValueAndUnit(e,i?t.ValueAndUnit.UNITMODE_PIXEL:t.ValueAndUnit.UNITMODE_PERCENTAGE)),this._markAsDirty(),this},r.prototype.addColumnDefinition=function(e,i){return void 0===i&&(i=!1),this._columnDefinitions.push(new t.ValueAndUnit(e,i?t.ValueAndUnit.UNITMODE_PIXEL:t.ValueAndUnit.UNITMODE_PERCENTAGE)),this._markAsDirty(),this},r.prototype.setRowDefinition=function(e,i,r){return void 0===r&&(r=!1),e<0||e>=this._rowDefinitions.length?this:(this._rowDefinitions[e]=new t.ValueAndUnit(i,r?t.ValueAndUnit.UNITMODE_PIXEL:t.ValueAndUnit.UNITMODE_PERCENTAGE),this._markAsDirty(),this)},r.prototype.setColumnDefinition=function(e,i,r){return void 0===r&&(r=!1),e<0||e>=this._columnDefinitions.length?this:(this._columnDefinitions[e]=new t.ValueAndUnit(i,r?t.ValueAndUnit.UNITMODE_PIXEL:t.ValueAndUnit.UNITMODE_PERCENTAGE),this._markAsDirty(),this)},r.prototype._removeCell=function(t,i){if(t){e.prototype.removeControl.call(this,t);for(var r=0,n=t.children;r<n.length;r++){var o=n[r],s=this._childControls.indexOf(o);-1!==s&&this._childControls.splice(s,1)}delete this._cells[i]}},r.prototype._offsetCell=function(t,e){if(this._cells[e]){this._cells[t]=this._cells[e];for(var i=0,r=this._cells[t].children;i<r.length;i++){r[i]._tag=t}delete this._cells[e]}},r.prototype.removeColumnDefinition=function(t){if(t<0||t>=this._columnDefinitions.length)return this;for(var e=0;e<this._rowDefinitions.length;e++){var i=e+":"+t,r=this._cells[i];this._removeCell(r,i)}for(var e=0;e<this._rowDefinitions.length;e++)for(var n=t+1;n<this._columnDefinitions.length;n++){var o=e+":"+(n-1),i=e+":"+n;this._offsetCell(o,i)}return this._columnDefinitions.splice(t,1),this._markAsDirty(),this},r.prototype.removeRowDefinition=function(t){if(t<0||t>=this._rowDefinitions.length)return this;for(var e=0;e<this._columnDefinitions.length;e++){var i=t+":"+e,r=this._cells[i];this._removeCell(r,i)}for(var e=0;e<this._columnDefinitions.length;e++)for(var n=t+1;n<this._rowDefinitions.length;n++){var o=n-1+":"+e,i=n+":"+e;this._offsetCell(o,i)}return this._rowDefinitions.splice(t,1),this._markAsDirty(),this},r.prototype.addControl=function(i,r,n){void 0===r&&(r=0),void 0===n&&(n=0),0===this._rowDefinitions.length&&this.addRowDefinition(1,!1),0===this._columnDefinitions.length&&this.addColumnDefinition(1,!1);var o=Math.min(r,this._rowDefinitions.length-1),s=Math.min(n,this._columnDefinitions.length-1),h=o+":"+s,a=this._cells[h];return a||(a=new t.Container(h),this._cells[h]=a,a.horizontalAlignment=t.Control.HORIZONTAL_ALIGNMENT_LEFT,a.verticalAlignment=t.Control.VERTICAL_ALIGNMENT_TOP,e.prototype.addControl.call(this,a)),a.addControl(i),this._childControls.push(i),i._tag=h,this._markAsDirty(),this},r.prototype.removeControl=function(t){var e=this._childControls.indexOf(t);-1!==e&&this._childControls.splice(e,1);var i=this._cells[t._tag];return i&&i.removeControl(t),this._markAsDirty(),this},r.prototype._getTypeName=function(){return"Grid"},r.prototype._additionalProcessing=function(t,i){for(var r=[],n=[],o=[],s=[],h=this._currentMeasure.width,a=0,l=this._currentMeasure.height,u=0,c=0,_=0,f=this._rowDefinitions;_<f.length;_++){var d=f[_];if(d.isPixel){var p=d.getValue(this._host);l-=p,n[c]=p}else u+=d.internalValue;c++}var g=0;c=0;for(var m=0,y=this._rowDefinitions;m<y.length;m++){var d=y[m];if(s.push(g),d.isPixel)g+=d.getValue(this._host);else{var p=d.internalValue/u*l;g+=p,n[c]=p}c++}c=0;for(var b=0,v=this._columnDefinitions;b<v.length;b++){var d=v[b];if(d.isPixel){var O=d.getValue(this._host);h-=O,r[c]=O}else a+=d.internalValue;c++}var C=0;c=0;for(var P=0,w=this._columnDefinitions;P<w.length;P++){var d=w[P];if(o.push(C),d.isPixel)C+=d.getValue(this._host);else{var O=d.internalValue/a*h;C+=O,r[c]=O}c++}for(var T in this._cells)if(this._cells.hasOwnProperty(T)){var M=T.split(":"),I=parseInt(M[0]),x=parseInt(M[1]),A=this._cells[T];A.left=o[x]+"px",A.top=s[I]+"px",A.width=r[x]+"px",A.height=n[I]+"px"}e.prototype._additionalProcessing.call(this,t,i)},r.prototype.dispose=function(){e.prototype.dispose.call(this);for(var t=0,i=this._childControls;t<i.length;t++){i[t].dispose()}},r})(t.Container);t.Grid=e})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(e){var i=(function(){function i(i){var r=this;this._lastControlOver={},this._lastControlDown={},this.onPickedPointChangedObservable=new t.Observable,this._sharedMaterials={},this._scene=i||t.Engine.LastCreatedScene,this._sceneDisposeObserver=this._scene.onDisposeObservable.add((function(){r._sceneDisposeObserver=null,r._utilityLayer=null,r.dispose()})),this._utilityLayer=new t.UtilityLayerRenderer(this._scene),this._utilityLayer.onlyCheckPointerDownEvents=!1,this._utilityLayer.mainSceneTrackerPredicate=function(t){return t&&t.metadata&&t.metadata._node},this._rootContainer=new e.Container3D("RootContainer"),this._rootContainer._host=this;var n=this._utilityLayer.utilityLayerScene;this._pointerOutObserver=this._utilityLayer.onPointerOutObservable.add((function(t){r._handlePointerOut(t,!0)})),this._pointerObserver=n.onPointerObservable.add((function(t,e){r._doPicking(t)})),this._utilityLayer.utilityLayerScene.autoClear=!1,this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil=!1,new t.HemisphericLight("hemi",t.Vector3.Up(),this._utilityLayer.utilityLayerScene)}return Object.defineProperty(i.prototype,"scene",{get:function(){return this._scene},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"utilityLayer",{get:function(){return this._utilityLayer},enumerable:!0,configurable:!0}),i.prototype._handlePointerOut=function(t,e){var i=this._lastControlOver[t];i&&(i._onPointerOut(i),delete this._lastControlOver[t]),e&&this._lastControlDown[t]&&(this._lastControlDown[t].forcePointerUp(),delete this._lastControlDown[t]),this.onPickedPointChangedObservable.notifyObservers(null)},i.prototype._doPicking=function(e){if(!this._utilityLayer||!this._utilityLayer.utilityLayerScene.activeCamera)return!1;var i=e.event,r=i.pointerId||0,n=i.button,o=e.pickInfo;if(!o||!o.hit)return this._handlePointerOut(r,e.type===t.PointerEventTypes.POINTERUP),!1;var s=o.pickedMesh.metadata;return o.pickedPoint&&this.onPickedPointChangedObservable.notifyObservers(o.pickedPoint),s._processObservables(e.type,o.pickedPoint,r,n)||e.type===t.PointerEventTypes.POINTERMOVE&&(this._lastControlOver[r]&&this._lastControlOver[r]._onPointerOut(this._lastControlOver[r]),delete this._lastControlOver[r]),e.type===t.PointerEventTypes.POINTERUP&&(this._lastControlDown[i.pointerId]&&(this._lastControlDown[i.pointerId].forcePointerUp(),delete this._lastControlDown[i.pointerId]),"touch"===i.pointerType&&this._handlePointerOut(r,!1)),!0},Object.defineProperty(i.prototype,"rootContainer",{get:function(){return this._rootContainer},enumerable:!0,configurable:!0}),i.prototype.containsControl=function(t){return this._rootContainer.containsControl(t)},i.prototype.addControl=function(t){return this._rootContainer.addControl(t),this},i.prototype.removeControl=function(t){return this._rootContainer.removeControl(t),this},i.prototype.dispose=function(){this._rootContainer.dispose();for(var t in this._sharedMaterials)this._sharedMaterials.hasOwnProperty(t)&&this._sharedMaterials[t].dispose();this._sharedMaterials={},this._pointerOutObserver&&this._utilityLayer&&(this._utilityLayer.onPointerOutObservable.remove(this._pointerOutObserver),this._pointerOutObserver=null),this.onPickedPointChangedObservable.clear();var e=this._utilityLayer?this._utilityLayer.utilityLayerScene:null;e&&this._pointerObserver&&(e.onPointerObservable.remove(this._pointerObserver),this._pointerObserver=null),this._scene&&this._sceneDisposeObserver&&(this._scene.onDisposeObservable.remove(this._sceneDisposeObserver),this._sceneDisposeObserver=null),this._utilityLayer&&this._utilityLayer.dispose()},i})();e.GUI3DManager=i})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(r){var n=(function(t){function e(){var e=t.call(this)||this;return e.INNERGLOW=!1,e.BORDER=!1,e.HOVERLIGHT=!1,e.rebuild(),e}return i(e,t),e})(t.MaterialDefines);r.FluentMaterialDefines=n;var o=(function(r){function o(e,i){var n=r.call(this,e,i)||this;return n.innerGlowColorIntensity=.5,n.innerGlowColor=new t.Color3(1,1,1),n.alpha=1,n.albedoColor=new t.Color3(.3,.35,.4),n.renderBorders=!1,n.borderWidth=.5,n.edgeSmoothingValue=.02,n.borderMinValue=.1,n.renderHoverLight=!1,n.hoverRadius=1,n.hoverColor=new t.Color4(.3,.3,.3,1),n.hoverPosition=t.Vector3.Zero(),n}return i(o,r),o.prototype.needAlphaBlending=function(){return 1!==this.alpha},o.prototype.needAlphaTesting=function(){return!1},o.prototype.getAlphaTestTexture=function(){return null},o.prototype.isReadyForSubMesh=function(e,i,r){if(this.isFrozen&&this._wasPreviouslyReady&&i.effect)return!0;i._materialDefines||(i._materialDefines=new n);var o=this.getScene(),s=i._materialDefines;if(!this.checkReadyOnEveryCall&&i.effect&&s._renderId===o.getRenderId())return!0;s._areTexturesDirty&&(s.INNERGLOW=this.innerGlowColorIntensity>0,s.BORDER=this.renderBorders,s.HOVERLIGHT=this.renderHoverLight);var h=o.getEngine();if(s.isDirty){s.markAsProcessed(),o.resetCachedMaterial();var a=[t.VertexBuffer.PositionKind];a.push(t.VertexBuffer.NormalKind),a.push(t.VertexBuffer.UVKind);var l=["world","viewProjection","innerGlowColor","albedoColor","borderWidth","edgeSmoothingValue","scaleFactor","borderMinValue","hoverColor","hoverPosition","hoverRadius"],u=new Array,c=new Array;t.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:l,uniformBuffersNames:c,samplers:u,defines:s,maxSimultaneousLights:4});var _=s.toString();i.setEffect(o.getEngine().createEffect("fluent",{attributes:a,uniformsNames:l,uniformBuffersNames:c,samplers:u,defines:_,fallbacks:null,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},h))}return!(!i.effect||!i.effect.isReady())&&(s._renderId=o.getRenderId(),this._wasPreviouslyReady=!0,!0)},o.prototype.bindForSubMesh=function(e,i,r){var n=this.getScene(),o=r._materialDefines;if(o){var s=r.effect;s&&(this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),this._mustRebind(n,s)&&(this._activeEffect.setColor4("albedoColor",this.albedoColor,this.alpha),o.INNERGLOW&&this._activeEffect.setColor4("innerGlowColor",this.innerGlowColor,this.innerGlowColorIntensity),o.BORDER&&(this._activeEffect.setFloat("borderWidth",this.borderWidth),this._activeEffect.setFloat("edgeSmoothingValue",this.edgeSmoothingValue),this._activeEffect.setFloat("borderMinValue",this.borderMinValue),i.getBoundingInfo().boundingBox.extendSize.multiplyToRef(i.scaling,t.Tmp.Vector3[0]),this._activeEffect.setVector3("scaleFactor",t.Tmp.Vector3[0])),o.HOVERLIGHT&&(this._activeEffect.setDirectColor4("hoverColor",this.hoverColor),this._activeEffect.setFloat("hoverRadius",this.hoverRadius),this._activeEffect.setVector3("hoverPosition",this.hoverPosition))),this._afterBind(i,this._activeEffect))}},o.prototype.getActiveTextures=function(){return r.prototype.getActiveTextures.call(this)},o.prototype.hasTexture=function(t){return!!r.prototype.hasTexture.call(this,t)},o.prototype.dispose=function(t){r.prototype.dispose.call(this,t)},o.prototype.clone=function(e){var i=this;return t.SerializationHelper.Clone((function(){return new o(e,i.getScene())}),this)},o.prototype.serialize=function(){var e=t.SerializationHelper.Serialize(this);return e.customType="BABYLON.GUI.FluentMaterial",e},o.prototype.getClassName=function(){return"FluentMaterial"},o.Parse=function(e,i,r){return t.SerializationHelper.Parse((function(){return new o(e.name,i)}),e,i,r)},e([t.serialize(),t.expandToProperty("_markAllSubMeshesAsTexturesDirty")],o.prototype,"innerGlowColorIntensity",void 0),e([t.serializeAsColor3()],o.prototype,"innerGlowColor",void 0),e([t.serialize()],o.prototype,"alpha",void 0),e([t.serializeAsColor3()],o.prototype,"albedoColor",void 0),e([t.serialize(),t.expandToProperty("_markAllSubMeshesAsTexturesDirty")],o.prototype,"renderBorders",void 0),e([t.serialize()],o.prototype,"borderWidth",void 0),e([t.serialize()],o.prototype,"edgeSmoothingValue",void 0),e([t.serialize()],o.prototype,"borderMinValue",void 0),e([t.serialize(),t.expandToProperty("_markAllSubMeshesAsTexturesDirty")],o.prototype,"renderHoverLight",void 0),e([t.serialize()],o.prototype,"hoverRadius",void 0),e([t.serializeAsColor4()],o.prototype,"hoverColor",void 0),e([t.serializeAsVector3()],o.prototype,"hoverPosition",void 0),o})(t.PushMaterial);r.FluentMaterial=o})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(e){var r=(function(t){function e(e,i){void 0===i&&(i=0);var r=t.call(this,e.x,e.y,e.z)||this;return r.buttonIndex=i,r}return i(e,t),e})(t.Vector3);e.Vector3WithInfo=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(e){var i=(function(){function i(e){this.name=e,this._downCount=0,this._enterCount=-1,this._downPointerIds={},this._isVisible=!0,this.onPointerMoveObservable=new t.Observable,this.onPointerOutObservable=new t.Observable,this.onPointerDownObservable=new t.Observable,this.onPointerUpObservable=new t.Observable,this.onPointerClickObservable=new t.Observable,this.onPointerEnterObservable=new t.Observable,this._behaviors=new Array}return Object.defineProperty(i.prototype,"position",{get:function(){return this._node?this._node.position:t.Vector3.Zero()},set:function(t){this._node&&(this._node.position=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"scaling",{get:function(){return this._node?this._node.scaling:new t.Vector3(1,1,1)},set:function(t){this._node&&(this._node.scaling=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"behaviors",{get:function(){return this._behaviors},enumerable:!0,configurable:!0}),i.prototype.addBehavior=function(t){var e=this;if(-1!==this._behaviors.indexOf(t))return this;t.init();var i=this._host.scene;return i.isLoading?i.onDataLoadedObservable.addOnce((function(){t.attach(e)})):t.attach(this),this._behaviors.push(t),this},i.prototype.removeBehavior=function(t){var e=this._behaviors.indexOf(t);return-1===e?this:(this._behaviors[e].detach(),this._behaviors.splice(e,1),this)},i.prototype.getBehaviorByName=function(t){for(var e=0,i=this._behaviors;e<i.length;e++){var r=i[e];if(r.name===t)return r}return null},Object.defineProperty(i.prototype,"isVisible",{get:function(){return this._isVisible},set:function(t){if(this._isVisible!==t){this._isVisible=t;var e=this.mesh;e&&e.setEnabled(t)}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"typeName",{get:function(){return this._getTypeName()},enumerable:!0,configurable:!0}),i.prototype._getTypeName=function(){return"Control3D"},Object.defineProperty(i.prototype,"node",{get:function(){return this._node},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"mesh",{get:function(){return this._node instanceof t.AbstractMesh?this._node:null},enumerable:!0,configurable:!0}),i.prototype.linkToTransformNode=function(t){return this._node&&(this._node.parent=t),this},i.prototype._prepareNode=function(t){if(!this._node){if(this._node=this._createNode(t),!this.node)return;this._node.metadata=this,this._node.position=this.position,this._node.scaling=this.scaling;var e=this.mesh;e&&(e.isPickable=!0,this._affectMaterial(e))}},i.prototype._createNode=function(t){return null},i.prototype._affectMaterial=function(t){t.material=null},i.prototype._onPointerMove=function(t,e){this.onPointerMoveObservable.notifyObservers(e,-1,t,this)},i.prototype._onPointerEnter=function(t){return!(this._enterCount>0)&&(-1===this._enterCount&&(this._enterCount=0),this._enterCount++,this.onPointerEnterObservable.notifyObservers(this,-1,t,this),this.pointerEnterAnimation&&this.pointerEnterAnimation(),!0)},i.prototype._onPointerOut=function(t){this._enterCount=0,this.onPointerOutObservable.notifyObservers(this,-1,t,this),this.pointerOutAnimation&&this.pointerOutAnimation()},i.prototype._onPointerDown=function(t,i,r,n){return 0===this._downCount&&(this._downCount++,this._downPointerIds[r]=!0,this.onPointerDownObservable.notifyObservers(new e.Vector3WithInfo(i,n),-1,t,this),this.pointerDownAnimation&&this.pointerDownAnimation(),!0)},i.prototype._onPointerUp=function(t,i,r,n,o){this._downCount=0,delete this._downPointerIds[r],o&&(this._enterCount>0||-1===this._enterCount)&&this.onPointerClickObservable.notifyObservers(new e.Vector3WithInfo(i,n),-1,t,this),this.onPointerUpObservable.notifyObservers(new e.Vector3WithInfo(i,n),-1,t,this),this.pointerUpAnimation&&this.pointerUpAnimation()},i.prototype.forcePointerUp=function(e){if(void 0===e&&(e=null),null!==e)this._onPointerUp(this,t.Vector3.Zero(),e,0,!0);else for(var i in this._downPointerIds)this._onPointerUp(this,t.Vector3.Zero(),+i,0,!0)},i.prototype._processObservables=function(e,i,r,n){if(e===t.PointerEventTypes.POINTERMOVE){this._onPointerMove(this,i);var o=this._host._lastControlOver[r];return o&&o!==this&&o._onPointerOut(this),o!==this&&this._onPointerEnter(this),this._host._lastControlOver[r]=this,!0}
  5. return e===t.PointerEventTypes.POINTERDOWN?(this._onPointerDown(this,i,r,n),this._host._lastControlDown[r]=this,this._host._lastPickedControl=this,!0):e===t.PointerEventTypes.POINTERUP&&(this._host._lastControlDown[r]&&this._host._lastControlDown[r]._onPointerUp(this,i,r,n,!0),delete this._host._lastControlDown[r],!0)},i.prototype._disposeNode=function(){this._node&&(this._node.dispose(),this._node=null)},i.prototype.dispose=function(){this.onPointerDownObservable.clear(),this.onPointerEnterObservable.clear(),this.onPointerMoveObservable.clear(),this.onPointerOutObservable.clear(),this.onPointerUpObservable.clear(),this.onPointerClickObservable.clear(),this._disposeNode();for(var t=0,e=this._behaviors;t<e.length;t++){e[t].detach()}},i})();e.Control3D=i})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(e){var r=(function(e){function r(t){var i=e.call(this,t)||this;return i._blockLayout=!1,i._children=new Array,i}return i(r,e),Object.defineProperty(r.prototype,"children",{get:function(){return this._children},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"blockLayout",{get:function(){return this._blockLayout},set:function(t){this._blockLayout!==t&&(this._blockLayout=t,this._blockLayout||this._arrangeChildren())},enumerable:!0,configurable:!0}),r.prototype.containsControl=function(t){return-1!==this._children.indexOf(t)},r.prototype.addControl=function(t){return-1!==this._children.indexOf(t)?this:(t.parent=this,t._host=this._host,this._children.push(t),this._host.utilityLayer&&(t._prepareNode(this._host.utilityLayer.utilityLayerScene),t.node&&(t.node.parent=this.node),this.blockLayout||this._arrangeChildren()),this)},r.prototype._arrangeChildren=function(){},r.prototype._createNode=function(e){return new t.TransformNode("ContainerNode",e)},r.prototype.removeControl=function(t){var e=this._children.indexOf(t);return-1!==e&&(this._children.splice(e,1),t.parent=null,t._disposeNode()),this},r.prototype._getTypeName=function(){return"Container3D"},r.prototype.dispose=function(){for(var t=0,i=this._children;t<i.length;t++){i[t].dispose()}this._children=[],e.prototype.dispose.call(this)},r.UNSET_ORIENTATION=0,r.FACEORIGIN_ORIENTATION=1,r.FACEORIGINREVERSED_ORIENTATION=2,r.FACEFORWARD_ORIENTATION=3,r.FACEFORWARDREVERSED_ORIENTATION=4,r})(e.Control3D);e.Container3D=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(e){var r=(function(e){function r(t){return e.call(this,t)||this}return i(r,e),r.prototype._getTypeName=function(){return"AbstractButton3D"},r.prototype._createNode=function(e){return new t.TransformNode("button"+this.name)},r})(e.Control3D);e.AbstractButton3D=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(e){var r=(function(e){function r(i){var r=e.call(this,i)||this;return r._contentResolution=512,r._contentScaleRatio=2,r.pointerEnterAnimation=function(){r.mesh&&(r._currentMaterial.emissiveColor=t.Color3.Red())},r.pointerOutAnimation=function(){r._currentMaterial.emissiveColor=t.Color3.Black()},r.pointerDownAnimation=function(){r.mesh&&r.mesh.scaling.scaleInPlace(.95)},r.pointerUpAnimation=function(){r.mesh&&r.mesh.scaling.scaleInPlace(1/.95)},r}return i(r,e),Object.defineProperty(r.prototype,"contentResolution",{get:function(){return this._contentResolution},set:function(t){this._contentResolution!==t&&(this._contentResolution=t,this._resetContent())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"contentScaleRatio",{get:function(){return this._contentScaleRatio},set:function(t){this._contentScaleRatio!==t&&(this._contentScaleRatio=t,this._resetContent())},enumerable:!0,configurable:!0}),r.prototype._disposeFacadeTexture=function(){this._facadeTexture&&(this._facadeTexture.dispose(),this._facadeTexture=null)},r.prototype._resetContent=function(){this._disposeFacadeTexture(),this.content=this._content},Object.defineProperty(r.prototype,"content",{get:function(){return this._content},set:function(e){this._content=e,this._host&&this._host.utilityLayer&&(this._facadeTexture||(this._facadeTexture=new t.GUI.AdvancedDynamicTexture("Facade",this._contentResolution,this._contentResolution,this._host.utilityLayer.utilityLayerScene,!0,t.Texture.TRILINEAR_SAMPLINGMODE),this._facadeTexture.rootContainer.scaleX=this._contentScaleRatio,this._facadeTexture.rootContainer.scaleY=this._contentScaleRatio,this._facadeTexture.premulAlpha=!0),this._facadeTexture.addControl(e),this._applyFacade(this._facadeTexture))},enumerable:!0,configurable:!0}),r.prototype._applyFacade=function(t){this._currentMaterial.emissiveTexture=t},r.prototype._getTypeName=function(){return"Button3D"},r.prototype._createNode=function(e){for(var i=new Array(6),r=0;r<6;r++)i[r]=new t.Vector4(0,0,0,0);return i[1]=new t.Vector4(0,0,1,1),t.MeshBuilder.CreateBox(this.name+"_rootMesh",{width:1,height:1,depth:.08,faceUV:i},e)},r.prototype._affectMaterial=function(e){var i=new t.StandardMaterial(this.name+"Material",e.getScene());i.specularColor=t.Color3.Black(),e.material=i,this._currentMaterial=i,this._resetContent()},r.prototype.dispose=function(){e.prototype.dispose.call(this),this._disposeFacadeTexture(),this._currentMaterial&&this._currentMaterial.dispose()},r})(e.AbstractButton3D);e.Button3D=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(t){var e=(function(t){function e(e,i){var r=t.call(this,i)||this;return r._currentMesh=e,r.pointerEnterAnimation=function(){r.mesh&&r.mesh.scaling.scaleInPlace(1.1)},r.pointerOutAnimation=function(){r.mesh&&r.mesh.scaling.scaleInPlace(1/1.1)},r.pointerDownAnimation=function(){r.mesh&&r.mesh.scaling.scaleInPlace(.95)},r.pointerUpAnimation=function(){r.mesh&&r.mesh.scaling.scaleInPlace(1/.95)},r}return i(e,t),e.prototype._getTypeName=function(){return"MeshButton3D"},e.prototype._createNode=function(t){var e=this;return this._currentMesh.getChildMeshes().forEach((function(t){t.metadata=e})),this._currentMesh},e.prototype._affectMaterial=function(t){},e})(t.Button3D);t.MeshButton3D=e})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(e){var r=(function(r){function n(t,e){void 0===e&&(e=!0);var i=r.call(this,t)||this;return i._shareMaterials=!0,i._shareMaterials=e,i.pointerEnterAnimation=function(){i.mesh&&i._frontPlate.setEnabled(!0)},i.pointerOutAnimation=function(){i.mesh&&i._frontPlate.setEnabled(!1)},i}return i(n,r),Object.defineProperty(n.prototype,"text",{get:function(){return this._text},set:function(t){this._text!==t&&(this._text=t,this._rebuildContent())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"imageUrl",{get:function(){return this._imageUrl},set:function(t){this._imageUrl!==t&&(this._imageUrl=t,this._rebuildContent())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"backMaterial",{get:function(){return this._backMaterial},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"frontMaterial",{get:function(){return this._frontMaterial},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"plateMaterial",{get:function(){return this._plateMaterial},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"shareMaterials",{get:function(){return this._shareMaterials},enumerable:!0,configurable:!0}),n.prototype._getTypeName=function(){return"HolographicButton"},n.prototype._rebuildContent=function(){this._disposeFacadeTexture();var i=new e.StackPanel;if(i.isVertical=!0,this._imageUrl){var r=new t.GUI.Image;r.source=this._imageUrl,r.paddingTop="40px",r.height="180px",r.width="100px",r.paddingBottom="40px",i.addControl(r)}if(this._text){var n=new t.GUI.TextBlock;n.text=this._text,n.color="white",n.height="30px",n.fontSize=24,i.addControl(n)}this._frontPlate&&(this.content=i)},n.prototype._createNode=function(e){return this._backPlate=t.MeshBuilder.CreateBox(this.name+"BackMesh",{width:1,height:1,depth:.08},e),this._frontPlate=t.MeshBuilder.CreateBox(this.name+"FrontMesh",{width:1,height:1,depth:.08},e),this._frontPlate.parent=this._backPlate,this._frontPlate.position.z=-.08,this._frontPlate.isPickable=!1,this._frontPlate.setEnabled(!1),this._textPlate=r.prototype._createNode.call(this,e),this._textPlate.parent=this._backPlate,this._textPlate.position.z=-.08,this._textPlate.isPickable=!1,this._backPlate},n.prototype._applyFacade=function(t){this._plateMaterial.emissiveTexture=t,this._plateMaterial.opacityTexture=t},n.prototype._createBackMaterial=function(t){var i=this;this._backMaterial=new e.FluentMaterial(this.name+"Back Material",t.getScene()),this._backMaterial.renderHoverLight=!0,this._pickedPointObserver=this._host.onPickedPointChangedObservable.add((function(t){t?(i._backMaterial.hoverPosition=t,i._backMaterial.hoverColor.a=1):i._backMaterial.hoverColor.a=0}))},n.prototype._createFrontMaterial=function(t){this._frontMaterial=new e.FluentMaterial(this.name+"Front Material",t.getScene()),this._frontMaterial.innerGlowColorIntensity=0,this._frontMaterial.alpha=.5,this._frontMaterial.renderBorders=!0},n.prototype._createPlateMaterial=function(e){this._plateMaterial=new t.StandardMaterial(this.name+"Plate Material",e.getScene()),this._plateMaterial.specularColor=t.Color3.Black()},n.prototype._affectMaterial=function(t){this._shareMaterials?(this._host._sharedMaterials.backFluentMaterial?this._backMaterial=this._host._sharedMaterials.backFluentMaterial:(this._createBackMaterial(t),this._host._sharedMaterials.backFluentMaterial=this._backMaterial),this._host._sharedMaterials.frontFluentMaterial?this._frontMaterial=this._host._sharedMaterials.frontFluentMaterial:(this._createFrontMaterial(t),this._host._sharedMaterials.frontFluentMaterial=this._frontMaterial)):(this._createBackMaterial(t),this._createFrontMaterial(t)),this._createPlateMaterial(t),this._backPlate.material=this._backMaterial,this._frontPlate.material=this._frontMaterial,this._textPlate.material=this._plateMaterial,this._rebuildContent()},n.prototype.dispose=function(){r.prototype.dispose.call(this),this.shareMaterials||(this._backMaterial.dispose(),this._frontMaterial.dispose(),this._plateMaterial.dispose(),this._pickedPointObserver&&(this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver),this._pickedPointObserver=null))},n})(e.Button3D);e.HolographicButton=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(e){var r=(function(e){function r(t){void 0===t&&(t=!1);var i=e.call(this)||this;return i._isVertical=!1,i.margin=.1,i._isVertical=t,i}return i(r,e),Object.defineProperty(r.prototype,"isVertical",{get:function(){return this._isVertical},set:function(e){var i=this;this._isVertical!==e&&(this._isVertical=e,t.Tools.SetImmediate((function(){i._arrangeChildren()})))},enumerable:!0,configurable:!0}),r.prototype._arrangeChildren=function(){for(var e=0,i=0,r=0,n=[],o=t.Matrix.Invert(this.node.computeWorldMatrix(!0)),s=0,h=this._children;s<h.length;s++){var a=h[s];if(a.mesh){r++,a.mesh.computeWorldMatrix(!0),a.mesh.getWorldMatrix().multiplyToRef(o,t.Tmp.Matrix[0]);var l=a.mesh.getBoundingInfo().boundingBox,u=t.Vector3.TransformNormal(l.extendSize,t.Tmp.Matrix[0]);n.push(u),this._isVertical?i+=u.y:e+=u.x}}this._isVertical?i+=(r-1)*this.margin/2:e+=(r-1)*this.margin/2;var c;c=this._isVertical?-i:-e;for(var _=0,f=0,d=this._children;f<d.length;f++){var a=d[f];if(a.mesh){r--;var u=n[_++];this._isVertical?(a.position.y=c+u.y,a.position.x=0,c+=2*u.y):(a.position.x=c+u.x,a.position.y=0,c+=2*u.x),c+=r>0?this.margin:0}}},r})(e.Container3D);e.StackPanel3D=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(e){var r=(function(r){function n(){var t=r.call(this)||this;return t._columns=10,t._rows=0,t._rowThenColum=!0,t._orientation=e.Container3D.FACEORIGIN_ORIENTATION,t.margin=0,t}return i(n,r),Object.defineProperty(n.prototype,"orientation",{get:function(){return this._orientation},set:function(e){var i=this;this._orientation!==e&&(this._orientation=e,t.Tools.SetImmediate((function(){i._arrangeChildren()})))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"columns",{get:function(){return this._columns},set:function(e){var i=this;this._columns!==e&&(this._columns=e,this._rowThenColum=!0,t.Tools.SetImmediate((function(){i._arrangeChildren()})))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"rows",{get:function(){return this._rows},set:function(e){var i=this;this._rows!==e&&(this._rows=e,this._rowThenColum=!1,t.Tools.SetImmediate((function(){i._arrangeChildren()})))},enumerable:!0,configurable:!0}),n.prototype._arrangeChildren=function(){this._cellWidth=0,this._cellHeight=0;for(var e=0,i=0,r=0,n=t.Matrix.Invert(this.node.computeWorldMatrix(!0)),o=0,s=this._children;o<s.length;o++){var h=s[o];if(h.mesh){r++,h.mesh.computeWorldMatrix(!0),h.mesh.getWorldMatrix().multiplyToRef(n,t.Tmp.Matrix[0]);var a=h.mesh.getBoundingInfo().boundingBox,l=t.Vector3.TransformNormal(a.extendSize,t.Tmp.Matrix[0]);this._cellWidth=Math.max(this._cellWidth,2*l.x),this._cellHeight=Math.max(this._cellHeight,2*l.y)}}this._cellWidth+=2*this.margin,this._cellHeight+=2*this.margin,this._rowThenColum?(i=this._columns,e=Math.ceil(r/this._columns)):(e=this._rows,i=Math.ceil(r/this._rows));var u=.5*i*this._cellWidth,c=.5*e*this._cellHeight,_=[],f=0;if(this._rowThenColum)for(var d=0;d<e;d++)for(var p=0;p<i&&(_.push(new t.Vector3(p*this._cellWidth-u+this._cellWidth/2,d*this._cellHeight-c+this._cellHeight/2,0)),!(++f>r));p++);else for(var p=0;p<i;p++)for(var d=0;d<e&&(_.push(new t.Vector3(p*this._cellWidth-u+this._cellWidth/2,d*this._cellHeight-c+this._cellHeight/2,0)),!(++f>r));d++);f=0;for(var g=0,m=this._children;g<m.length;g++){var h=m[g];h.mesh&&(this._mapGridNode(h,_[f]),f++)}this._finalProcessing()},n.prototype._finalProcessing=function(){},n})(e.Container3D);e.VolumeBasedPanel=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(e){var r=(function(r){function n(){var t=null!==r&&r.apply(this,arguments)||this;return t._radius=5,t}return i(n,r),Object.defineProperty(n.prototype,"radius",{get:function(){return this._radius},set:function(e){var i=this;this._radius!==e&&(this._radius=e,t.Tools.SetImmediate((function(){i._arrangeChildren()})))},enumerable:!0,configurable:!0}),n.prototype._mapGridNode=function(i,r){var n=i.mesh;if(n){var o=this._sphericalMapping(r);switch(i.position=o,this.orientation){case e.Container3D.FACEORIGIN_ORIENTATION:n.lookAt(new t.Vector3(-o.x,-o.y,-o.z));break;case e.Container3D.FACEORIGINREVERSED_ORIENTATION:n.lookAt(new t.Vector3(o.x,o.y,o.z));break;case e.Container3D.FACEFORWARD_ORIENTATION:n.lookAt(new t.Vector3(0,0,1));break;case e.Container3D.FACEFORWARDREVERSED_ORIENTATION:n.lookAt(new t.Vector3(0,0,-1))}}},n.prototype._sphericalMapping=function(e){var i=new t.Vector3(0,0,this._radius),r=e.y/this._radius,n=-e.x/this._radius;return t.Matrix.RotationYawPitchRollToRef(n,r,0,t.Tmp.Matrix[0]),t.Vector3.TransformNormal(i,t.Tmp.Matrix[0])},n})(e.VolumeBasedPanel);e.SpherePanel=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(e){var r=(function(r){function n(){return null!==r&&r.apply(this,arguments)||this}return i(n,r),n.prototype._mapGridNode=function(i,r){var n=i.mesh;if(n)switch(i.position=r.clone(),this.orientation){case e.Container3D.FACEORIGIN_ORIENTATION:case e.Container3D.FACEFORWARD_ORIENTATION:n.lookAt(new t.Vector3(0,0,-1));break;case e.Container3D.FACEFORWARDREVERSED_ORIENTATION:case e.Container3D.FACEORIGINREVERSED_ORIENTATION:n.lookAt(new t.Vector3(0,0,1))}},n})(e.VolumeBasedPanel);e.PlanePanel=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t;!(function(t){!(function(e){var r=(function(r){function n(){var t=null!==r&&r.apply(this,arguments)||this;return t._iteration=100,t}return i(n,r),Object.defineProperty(n.prototype,"iteration",{get:function(){return this._iteration},set:function(e){var i=this;this._iteration!==e&&(this._iteration=e,t.Tools.SetImmediate((function(){i._arrangeChildren()})))},enumerable:!0,configurable:!0}),n.prototype._mapGridNode=function(i,r){var n=i.mesh,o=this._scatterMapping(r);if(n){switch(this.orientation){case e.Container3D.FACEORIGIN_ORIENTATION:case e.Container3D.FACEFORWARD_ORIENTATION:n.lookAt(new t.Vector3(0,0,-1));break;case e.Container3D.FACEFORWARDREVERSED_ORIENTATION:case e.Container3D.FACEORIGINREVERSED_ORIENTATION:n.lookAt(new t.Vector3(0,0,1))}i.position=o}},n.prototype._scatterMapping=function(t){return t.x=(1-2*Math.random())*this._cellWidth,t.y=(1-2*Math.random())*this._cellHeight,t},n.prototype._finalProcessing=function(){for(var e=[],i=0,r=this._children;i<r.length;i++){var n=r[i];n.mesh&&e.push(n.mesh)}for(var o=0;o<this._iteration;o++){e.sort((function(t,e){var i=t.position.lengthSquared(),r=e.position.lengthSquared();return i<r?1:i>r?-1:0}));for(var s=Math.pow(this.margin,2),h=Math.max(this._cellWidth,this._cellHeight),a=t.Tmp.Vector2[0],l=t.Tmp.Vector3[0],u=0;u<e.length-1;u++)for(var c=u+1;c<e.length;c++)if(u!=c){e[c].position.subtractToRef(e[u].position,l),a.x=l.x,a.y=l.y;var _=h,f=a.lengthSquared()-s,d=Math.min(f,s);f-=d,f<Math.pow(_,2)&&(a.normalize(),l.scaleInPlace(.5*(_-Math.sqrt(f))),e[c].position.addInPlace(l),e[u].position.subtractInPlace(l))}}},n})(e.VolumeBasedPanel);e.ScatterPanel=r})(t.GUI||(t.GUI={}))})(t||(t={}));var t;return (function(t){!(function(e){var r=(function(r){function n(){var t=null!==r&&r.apply(this,arguments)||this;return t._radius=5,t}return i(n,r),Object.defineProperty(n.prototype,"radius",{get:function(){return this._radius},set:function(e){var i=this;this._radius!==e&&(this._radius=e,t.Tools.SetImmediate((function(){i._arrangeChildren()})))},enumerable:!0,configurable:!0}),n.prototype._mapGridNode=function(i,r){var n=i.mesh;if(n){var o=this._cylindricalMapping(r);switch(i.position=o,this.orientation){case e.Container3D.FACEORIGIN_ORIENTATION:n.lookAt(new t.Vector3(-o.x,0,-o.z));break;case e.Container3D.FACEORIGINREVERSED_ORIENTATION:n.lookAt(new t.Vector3(o.x,0,o.z));break;case e.Container3D.FACEFORWARD_ORIENTATION:n.lookAt(new t.Vector3(0,0,1));break;case e.Container3D.FACEFORWARDREVERSED_ORIENTATION:n.lookAt(new t.Vector3(0,0,-1))}}},n.prototype._cylindricalMapping=function(e){var i=new t.Vector3(0,e.y,this._radius),r=e.x/this._radius;return t.Matrix.RotationYawPitchRollToRef(r,0,0,t.Tmp.Matrix[0]),t.Vector3.TransformNormal(i,t.Tmp.Matrix[0])},n})(e.VolumeBasedPanel);e.CylinderPanel=r})(t.GUI||(t.GUI={}))})(t||(t={})),t.GUI}));