"use strict";(self["webpackChunkaida"]=self["webpackChunkaida"]||[]).push([[5747,7063],{67063:function(i,t,e){e.r(t),e.d(t,{BaseBrush:function(){return r}});e(21703);class r{constructor(i,t={}){this.canvas=i,this.options=t,this.id=t.id||this.constructor.name,this.name=t.name||"未命名笔刷",this.description=t.description||"",this.icon=t.icon||null,this.category=t.category||"默认",this.brush=null}create(){throw new Error("必须由子类实现create方法")}configure(i,t){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(i){const t=super.getConfigurableProperties(),e=t.filter((t=>!i.some((i=>i.id===t.id))));return[...e,...i]}updateProperty(i,t){if("size"===i){if(this.brush)return this.brush.width=t,!0}else if("color"===i){if(this.brush)return this.brush.color=t,!0}else if("opacity"===i&&this.brush)return this.brush.opacity=t,!0;return!1}isPropertyVisible(i,t){if(!i.visibleWhen)return!0;if("function"===typeof i.visibleWhen)return i.visibleWhen(t);if("object"===typeof i.visibleWhen){for(const[e,r]of Object.entries(i.visibleWhen))if(t[e]!==r)return!1;return!0}return!0}getDynamicOptions(i,t){return i.dynamicOptions&&"function"===typeof i.dynamicOptions?i.dynamicOptions(t):i.options||[]}onSelected(){}onDeselected(){}destroy(){this.brush=null}}},35747:function(i,t,e){e.r(t),e.d(t,{CustomPenBrush:function(){return n}});e(21703);var r=e(67063);class n extends r.BaseBrush{constructor(i,t={}){super(i,{id:"pen",name:"钢笔",description:"模拟钢笔效果，具有变化的透明度",category:"基础笔刷",icon:"pen",...t}),this._baseWidth=t._baseWidth||15,this._lineWidth=t._lineWidth||2,this.inkOpacityMin=t.inkOpacityMin||.2,this.inkOpacityMax=t.inkOpacityMax||.6}create(){if(!this.canvas)throw new Error("画布实例不存在");return this.brush=new fabric.PenBrush(this.canvas),this.configure(this.brush,this.options),this.brush}configure(i,t={}){i&&(void 0!==t.width&&(i.width=t.width,this._baseWidth=t.width/2),void 0!==t.color&&(i.color=t.color),void 0!==t.opacity&&(i.opacity=t.opacity),void 0!==t._baseWidth&&(i._baseWidth=t._baseWidth,this._baseWidth=t._baseWidth),void 0!==t._lineWidth&&(i._lineWidth=t._lineWidth,this._lineWidth=t._lineWidth),i.canvas.contextTop.lineJoin="round",i.canvas.contextTop.lineCap="round")}setInkOpacityMin(i){return this.inkOpacityMin=Math.max(.1,Math.min(.5,i)),this.inkOpacityMin}setInkOpacityMax(i){return this.inkOpacityMax=Math.max(.3,Math.min(1,i)),this.inkOpacityMax}getConfigurableProperties(){const i=super.getConfigurableProperties(),t=[{id:"lineWidth",name:"线条宽度",type:"slider",defaultValue:this._lineWidth,min:1,max:10,step:.5,description:"控制钢笔线条的宽度",category:"钢笔设置",order:100},{id:"inkOpacityMin",name:"最小墨水透明度",type:"slider",defaultValue:this.inkOpacityMin,min:.1,max:.5,step:.05,description:"控制钢笔墨水最小透明度",category:"钢笔设置",order:110},{id:"inkOpacityMax",name:"最大墨水透明度",type:"slider",defaultValue:this.inkOpacityMax,min:.3,max:1,step:.05,description:"控制钢笔墨水最大透明度",category:"钢笔设置",order:120}];return[...i,...t]}updateProperty(i,t){return!!super.updateProperty(i,t)||("lineWidth"===i?(this._lineWidth=t,this.brush&&(this.brush._lineWidth=t),!0):"inkOpacityMin"===i?(this.setInkOpacityMin(t),!0):"inkOpacityMax"===i&&(this.setInkOpacityMax(t),!0))}getPreview(){return"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48cGF0aCBkPSJNMjAgMjBMODAgODBNMjAgODBMODAgMjAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iIzAwMCIgc3Ryb2tlLXdpZHRoPSIzIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4="}}}}]);