UNPKG

diginext-pixi

Version:
1 lines 2.15 kB
"use strict";var _PrintSvg_instances,_PrintSvg_awake,__awaiter=this&&this.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,s){function a(t){try{c(i.next(t))}catch(t){s(t)}}function o(t){try{c(i.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,o)}c((i=i.apply(t,e||[])).next())}))},__classPrivateFieldGet=this&&this.__classPrivateFieldGet||function(t,e,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(t):i?i.value:e.get(t)},__importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0});const PrintBase_1=__importDefault(require("../../extras/print-editor/PrintBase")),SvgSprite_1=__importDefault(require("../../extras/SvgSprite"));class PrintSvg extends((0,PrintBase_1.default)(SvgSprite_1.default)){constructor(t){super(),_PrintSvg_instances.add(this),this.type="PrintSvg",this.isResized=!0,this.props=Object.assign(Object.assign({},this.props),{props:t}),__classPrivateFieldGet(this,_PrintSvg_instances,"m",_PrintSvg_awake).call(this)}viewAsWeb(){return __awaiter(this,void 0,void 0,(function*(){yield this.changeTextureByContent(this.currentContent,{maxSize:512})}))}prepairPrint(){return __awaiter(this,void 0,void 0,(function*(){yield this.changeTextureByContent(this.currentContent,{maxSize:2048})}))}toJSON(t){return super.toJSON({url:this.url,colors:this.getAllColors()})}fromJSON(t){const e=Object.create(null,{fromJSON:{get:()=>super.fromJSON}});return __awaiter(this,void 0,void 0,(function*(){if("string"==typeof t)try{t=JSON.parse(t)}catch(t){console.error("fromJSON error",t)}const{url:r,colors:i,rotation:n,x:s,y:a,scaleX:o,scaleY:c}=t;this.visible=!1,yield this.setupByUrl(r),yield this.changeColorByTone(i),e.fromJSON.call(this,t),this.visible=!0}))}}exports.default=PrintSvg,_PrintSvg_instances=new WeakSet,_PrintSvg_awake=function(){};