var gdjs;(function(s){class d extends s.RuntimeObject{constructor(t,e){super(t,e);this._useGradient=!1;this._gradient=[];this._gradientType="";this.opacity=255;this._textAlign="left";this._wrapping=!1;this._wrappingWidth=1;this._outlineThickness=0;this._outlineColor=[255,255,255];this._shadow=!1;this._shadowColor=[0,0,0];this._shadowDistance=1;this._shadowBlur=1;this._shadowAngle=0;this._padding=5;this._scaleX=1;this._scaleY=1;this._characterSize=Math.max(1,e.characterSize),this._fontName=e.font,this._bold=e.bold,this._italic=e.italic,this._underlined=e.underlined,this._color=[e.color.r,e.color.g,e.color.b],this._str=e.string,this._textAlign=e.textAlignment,this._renderer=new s.TextRuntimeObjectRenderer(this,t),this.onCreated()}updateFromObjectData(t,e){return t.characterSize!==e.characterSize&&this.setCharacterSize(e.characterSize),t.font!==e.font&&this.setFontName(e.font),t.bold!==e.bold&&this.setBold(e.bold),t.italic!==e.italic&&this.setItalic(e.italic),(t.color.r!==e.color.r||t.color.g!==e.color.g||t.color.b!==e.color.b)&&this.setColor(""+e.color.r+";"+e.color.g+";"+e.color.b),t.string!==e.string&&this.setString(e.string),t.underlined!==e.underlined?!1:(t.textAlignment!==e.textAlignment&&this.setTextAlignment(e.textAlignment),!0)}getRendererObject(){return this._renderer.getRendererObject()}update(t){this._renderer.ensureUpToDate()}extraInitializationFromInitialInstance(t){t.customSize?(this.setWrapping(!0),this.setWrappingWidth(t.width)):this.setWrapping(!1)}_updateTextPosition(){this.invalidateHitboxes(),this._renderer.updatePosition()}setX(t){super.setX(t),this._updateTextPosition()}setY(t){super.setY(t),this._updateTextPosition()}setAngle(t){super.setAngle(t),this._renderer.updateAngle()}setOpacity(t){t<0&&(t=0),t>255&&(t=255),this.opacity=t,this._renderer.updateOpacity()}getOpacity(){return this.opacity}getString(){return this._str}setString(t){t!==this._str&&(this._str=t,this._renderer.updateString(),this._updateTextPosition())}getCharacterSize(){return this._characterSize}setCharacterSize(t){t<=1&&(t=1),this._characterSize=t,this._renderer.updateStyle()}setFontName(t){this._fontName=t,this._renderer.updateStyle()}isBold(){return this._bold}setBold(t){this._bold=t,this._renderer.updateStyle()}isItalic(){return this._italic}setItalic(t){this._italic=t,this._renderer.updateStyle()}getWidth(){return this._wrapping?this._wrappingWidth:this._renderer.getWidth()}getHeight(){return this._renderer.getHeight()}getScale(){return(Math.abs(this._scaleX)+Math.abs(this._scaleY))/2}getScaleX(){return this._scaleX}getScaleY(){return this._scaleY}setScale(t){this._scaleX===t&&this._scaleY===t||(this._scaleX=t,this._scaleY=t,this._renderer.setScale(t),this.invalidateHitboxes())}setScaleX(t){this._scaleX!==t&&(this._scaleX=t,this._renderer.setScaleX(t),this.invalidateHitboxes())}setScaleY(t){this._scaleY!==t&&(this._scaleY=t,this._renderer.setScaleY(t),this.invalidateHitboxes())}setColor(t){const e=t.split(";");e.length<3||(this._color[0]=parseInt(e[0],10),this._color[1]=parseInt(e[1],10),this._color[2]=parseInt(e[2],10),this._useGradient=!1,this._renderer.updateStyle())}getColor(){return this._color[0]+";"+this._color[1]+";"+this._color[2]}setTextAlignment(t){this._textAlign=t,this._renderer.updateStyle()}getTextAlignment(){return this._textAlign}isWrapping(){return this._wrapping}setWrapping(t){this._wrapping!==t&&(this._wrapping=t,this._renderer.updateStyle(),this.invalidateHitboxes())}getWrappingWidth(){return this._wrappingWidth}setWrappingWidth(t){t<=1&&(t=1),this._wrappingWidth!==t&&(this._wrappingWidth=t,this._renderer.updateStyle(),this.invalidateHitboxes())}setOutline(t,e){const i=t.split(";");i.length<3||(this._outlineColor[0]=parseInt(i[0],10),this._outlineColor[1]=parseInt(i[1],10),this._outlineColor[2]=parseInt(i[2],10),this._outlineThickness=e,this._renderer.updateStyle())}setShadow(t,e,i,a){const r=t.split(";");r.length<3||(this._shadowColor[0]=parseInt(r[0],10),this._shadowColor[1]=parseInt(r[1],10),this._shadowColor[2]=parseInt(r[2],10),this._shadowDistance=e,this._shadowBlur=i,this._shadowAngle=a,this._shadow=!0,this._renderer.updateStyle())}setGradient(t,e,i,a,r){const n=e.split(";"),o=i.split(";"),l=a.split(";"),h=r.split(";");this._gradient=[],n.length==3&&this._gradient.push([parseInt(n[0],10),parseInt(n[1],10),parseInt(n[2],10)]),o.length==3&&this._gradient.push([parseInt(o[0],10),parseInt(o[1],10),parseInt(o[2],10)]),l.length==3&&this._gradient.push([parseInt(l[0],10),parseInt(l[1],10),parseInt(l[2],10)]),h.length==3&&this._gradient.push([parseInt(h[0],10),parseInt(h[1],10),parseInt(h[2],10)]),this._gradientType=t,this._useGradient=this._gradient.length>1,this._renderer.updateStyle()}showShadow(t){this._shadow=t,this._renderer.updateStyle()}getPadding(){return this._padding}setPadding(t){this._padding=t,this._renderer.updateStyle()}}s.TextRuntimeObject=d,s.registerObject("TextObject::Text",s.TextRuntimeObject)})(gdjs||(gdjs={}));
//# sourceMappingURL=textruntimeobject.js.map
