"use strict";(self["webpackChunkaida"]=self["webpackChunkaida"]||[]).push([[4433,7063],{67063:function(t,e,i){i.r(e),i.d(e,{BaseBrush:function(){return s}});i(21703);class s{constructor(t,e={}){this.canvas=t,this.options=e,this.id=e.id||this.constructor.name,this.name=e.name||"未命名笔刷",this.description=e.description||"",this.icon=e.icon||null,this.category=e.category||"默认",this.brush=null}create(){throw new Error("必须由子类实现create方法")}configure(t,e){throw new Error("必须由子类实现configure方法")}getMetadata(){return{id:this.id,name:this.name,description:this.description,icon:this.icon,category:this.category}}getPreview(){return null}getConfigurableProperties(){return[{id:"size",name:"笔刷大小",type:"slider",defaultValue:5,min:.5,max:100,step:.5,description:"笔刷的大小（像素）",category:"基本",order:10},{id:"color",name:"笔刷颜色",type:"color",defaultValue:"#000000",description:"笔刷的颜色",category:"基本",order:20},{id:"opacity",name:"不透明度",type:"slider",defaultValue:1,min:.05,max:1,step:.01,description:"笔刷的不透明度",category:"基本",order:30}]}mergeWithBaseProperties(t){const e=super.getConfigurableProperties(),i=e.filter((e=>!t.some((t=>t.id===e.id))));return[...i,...t]}updateProperty(t,e){if("size"===t){if(this.brush)return this.brush.width=e,!0}else if("color"===t){if(this.brush)return this.brush.color=e,!0}else if("opacity"===t&&this.brush)return this.brush.opacity=e,!0;return!1}isPropertyVisible(t,e){if(!t.visibleWhen)return!0;if("function"===typeof t.visibleWhen)return t.visibleWhen(e);if("object"===typeof t.visibleWhen){for(const[i,s]of Object.entries(t.visibleWhen))if(e[i]!==s)return!1;return!0}return!0}getDynamicOptions(t,e){return t.dynamicOptions&&"function"===typeof t.dynamicOptions?t.dynamicOptions(e):t.options||[]}onSelected(){}onDeselected(){}destroy(){this.brush=null}}},14433:function(t,e,i){i.r(e),i.d(e,{CrayonBrush:function(){return r}});i(21703);var s=i(67063);class r extends s.BaseBrush{constructor(t,e={}){super(t,{id:"crayon",name:"蜡笔",description:"模拟蜡笔效果，具有颗粒感和纹理",category:"特效笔刷",icon:"crayon",...e}),this._baseWidth=e._baseWidth||15,this._size=e._size||0,this._sep=e._sep||0===e._sep?e._sep:3,this._inkAmount=e._inkAmount||10,this.randomness=e.randomness||.5,this.texture=e.texture||"default"}create(){if(!this.canvas)throw new Error("画布实例不存在");return this.brush=new fabric.CrayonBrush(this.canvas),this.configure(this.brush,this.options),this.brush}configure(t,e={}){t&&(void 0!==e.width&&(t.width=e.width,this._baseWidth=e.width/2,this._size=e.width/2+this._baseWidth),void 0!==e.color&&(t.color=e.color),void 0!==e.opacity&&(t.opacity=e.opacity),void 0!==e._baseWidth&&(t._baseWidth=e._baseWidth,this._baseWidth=e._baseWidth,this._size=this.width/2+this._baseWidth),void 0!==e._sep&&(t._sep=e._sep,this._sep=e._sep),void 0!==e._inkAmount&&(t._inkAmount=e._inkAmount,this._inkAmount=e._inkAmount))}setSeparation(t){return this._sep=Math.max(.5,Math.min(10,t)),this.brush&&(this.brush._sep=this._sep),this._sep}setInkAmount(t){return this._inkAmount=Math.max(1,Math.min(50,t)),this.brush&&(this.brush._inkAmount=this._inkAmount),this._inkAmount}setRandomness(t){return this.randomness=Math.max(0,Math.min(1,t)),this.randomness}setTexture(t){return this.texture=t,this.texture}getConfigurableProperties(){const t=super.getConfigurableProperties(),e=[{id:"separation",name:"颗粒分离度",type:"slider",defaultValue:this._sep,min:.5,max:10,step:.5,description:"控制蜡笔颗粒的分离程度",category:"蜡笔设置",order:100},{id:"inkAmount",name:"墨量",type:"slider",defaultValue:this._inkAmount,min:1,max:50,step:1,description:"控制蜡笔的颜料量",category:"蜡笔设置",order:110},{id:"randomness",name:"随机性",type:"slider",defaultValue:this.randomness,min:0,max:1,step:.05,description:"控制蜡笔纹理的随机程度",category:"蜡笔设置",order:120},{id:"texture",name:"纹理类型",type:"select",defaultValue:this.texture,options:[{value:"default",label:"默认"},{value:"rough",label:"粗糙"},{value:"smooth",label:"平滑"}],description:"设置蜡笔的纹理类型",category:"蜡笔设置",order:130}];return[...t,...e]}updateProperty(t,e){return!!super.updateProperty(t,e)||("separation"===t?(this.setSeparation(e),!0):"inkAmount"===t?(this.setInkAmount(e),!0):"randomness"===t?(this.setRandomness(e),!0):"texture"===t&&(this.setTexture(e),!0))}getPreview(){return"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48cmVjdCB4PSIxMCIgeT0iMTAiIHdpZHRoPSI4MCIgaGVpZ2h0PSI4MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwIiBzdHJva2Utd2lkdGg9IjIiLz48cmVjdCB4PSIyMCIgeT0iMjAiIHdpZHRoPSI2MCIgaGVpZ2h0PSI2MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwIiBzdHJva2Utd2lkdGg9IjIiLz48cmVjdCB4PSIzMCIgeT0iMzAiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwIiBzdHJva2Utd2lkdGg9IjIiLz48L3N2Zz4="}}}}]);