UNPKG

pixi-dragonbones-runtime

Version:
3 lines (2 loc) 1.56 kB
"use strict";var e=require("../core/BaseObject.cjs");require("../core/DragonBones.cjs");var t=require("../geom/Rectangle.cjs");require("../geom/Transform.cjs");class r extends e.BaseObject{constructor(){super(...arguments),this.textures={}}_onClear(){for(let e in this.textures)this.textures[e].returnToPool(),delete this.textures[e];this.autoSearch=!1,this.width=0,this.height=0,this.scale=1,this.name="",this.imagePath=""}copyFrom(e){this.autoSearch=e.autoSearch,this.scale=e.scale,this.width=e.width,this.height=e.height,this.name=e.name,this.imagePath=e.imagePath;for(let e in this.textures)this.textures[e].returnToPool(),delete this.textures[e];for(let t in e.textures){const r=this.createTexture();r.copyFrom(e.textures[t]),this.textures[t]=r}}addTexture(e){e.name in this.textures?console.warn("Same texture: "+e.name):(e.parent=this,this.textures[e.name]=e)}getTexture(e){return e in this.textures?this.textures[e]:null}}class s extends e.BaseObject{constructor(){super(...arguments),this.region=new t.Rectangle,this.frame=null}static createRectangle(){return new t.Rectangle}_onClear(){this.rotated=!1,this.name="",this.region.clear(),this.parent=null,this.frame=null}copyFrom(e){this.rotated=e.rotated,this.name=e.name,this.region.copyFrom(e.region),this.parent=e.parent,null===this.frame&&null!==e.frame?this.frame=s.createRectangle():null!==this.frame&&null===e.frame&&(this.frame=null),null!==this.frame&&null!==e.frame&&this.frame.copyFrom(e.frame)}}exports.TextureAtlasData=r,exports.TextureData=s; //# sourceMappingURL=TextureAtlasData.cjs.map