var gdjs;(function(i){class r extends i.RuntimeObject{constructor(t,e,n){super(t,e,n);this._wrapping=!1;this._wrappingWidth=250;this._opacity=parseFloat(e.content.opacity),this._text=e.content.text,this._color=i.rgbOrHexToRGBColor(e.content.color),this._fontFamily=e.content.fontFamily,this._fontSize=parseFloat(e.content.fontSize),this._textAlign=e.content.align,this._verticalTextAlignment=e.content.verticalTextAlignment||"top",this.hidden=!e.content.visible,this._renderer=new i.BBTextRuntimeObjectRenderer(this,t),this.onCreated()}getRendererObject(){return this._renderer.getRendererObject()}updateFromObjectData(t,e){return t.content.opacity!==e.content.opacity&&this.setOpacity(e.content.opacity),t.content.visible!==e.content.visible&&this.hide(!e.content.visible),t.content.text!==e.content.text&&this.setBBText(e.content.text),t.content.color!==e.content.color&&(this._color=i.rgbOrHexToRGBColor(e.content.color),this._renderer.updateColor()),t.content.fontFamily!==e.content.fontFamily&&this.setFontFamily(e.content.fontFamily),t.content.fontSize!==e.content.fontSize&&this.setFontSize(e.content.fontSize),t.content.wordWrap!==e.content.wordWrap&&this.setWrapping(e.content.wordWrap),t.content.align!==e.content.align&&this.setTextAlignment(e.content.align),t.content.verticalTextAlignment!==e.content.verticalTextAlignment&&this.setVerticalTextAlignment(e.content.verticalTextAlignment),!0}getNetworkSyncData(t){return{...super.getNetworkSyncData(t),text:this._text,o:this._opacity,c:this._color,ff:this._fontFamily,fs:this._fontSize,wwrap:this._wrapping,wwidth:this._wrappingWidth,align:this._textAlign,vta:this._verticalTextAlignment,hidden:this.hidden}}updateFromNetworkSyncData(t,e){super.updateFromNetworkSyncData(t,e),this._text!==void 0&&this.setBBText(t.text),this._opacity!==void 0&&this.setOpacity(t.o),this._color!==void 0&&(this._color=t.c,this._renderer.updateColor()),this._fontFamily!==void 0&&this.setFontFamily(t.ff),this._fontSize!==void 0&&this.setFontSize(t.fs),this._wrapping!==void 0&&this.setWrapping(t.wwrap),this._wrappingWidth!==void 0&&this.setWrappingWidth(t.wwidth),this._textAlign!==void 0&&this.setTextAlignment(t.align),this._verticalTextAlignment!==void 0&&this.setVerticalTextAlignment(t.vta),this.hidden!==void 0&&this.hide(t.hidden)}extraInitializationFromInitialInstance(t){t.customSize?(this.setWrappingWidth(t.width),this.setWrapping(!0)):this.setWrappingWidth(250),t.opacity!==void 0&&this.setOpacity(t.opacity)}onDestroyed(){super.onDestroyed(),this._renderer.destroy()}setBBText(t){this._text=t,this._renderer.updateText(),this.invalidateHitboxes()}getBBText(){return this._text}setColor(t){this._color=i.rgbOrHexToRGBColor(t),this._renderer.updateColor()}getColor(){return this._color[0]+";"+this._color[1]+";"+this._color[2]}setFontSize(t){this._fontSize=t,this._renderer.updateFontSize()}getFontSize(){return this._fontSize}setFontFamily(t){this._fontFamily=t,this._renderer.updateFontFamily()}getFontFamily(){return this._fontFamily}setAlignment(t){this.setTextAlignment(t)}setTextAlignment(t){this._textAlign=t,this._renderer.updateAlignment()}getAlignment(){return this.getTextAlignment()}getTextAlignment(){return this._textAlign}setVerticalTextAlignment(t){this._verticalTextAlignment=t,this._renderer.updatePosition()}getVerticalTextAlignment(){return this._verticalTextAlignment}setX(t){super.setX(t),this._renderer.updatePosition()}setY(t){super.setY(t),this._renderer.updatePosition()}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}setWrappingWidth(t){this._wrappingWidth!==t&&(this._wrappingWidth=t,this._renderer.updateWrappingWidth(),this.invalidateHitboxes())}getWrappingWidth(){return this._wrappingWidth}setWrapping(t){this._wrapping!==t&&(this._wrapping=t,this._renderer.updateWordWrap(),this.invalidateHitboxes())}isWrapping(){return this._wrapping}getWidth(){return this._wrapping?this._wrappingWidth:this._renderer.getWidth()}getHeight(){return this._renderer.getHeight()}setWidth(t){this.setWrappingWidth(t)}getDrawableY(){return this.getY()-(this._verticalTextAlignment==="center"?this.getHeight()/2:this._verticalTextAlignment==="bottom"?this.getHeight():0)}}i.BBTextRuntimeObject=r,i.registerObject("BBText::BBText",i.BBTextRuntimeObject)})(gdjs||(gdjs={}));
//# sourceMappingURL=bbtextruntimeobject.js.map
