babylon.gui.min.js 23 KB

1
  1. var BABYLON;!(function(t){!(function(e){var i=(function(i){function r(r,n,s,o,h,a){void 0===n&&(n=0),void 0===s&&(s=0),void 0===h&&(h=!1),void 0===a&&(a=t.Texture.NEAREST_SAMPLINGMODE);var u=i.call(this,r,{width:n,height:s},o,h,a,t.Engine.TEXTUREFORMAT_RGBA)||this;return u._isDirty=!1,u._rootContainer=new e.Container("root"),u._renderObserver=u.getScene().onBeforeRenderObservable.add((function(){return u._checkUpdate()})),u._rootContainer._link(null,u),u.hasAlpha=!0,n&&s||(u._resizeObserver=u.getScene().getEngine().onResizeObservable.add((function(){return u._onResize()})),u._onResize()),u}return __extends(r,i),Object.defineProperty(r.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this.markAsDirty())},enumerable:!0,configurable:!0}),r.prototype.markAsDirty=function(){this._isDirty=!0},r.prototype.addControl=function(t){return this._rootContainer.addControl(t),this},r.prototype.removeControl=function(t){return this._rootContainer.removeControl(t),this},r.prototype.dispose=function(){this.getScene().onBeforeRenderObservable.remove(this._renderObserver),this._resizeObserver&&this.getScene().getEngine().onResizeObservable.remove(this._resizeObserver),this._pointerMoveObserver&&this.getScene().onPointerObservable.remove(this._pointerMoveObserver),i.prototype.dispose.call(this)},r.prototype._onResize=function(){var t=this.getScene().getEngine(),e=this.getSize(),i=t.getRenderWidth(),r=t.getRenderHeight();e.width===i&&e.height===r||(this.scaleTo(i,r),this.markAsDirty())},r.prototype._checkUpdate=function(){(this._isDirty||this._rootContainer.isDirty)&&(this._isDirty=!1,this._render(),this.update())},r.prototype._render=function(){var t=this.getSize(),i=t.width,r=t.height,n=this.getContext();n.clearRect(0,0,i,r),this._background&&(n.save(),n.fillStyle=this._background,n.fillRect(0,0,i,r),n.restore());var s=new e.Measure(0,0,i,r);this._rootContainer._draw(s,n)},r.prototype._doPicking=function(e,i,r){this._rootContainer._processPicking(e,i,r)||r===t.PointerEventTypes.POINTERMOVE&&(this._lastControlOver&&this._lastControlOver.onPointerOutObservable.hasObservers()&&this._lastControlOver.onPointerOutObservable.notifyObservers(this._lastControlOver),this._lastControlOver=null)},r.prototype.attach=function(){var e=this,i=this.getScene();this._pointerMoveObserver=i.onPointerObservable.add((function(r,n){r.type!==t.PointerEventTypes.POINTERMOVE&&r.type!==t.PointerEventTypes.POINTERUP&&r.type!==t.PointerEventTypes.POINTERDOWN||e._doPicking(i.pointerX,i.pointerY,r.type)}))},r.CreateForMesh=function(e,i,n){void 0===i&&(i=1024),void 0===n&&(n=1024);var s=new r(e.name+" AdvancedDynamicTexture",i,n,e.getScene(),!0,t.Texture.TRILINEAR_SAMPLINGMODE),o=new t.StandardMaterial("AdvancedDynamicTextureMaterial",e.getScene());return o.backFaceCulling=!1,o.emissiveTexture=s,o.opacityTexture=s,e.material=o,s},r.CreateFullscreenUI=function(e,i,n){void 0===i&&(i=!0);var s=new r(e,0,0,n);return new t.Layer(e+"_layer",null,n,!i).texture=s,s.attach(),s},r})(t.DynamicTexture);e.AdvancedDynamicTexture=i})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var BABYLON;!(function(t){!(function(t){var e=(function(){function t(t,e,i,r){this.left=t,this.top=e,this.width=i,this.height=r}return t.prototype.copyFrom=function(t){this.left=t.left,this.top=t.top,this.width=t.width,this.height=t.height},t.prototype.isEqualsTo=function(t){return this.left===t.left&&(this.top===t.top&&(this.width===t.width&&this.height===t.height))},t.Empty=function(){return new t(0,0,0,0)},t})();t.Measure=e})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var BABYLON;!(function(t){!(function(t){var e=(function(){function t(e,i,r){void 0===e&&(e=1),void 0===i&&(i=t.UNITMODE_PERCENTAGE),void 0===r&&(r=!0),this.value=e,this.unit=i,this.negativeValueAllowed=r}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}),t.prototype.toString=function(){switch(this.unit){case t.UNITMODE_PERCENTAGE:return this.unit+"%";case t.UNITMODE_PIXEL:return this.unit+"px"}return this.unit.toString()},t.prototype.fromString=function(e){var i=t._Regex.exec(e);if(!i||0===i.length)return!1;var r=parseFloat(i[1]),n=this.unit;if(this.negativeValueAllowed||r<0&&(r=0),4===i.length)switch(i[3]){case"px":n=t.UNITMODE_PIXEL;break;case"%":n=t.UNITMODE_PERCENTAGE,r/=100}return(r!==this.value||n!==this.unit)&&(this.value=r,this.unit=n,!0)},Object.defineProperty(t,"UNITMODE_PERCENTAGE",{get:function(){return t._UNITMODE_PERCENTAGE},enumerable:!0,configurable:!0}),Object.defineProperty(t,"UNITMODE_PIXEL",{get:function(){return t._UNITMODE_PIXEL},enumerable:!0,configurable:!0}),t})();e._Regex=/(^-?\d*(\.\d+)?)(%|px)?/,e._UNITMODE_PERCENTAGE=0,e._UNITMODE_PIXEL=1,t.ValueAndUnit=e})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var BABYLON;!(function(t){!(function(e){var i=(function(){function i(r){this.name=r,this._zIndex=0,this._currentMeasure=e.Measure.Empty(),this._fontSize=18,this._width=new e.ValueAndUnit(1,e.ValueAndUnit.UNITMODE_PERCENTAGE,!1),this._height=new e.ValueAndUnit(1,e.ValueAndUnit.UNITMODE_PERCENTAGE,!1),this._horizontalAlignment=i.HORIZONTAL_ALIGNMENT_CENTER,this._verticalAlignment=i.VERTICAL_ALIGNMENT_CENTER,this._isDirty=!0,this._cachedParentMeasure=e.Measure.Empty(),this._marginLeft=new e.ValueAndUnit(0),this._marginRight=new e.ValueAndUnit(0),this._marginTop=new e.ValueAndUnit(0),this._marginBottom=new e.ValueAndUnit(0),this._left=new e.ValueAndUnit(0),this._top=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.fontFamily="Arial"}return 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()},set:function(t){this._width.toString()!==t&&this._width.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"height",{get:function(){return this._height.toString()},set:function(t){this._height.toString()!==t&&this._height.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(t){this._fontFamily!==t&&(this._fontFamily=t,this._prepareFont())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"fontSize",{get:function(){return this._fontSize},set:function(t){this._fontSize!==t&&(this._fontSize=t,this._prepareFont())},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._reOrderControl(this))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isDirty",{get:function(){return this._isDirty},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"marginLeft",{get:function(){return this._marginLeft.toString()},set:function(t){this._marginLeft.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"marginRight",{get:function(){return this._marginRight.toString()},set:function(t){this._marginRight.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"marginTop",{get:function(){return this._marginTop.toString()},set:function(t){this._marginTop.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"marginBottom",{get:function(){return this._marginBottom.toString()},set:function(t){this._marginBottom.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"left",{get:function(){return this._left.toString()},set:function(t){this._left.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"top",{get:function(){return this._top.toString()},set:function(t){this._top.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),i.prototype._markAsDirty=function(){this._isDirty=!0,this._host&&this._host.markAsDirty()},i.prototype._link=function(t,e){this._root=t,this._host=e},i.prototype.applyStates=function(t){this._font&&(t.font=this._font),this._color&&(t.fillStyle=this._color)},i.prototype._processMeasures=function(t,e){!this._isDirty&&this._cachedParentMeasure.isEqualsTo(t)||(this._currentMeasure.copyFrom(t),this._measure(t,e),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._isDirty=!1,this._cachedParentMeasure.copyFrom(t)),this._clip(e),e.clip()},i.prototype._clip=function(t){t.beginPath(),t.rect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)},i.prototype._measure=function(t,e){this._width.isPixel?this._currentMeasure.width=this._width.value:this._currentMeasure.width*=this._width.value,this._height.isPixel?this._currentMeasure.height=this._height.value:this._currentMeasure.height*=this._height.value},i.prototype._computeAlignment=function(t,e){var r=this._currentMeasure.width,n=this._currentMeasure.height,s=t.width,o=t.height,h=0,a=0;switch(this.horizontalAlignment){case i.HORIZONTAL_ALIGNMENT_LEFT:h=0;break;case i.HORIZONTAL_ALIGNMENT_RIGHT:h=s-r;break;case i.HORIZONTAL_ALIGNMENT_CENTER:h=(s-r)/2}switch(this.verticalAlignment){case i.VERTICAL_ALIGNMENT_TOP:a=0;break;case i.VERTICAL_ALIGNMENT_BOTTOM:a=o-n;break;case i.VERTICAL_ALIGNMENT_CENTER:a=(o-n)/2}this._marginLeft.isPixel?(this._currentMeasure.left+=this._marginLeft.value,this._currentMeasure.width-=this._marginRight.value):(this._currentMeasure.left+=s*this._marginLeft.value,this._currentMeasure.width-=s*this._marginLeft.value),this._marginRight.isPixel?this._currentMeasure.width-=this._marginRight.value:this._currentMeasure.width-=s*this._marginRight.value,this._marginTop.isPixel?(this._currentMeasure.top+=this._marginTop.value,this._currentMeasure.height-=this._marginTop.value):(this._currentMeasure.top+=o*this._marginTop.value,this._currentMeasure.height-=o*this._marginTop.value),this._marginBottom.isPixel?this._currentMeasure.height-=this._marginBottom.value:this._currentMeasure.height-=o*this._marginBottom.value,this._left.isPixel?this._currentMeasure.left+=this._left.value:this._currentMeasure.left+=s*this._left.value,this._top.isPixel?this._currentMeasure.top+=this._top.value:this._currentMeasure.top+=o*this._top.value,this._currentMeasure.left+=h,this._currentMeasure.top+=a},i.prototype._additionalProcessing=function(t,e){},i.prototype._draw=function(t,e){},i.prototype._contains=function(t,e){return!(t<this._currentMeasure.left)&&(!(t>this._currentMeasure.left+this._currentMeasure.width)&&(!(e<this._currentMeasure.top)&&!(e>this._currentMeasure.top+this._currentMeasure.height)))},i.prototype._processPicking=function(t,e,i){return!!this._contains(t,e)&&(this._processObservables(i),!0)},i.prototype._processObservables=function(e){if(e===t.PointerEventTypes.POINTERMOVE&&this.onPointerMoveObservable.hasObservers()){this.onPointerMoveObservable.notifyObservers(this);var i=this._host._lastControlOver;return i&&i!==this&&i.onPointerOutObservable.hasObservers()&&i.onPointerOutObservable.notifyObservers(i),this._host._lastControlOver=this,!0}return e===t.PointerEventTypes.POINTERDOWN&&this.onPointerDownObservable.hasObservers()?(this.onPointerDownObservable.notifyObservers(this),!0):!(e!==t.PointerEventTypes.POINTERUP||!this.onPointerUpObservable.hasObservers())&&(this.onPointerUpObservable.notifyObservers(this),!0)},i.prototype._prepareFont=function(){this._fontFamily&&(this._font=this._fontSize+"px "+this._fontFamily,this._fontOffset=i._GetFontOffset(this._font),this._markAsDirty())},Object.defineProperty(i,"HORIZONTAL_ALIGNMENT_LEFT",{get:function(){return i._HORIZONTAL_ALIGNMENT_LEFT},enumerable:!0,configurable:!0}),Object.defineProperty(i,"HORIZONTAL_ALIGNMENT_RIGHT",{get:function(){return i._HORIZONTAL_ALIGNMENT_RIGHT},enumerable:!0,configurable:!0}),Object.defineProperty(i,"HORIZONTAL_ALIGNMENT_CENTER",{get:function(){return i._HORIZONTAL_ALIGNMENT_CENTER},enumerable:!0,configurable:!0}),Object.defineProperty(i,"VERTICAL_ALIGNMENT_TOP",{get:function(){return i._VERTICAL_ALIGNMENT_TOP},enumerable:!0,configurable:!0}),Object.defineProperty(i,"VERTICAL_ALIGNMENT_BOTTOM",{get:function(){return i._VERTICAL_ALIGNMENT_BOTTOM},enumerable:!0,configurable:!0}),Object.defineProperty(i,"VERTICAL_ALIGNMENT_CENTER",{get:function(){return i._VERTICAL_ALIGNMENT_CENTER},enumerable:!0,configurable:!0}),i._GetFontOffset=function(t){if(i._FontHeightSizes[t])return i._FontHeightSizes[t];var e=document.createElement("span");e.innerHTML="Hg",e.style.font=t;var r=document.createElement("div");r.style.display="inline-block",r.style.width="1px",r.style.height="0px",r.style.verticalAlign="bottom";var n=document.createElement("div");n.appendChild(e),n.appendChild(r),document.body.appendChild(n);var s=0,o=0;try{o=r.getBoundingClientRect().top-e.getBoundingClientRect().top,r.style.verticalAlign="baseline",s=r.getBoundingClientRect().top-e.getBoundingClientRect().top}finally{n.remove()}var h={ascent:s,height:o,descent:o-s};return i._FontHeightSizes[t]=h,h},i})();i._HORIZONTAL_ALIGNMENT_LEFT=0,i._HORIZONTAL_ALIGNMENT_RIGHT=1,i._HORIZONTAL_ALIGNMENT_CENTER=2,i._VERTICAL_ALIGNMENT_TOP=0,i._VERTICAL_ALIGNMENT_BOTTOM=1,i._VERTICAL_ALIGNMENT_CENTER=2,i._FontHeightSizes={},e.Control=i})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var BABYLON;!(function(t){!(function(t){var e=(function(e){function i(i){var r=e.call(this,i)||this;return r.name=i,r._children=new Array,r._measureForChildren=t.Measure.Empty(),r}return __extends(i,e),i.prototype.addControl=function(t){return this._children.indexOf(t)!==-1?this:(t._link(this,this._host),this._reOrderControl(t),this._markAsDirty(),this)},i.prototype.removeControl=function(t){var e=this._children.indexOf(t);return e!==-1&&this._children.splice(e,1),this._markAsDirty(),this},i.prototype._reOrderControl=function(t){this.removeControl(t);for(var e=0;e<this._children.length;e++)if(this._children[e].zIndex>t.zIndex)return void this._children.splice(e,0,t);this._children.push(t),this._markAsDirty()},i.prototype._localDraw=function(t){},i.prototype._draw=function(t,i){i.save(),e.prototype._processMeasures.call(this,t,i),this.applyStates(i),this._localDraw(i),this._clipForChildren(i);for(var r=0,n=this._children;r<n.length;r++){n[r]._draw(this._measureForChildren,i)}i.restore()},i.prototype._processPicking=function(t,i,r){if(!e.prototype._contains.call(this,t,i))return!1;for(var n=this._children.length-1;n>=0;n--){if(this._children[n]._processPicking(t,i,r))return!0}return this._processObservables(r)},i.prototype._clipForChildren=function(t){},i.prototype._additionalProcessing=function(t,i){e.prototype._additionalProcessing.call(this,t,i),this._measureForChildren.copyFrom(this._currentMeasure)},i})(t.Control);t.Container=e})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var BABYLON;!(function(t){!(function(t){var e=(function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._thickness=1,i._cornerRadius=0,i}return __extends(e,t),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cornerRadius",{get:function(){return this._cornerRadius},set:function(t){t<0&&(t=0),this._cornerRadius!==t&&(this._cornerRadius=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!0,configurable:!0}),e.prototype._localDraw=function(t){t.save(),this._background&&(t.fillStyle=this._background,this._cornerRadius?(this._drawRoundedRect(t,this._thickness/2),t.fill()):t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),this._thickness&&(this.color&&(t.strokeStyle=this.color),t.lineWidth=this._thickness,this._cornerRadius?(this._drawRoundedRect(t,this._thickness/2),t.stroke()):t.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,this._currentMeasure.width-this._thickness,this._currentMeasure.height-this._thickness)),t.restore()},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),this._measureForChildren.width-=2*this._thickness,this._measureForChildren.height-=2*this._thickness,this._measureForChildren.left+=this._thickness,this._measureForChildren.top+=this._thickness},e.prototype._drawRoundedRect=function(t,e){void 0===e&&(e=0);var i=this._currentMeasure.left+e,r=this._currentMeasure.top+e,n=this._currentMeasure.width-2*e,s=this._currentMeasure.height-2*e,o=Math.min(s/2-2,Math.min(n/2-2,this._cornerRadius));t.beginPath(),t.moveTo(i+o,r),t.lineTo(i+n-o,r),t.quadraticCurveTo(i+n,r,i+n,r+o),t.lineTo(i+n,r+s-o),t.quadraticCurveTo(i+n,r+s,i+n-o,r+s),t.lineTo(i+o,r+s),t.quadraticCurveTo(i,r+s,i,r+s-o),t.lineTo(i,r+o),t.quadraticCurveTo(i,r,i+o,r),t.closePath()},e.prototype._clipForChildren=function(t){this._cornerRadius&&(this._drawRoundedRect(t,this._thickness),t.clip())},e})(t.Container);t.Rectangle=e})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var BABYLON;!(function(t){!(function(t){var e=(function(e){function i(i,r){var n=e.call(this,i)||this;return n.name=i,n._textWrapping=!1,n._textHorizontalAlignment=t.Control.HORIZONTAL_ALIGNMENT_CENTER,n._textVerticalAlignment=t.Control.VERTICAL_ALIGNMENT_CENTER,n.text=r,n}return __extends(i,e),Object.defineProperty(i.prototype,"textWrapping",{get:function(){return this._textWrapping},set:function(t){this._textWrapping!==t&&(this._textWrapping=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"text",{get:function(){return this._text},set:function(t){this._text!==t&&(this._text=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textHorizontalAlignment",{get:function(){return this._textHorizontalAlignment},set:function(t){this._textHorizontalAlignment!==t&&(this._textHorizontalAlignment=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"textVerticalAlignment",{get:function(){return this._textVerticalAlignment},set:function(t){this._textVerticalAlignment!==t&&(this._textVerticalAlignment=t,this._markAsDirty())},enumerable:!0,configurable:!0}),i.prototype._drawText=function(e,i,r,n){var s=this._currentMeasure.width,o=0;switch(this._textHorizontalAlignment){case t.Control.HORIZONTAL_ALIGNMENT_LEFT:o=0;break;case t.Control.HORIZONTAL_ALIGNMENT_RIGHT:o=s-i;break;case t.Control.HORIZONTAL_ALIGNMENT_CENTER:o=(s-i)/2}n.fillText(e,this._currentMeasure.left+o,r)},i.prototype._draw=function(t,i){i.save(),this.applyStates(i),e.prototype._processMeasures.call(this,t,i),this._renderLines(i),i.restore()},i.prototype._additionalProcessing=function(t,e){if(this._lines=[],this._textWrapping){for(var i=this.text.split(" "),r="",n=this._currentMeasure.width,s=0,o=0;o<i.length;o++){var h=r+i[o]+" ",a=e.measureText(h),u=a.width;u>n&&o>0?(this._lines.push({text:r,width:s}),r=i[o]+" ",s=e.measureText(r).width):(s=u,r=h)}this._lines.push({text:r,width:s})}else this._lines.push({text:this.text,width:e.measureText(this.text).width})},i.prototype._renderLines=function(e){var i=(this._currentMeasure.width,this._currentMeasure.height);this._fontOffset||(this._fontOffset=t.Control._GetFontOffset(e.font));var r=0;switch(this._textVerticalAlignment){case t.Control.VERTICAL_ALIGNMENT_TOP:r=this._fontOffset.ascent;break;case t.Control.VERTICAL_ALIGNMENT_BOTTOM:r=i-this._fontOffset.height*(this._lines.length-1)-this._fontOffset.descent;break;case t.Control.VERTICAL_ALIGNMENT_CENTER:r=this._fontOffset.ascent+(i-this._fontOffset.height*this._lines.length)/2}r+=this._currentMeasure.top;for(var n=0,s=this._lines;n<s.length;n++){var o=s[n];this._drawText(o.text,o.width,r,e),r+=this._fontOffset.height}},i})(t.Control);t.TextBlock=e})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var DOMImage=Image,BABYLON;!(function(t){!(function(t){var e=(function(t){function e(i,r){var n=t.call(this,i)||this;return n.name=i,n._loaded=!1,n._stretch=e.STRETCH_FILL,n._domImage=new DOMImage,n._domImage.onload=function(){n._imageWidth=n._domImage.width,n._imageHeight=n._domImage.height,n._loaded=!0,n._markAsDirty()},n._domImage.src=r,n}return __extends(e,t),Object.defineProperty(e.prototype,"stretch",{get:function(){return this._stretch},set:function(t){this._stretch!==t&&(this._stretch=t,this._markAsDirty())},enumerable:!0,configurable:!0}),e.prototype._draw=function(i,r){if(r.save(),this.applyStates(r),t.prototype._processMeasures.call(this,i,r),this._loaded)switch(this._stretch){case e.STRETCH_NONE:r.drawImage(this._domImage,this._currentMeasure.left,this._currentMeasure.top);break;case e.STRETCH_FILL:r.drawImage(this._domImage,0,0,this._imageWidth,this._imageHeight,this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height);break;case e.STRETCH_UNIFORM:var n=this._currentMeasure.width/this._imageWidth,s=this._currentMeasure.height/this._imageHeight,o=Math.min(n,s),h=(this._currentMeasure.width-this._imageWidth*o)/2,a=(this._currentMeasure.height-this._imageHeight*o)/2;r.drawImage(this._domImage,0,0,this._imageWidth,this._imageHeight,this._currentMeasure.left+h,this._currentMeasure.top+a,this._imageWidth*o,this._imageHeight*o)}r.restore()},Object.defineProperty(e,"STRETCH_NONE",{get:function(){return e._STRETCH_NONE},enumerable:!0,configurable:!0}),Object.defineProperty(e,"STRETCH_FILL",{get:function(){return e._STRETCH_FILL},enumerable:!0,configurable:!0}),Object.defineProperty(e,"STRETCH_UNIFORM",{get:function(){return e._STRETCH_UNIFORM},enumerable:!0,configurable:!0}),e})(t.Control);e._STRETCH_NONE=0,e._STRETCH_FILL=1,e._STRETCH_UNIFORM=2,t.Image=e})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));var BABYLON;!(function(t){!(function(e){var i=(function(e){function i(t){var i=e.call(this,t)||this;return i.name=t,i}return __extends(i,e),i.prototype._processPicking=function(t,e,i){return!!this._contains(t,e)&&(this._processObservables(i),!0)},i.CreateImageButton=function(e,r,n){var s=new i(e),o=new t.GUI.TextBlock(e+"_button",r);o.textWrapping=!0,o.textHorizontalAlignment=t.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER,o.marginLeft="20%",s.addControl(o);var h=new t.GUI.Image(e+"_icon",n);return h.width="20%",h.stretch=t.GUI.Image.STRETCH_UNIFORM,h.horizontalAlignment=t.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT,s.addControl(h),s},i})(e.Rectangle);e.Button=i})(t.GUI||(t.GUI={}))})(BABYLON||(BABYLON={}));