"use strict";(self["webpackChunkaida"]=self["webpackChunkaida"]||[]).push([[7063],{67063:function(e,i,t){t.r(i),t.d(i,{BaseBrush:function(){return r}});t(21703);class r{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,r]of Object.entries(e.visibleWhen))if(i[t]!==r)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}}}}]);