var gdjs;(function(i){class s extends i.RuntimeObject{constructor(e,t,r){super(e,t,r);this.opacity=255;this._objectData=t,this._rBorder=t.rightMargin,this._lBorder=t.leftMargin,this._tBorder=t.topMargin,this._bBorder=t.bottomMargin,this._tiled=t.tiled,this._width=t.width,this._height=t.height,this._renderer=new i.PanelSpriteRuntimeObjectRenderer(this,e,t.texture,t.tiled),this.onCreated()}updateFromObjectData(e,t){this._objectData=t,e.width!==t.width&&this.setWidth(t.width),e.height!==t.height&&this.setHeight(t.height);let r=!1;return e.rightMargin!==t.rightMargin&&(this._rBorder=t.rightMargin,r=!0),e.leftMargin!==t.leftMargin&&(this._lBorder=t.leftMargin,r=!0),e.topMargin!==t.topMargin&&(this._tBorder=t.topMargin,r=!0),e.bottomMargin!==t.bottomMargin&&(this._bBorder=t.bottomMargin,r=!0),e.texture!==t.texture&&(r=!0),r&&this.setTexture(t.texture,this.getRuntimeScene()),e.tiled===t.tiled}getNetworkSyncData(e){return{...super.getNetworkSyncData(e),op:this.getOpacity(),color:this.getColor()}}updateFromNetworkSyncData(e,t){super.updateFromNetworkSyncData(e,t),e.op!==void 0&&this.setOpacity(e.op),e.color!==void 0&&this.setColor(e.color)}getRendererObject(){return this._renderer.getRendererObject()}onDestroyed(){super.onDestroyed(),this._renderer.destroy()}update(e){this._renderer.ensureUpToDate()}extraInitializationFromInitialInstance(e){e.customSize&&(this.setWidth(e.width),this.setHeight(e.height)),this.setOpacity(e.opacity===void 0?255:e.opacity)}setX(e){super.setX(e),this._renderer.updatePosition()}setY(e){super.setY(e),this._renderer.updatePosition()}setTexture(e,t){this._renderer.setTexture(e,t)}setAngle(e){super.setAngle(e),this._renderer.updateAngle()}getWidth(){return this._width}getHeight(){return this._height}setWidth(e){this._width!==e&&(this._width=e,this._renderer.updateWidth(),this.invalidateHitboxes())}setHeight(e){this._height!==e&&(this._height=e,this._renderer.updateHeight(),this.invalidateHitboxes())}setSize(e,t){this.setWidth(e),this.setHeight(t)}getOriginalWidth(){return this._objectData.width}getOriginalHeight(){return this._objectData.height}setOpacity(e){e<0&&(e=0),e>255&&(e=255),this.opacity=e,this._renderer.updateOpacity()}getOpacity(){return this.opacity}setColor(e){this._renderer.setColor(e)}getColor(){return this._renderer.getColor()}getScale(){const e=Math.abs(this.getScaleX()),t=Math.abs(this.getScaleY());return e===t?e:Math.sqrt(e*t)}getScaleX(){return this._width/this._renderer.getTextureWidth()}getScaleY(){return this._height/this._renderer.getTextureHeight()}setScale(e){this.setWidth(this._renderer.getTextureWidth()*e),this.setHeight(this._renderer.getTextureHeight()*e)}setScaleX(e){this.setWidth(this._renderer.getTextureWidth()*e)}setScaleY(e){this.setHeight(this._renderer.getTextureHeight()*e)}}i.PanelSpriteRuntimeObject=s,i.registerObject("PanelSpriteObject::PanelSprite",i.PanelSpriteRuntimeObject)})(gdjs||(gdjs={}));
//# sourceMappingURL=panelspriteruntimeobject.js.map
