"use strict";(self["webpackChunkaida"]=self["webpackChunkaida"]||[]).push([[7383,7063],{67063:function(e,i,t){t.r(i),t.d(i,{BaseBrush:function(){return s}});t(21703);class s{constructor(e,i={}){this.canvas=e,this.options=i,this.id=i.id||this.constructor.name,this.name=i.name||"未命名笔刷",this.description=i.description||"",this.icon=i.icon||null,this.category=i.category||"默认",this.brush=null}create(){throw new Error("必须由子类实现create方法")}configure(e,i){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 i=super.getConfigurableProperties(),t=i.filter((i=>!e.some((e=>e.id===i.id))));return[...t,...e]}updateProperty(e,i){if("size"===e){if(this.brush)return this.brush.width=i,!0}else if("color"===e){if(this.brush)return this.brush.color=i,!0}else if("opacity"===e&&this.brush)return this.brush.opacity=i,!0;return!1}isPropertyVisible(e,i){if(!e.visibleWhen)return!0;if("function"===typeof e.visibleWhen)return e.visibleWhen(i);if("object"===typeof e.visibleWhen){for(const[t,s]of Object.entries(e.visibleWhen))if(i[t]!==s)return!1;return!0}return!0}getDynamicOptions(e,i){return e.dynamicOptions&&"function"===typeof e.dynamicOptions?e.dynamicOptions(i):e.options||[]}onSelected(){}onDeselected(){}destroy(){this.brush=null}}},7383:function(e,i,t){t.r(i),t.d(i,{InkBrush:function(){return n}});t(21703);var s=t(67063);class n extends s.BaseBrush{constructor(e,i={}){super(e,{id:"ink",name:"水墨笔刷",description:"模拟中国传统水墨画效果，墨色深浅不一",category:"特效笔刷",icon:"ink",...i}),this._baseWidth=i._baseWidth||15,this._inkAmount=i._inkAmount||7,this._range=i._range||10,this.splashEnabled=void 0===i.splashEnabled||i.splashEnabled,this.splashSize=i.splashSize||5,this.splashDistance=i.splashDistance||30}create(){if(!this.canvas)throw new Error("画布实例不存在");return this.brush=new fabric.InkBrush(this.canvas),this.configure(this.brush,this.options),this.brush}configure(e,i={}){e&&(void 0!==i.width&&(e.width=i.width,this._baseWidth=i.width/2),void 0!==i.color&&(e.color=i.color),void 0!==i.opacity&&(e.opacity=i.opacity),void 0!==i._inkAmount&&(e._inkAmount=i._inkAmount,this._inkAmount=i._inkAmount),void 0!==i._range&&(e._range=i._range,this._range=i._range),this.splashEnabled)}setInkAmount(e){return this._inkAmount=Math.max(1,Math.min(20,e)),this.brush&&(this.brush._inkAmount=this._inkAmount),this._inkAmount}setRange(e){return this._range=Math.max(5,Math.min(50,e)),this.brush&&(this.brush._range=this._range),this._range}setSplashEnabled(e){return this.splashEnabled=e,this.splashEnabled}setSplashSize(e){return this.splashSize=Math.max(1,Math.min(20,e)),this.splashSize}setSplashDistance(e){return this.splashDistance=Math.max(10,Math.min(100,e)),this.splashDistance}getConfigurableProperties(){const e=super.getConfigurableProperties(),i=[{id:"inkAmount",name:"墨量",type:"slider",defaultValue:this._inkAmount,min:1,max:20,step:1,description:"控制水墨的浓度",category:"水墨设置",order:100},{id:"range",name:"笔触范围",type:"slider",defaultValue:this._range,min:5,max:50,step:1,description:"控制水墨扩散的范围",category:"水墨设置",order:110},{id:"splashEnabled",name:"溅墨效果",type:"checkbox",defaultValue:this.splashEnabled,description:"是否启用溅墨效果",category:"水墨设置",order:120},{id:"splashSize",name:"溅墨大小",type:"slider",defaultValue:this.splashSize,min:1,max:20,step:1,description:"溅墨点的大小",category:"水墨设置",order:130,visibleWhen:{splashEnabled:!0}},{id:"splashDistance",name:"溅墨距离",type:"slider",defaultValue:this.splashDistance,min:10,max:100,step:5,description:"溅墨可扩散的最大距离",category:"水墨设置",order:140,visibleWhen:{splashEnabled:!0}}];return[...e,...i]}updateProperty(e,i){return!!super.updateProperty(e,i)||("inkAmount"===e?(this.setInkAmount(i),!0):"range"===e?(this.setRange(i),!0):"splashEnabled"===e?(this.setSplashEnabled(i),!0):"splashSize"===e?(this.setSplashSize(i),!0):"splashDistance"===e&&(this.setSplashDistance(i),!0))}getPreview(){return"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48cGF0aCBkPSJNMjAgODBDNDAgNjAgNjAgNDAgODAgMjAiIHN0cm9rZT0iIzAwMCIgc3Ryb2tlLXdpZHRoPSI1IiBzdHJva2UtbGluZWNhcD0icm91bmQiIGZpbGw9Im5vbmUiLz48Y2lyY2xlIGN4PSI3MCIgY3k9IjMwIiByPSI1IiBmaWxsPSIjMDAwIi8+PGNpcmNsZSBjeD0iNTAiIGN5PSI1MCIgcj0iMyIgZmlsbD0iIzAwMCIvPjxjaXJjbGUgY3g9IjMwIiBjeT0iNzAiIHI9IjYiIGZpbGw9IiMwMDAiLz48L3N2Zz4="}}}}]);