"use strict";(self["webpackChunkaida"]=self["webpackChunkaida"]||[]).push([[3143,7063],{67063:function(e,t,i){i.r(t),i.d(t,{BaseBrush:function(){return r}});i(21703);class r{constructor(e,t={}){this.canvas=e,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(e,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(e){const t=super.getConfigurableProperties(),i=t.filter((t=>!e.some((e=>e.id===t.id))));return[...i,...e]}updateProperty(e,t){if("size"===e){if(this.brush)return this.brush.width=t,!0}else if("color"===e){if(this.brush)return this.brush.color=t,!0}else if("opacity"===e&&this.brush)return this.brush.opacity=t,!0;return!1}isPropertyVisible(e,t){if(!e.visibleWhen)return!0;if("function"===typeof e.visibleWhen)return e.visibleWhen(t);if("object"===typeof e.visibleWhen){for(const[i,r]of Object.entries(e.visibleWhen))if(t[i]!==r)return!1;return!0}return!0}getDynamicOptions(e,t){return e.dynamicOptions&&"function"===typeof e.dynamicOptions?e.dynamicOptions(t):e.options||[]}onSelected(){}onDeselected(){}destroy(){this.brush=null}}},73143:function(e,t,i){i.r(t),i.d(t,{MarkerBrush:function(){return s}});i(21703);var r=i(67063);class s extends r.BaseBrush{constructor(e,t={}){super(e,{id:"marker",name:"马克笔",description:"模拟马克笔效果，具有半透明平头笔触",category:"基础笔刷",icon:"marker",...t}),this._baseWidth=t._baseWidth||15,this._lineWidth=t._lineWidth||2,this.capStyle=t.capStyle||"round",this.blendMode=t.blendMode||"multiply"}create(){if(!this.canvas)throw new Error("画布实例不存在");return this.brush=new fabric.MarkerBrush(this.canvas),this.configure(this.brush,this.options),this.brush}configure(e,t={}){e&&(void 0!==t.width&&(e.width=t.width,this._baseWidth=t.width),void 0!==t.color&&(e.color=t.color),void 0!==t.opacity&&(e.opacity=Math.min(.8,t.opacity||.6)),void 0!==t._baseWidth&&(e._baseWidth=t._baseWidth,this._baseWidth=t._baseWidth),void 0!==t._lineWidth&&(e._lineWidth=t._lineWidth,this._lineWidth=t._lineWidth),e.canvas.contextTop.lineJoin="round",e.canvas.contextTop.lineCap=this.capStyle||"round","multiply"===this.blendMode?e.canvas.contextTop.globalCompositeOperation="multiply":e.canvas.contextTop.globalCompositeOperation="source-over")}setLineWidth(e){return this._lineWidth=Math.max(1,Math.min(10,e)),this.brush&&(this.brush._lineWidth=this._lineWidth),this._lineWidth}setCapStyle(e){return"round"!==e&&"square"!==e||(this.capStyle=e,this.brush&&this.brush.canvas&&(this.brush.canvas.contextTop.lineCap=e)),this.capStyle}setBlendMode(e){return this.blendMode=e,this.brush&&this.brush.canvas&&(this.brush.canvas.contextTop.globalCompositeOperation="multiply"===e?"multiply":"source-over"),this.blendMode}getConfigurableProperties(){const e=super.getConfigurableProperties(),t=[{id:"lineWidth",name:"笔触宽度",type:"slider",defaultValue:this._lineWidth,min:1,max:10,step:.5,description:"控制马克笔笔触的宽度",category:"马克笔设置",order:100},{id:"capStyle",name:"笔头样式",type:"select",defaultValue:this.capStyle,options:[{value:"round",label:"圆形"},{value:"square",label:"方形"}],description:"设置马克笔笔头的形状",category:"马克笔设置",order:110},{id:"blendMode",name:"混合模式",type:"select",defaultValue:this.blendMode,options:[{value:"multiply",label:"正片叠底"},{value:"normal",label:"正常"}],description:"设置马克笔的颜色混合方式",category:"马克笔设置",order:120}];return[...e,...t]}updateProperty(e,t){return!!super.updateProperty(e,t)||("lineWidth"===e?(this.setLineWidth(t),!0):"capStyle"===e?(this.setCapStyle(t),!0):"blendMode"===e&&(this.setBlendMode(t),!0))}getPreview(){return"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48cGF0aCBkPSJNMTAgNTBIOTAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iIzAwMCIgc3Ryb2tlLXdpZHRoPSIyMCIgc3Ryb2tlLW9wYWNpdHk9IjAuNiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+PC9zdmc+"}}}}]);