深度画布bug
This commit is contained in:
@@ -3,13 +3,13 @@ import { reactive, readonly } from "vue";
|
||||
class texturePresetManager { }
|
||||
|
||||
export class BrushState {
|
||||
constructor(options) {
|
||||
constructor(options = {}) {
|
||||
this.state = reactive({
|
||||
// 笔刷基础属性
|
||||
size: 5, // 笔刷大小
|
||||
color: "#000000", // 笔刷颜色
|
||||
opacity: 1, // 笔刷透明度
|
||||
type: "pencil", // 当前笔刷类型
|
||||
size: options.size || 5, // 笔刷大小
|
||||
color: options.color || "#000000", // 笔刷颜色
|
||||
opacity: options.opacity || 1, // 笔刷透明度
|
||||
type: options.type || "pencil", // 当前笔刷类型
|
||||
|
||||
// 阴影相关属性
|
||||
shadowEnabled: false, // 是否启用阴影
|
||||
|
||||
@@ -21,6 +21,8 @@ import { EraserStateManager } from "../EraserStateManager.js";
|
||||
import { SprayBrush } from "./types/SprayBrush";
|
||||
// import { SketchyBrush } from "./types/SketchyBrush";
|
||||
// import { SpraypaintBrush } from "./types/SpraypaintBrush";
|
||||
import { OperationType } from '../../tools/layerHelper'
|
||||
|
||||
|
||||
/**
|
||||
* 笔刷管理器
|
||||
@@ -37,7 +39,17 @@ export class BrushManager {
|
||||
*/
|
||||
constructor(options = {}) {
|
||||
this.canvas = options.canvas;
|
||||
this.brushStore = new BrushState();
|
||||
this.brushStoreList = {
|
||||
[OperationType.DRAW]: new BrushState(),
|
||||
[OperationType.ERASER]: new BrushState(),
|
||||
[OperationType.AISELECT_DRAW]: new BrushState({
|
||||
color: "rgb(255, 0, 0)",
|
||||
opacity: 0.5,
|
||||
}),
|
||||
[OperationType.AISELECT_ERASER]: new BrushState(),
|
||||
}
|
||||
this.brushStore = this.brushStoreList[OperationType.DRAW];
|
||||
|
||||
this.layerManager = options.layerManager; // 添加图层管理器引用
|
||||
this.brushIndicator = options.brushIndicator; // 添加笔刷指示器引用
|
||||
// this.t = options.t
|
||||
@@ -55,7 +67,15 @@ export class BrushManager {
|
||||
this.isErasingActive = false;
|
||||
this.currentErasedObjects = []; // 当前擦除会话中被影响的对象
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换工具时,更新当前活动笔刷
|
||||
* @param {string} toolName 当前工具名称
|
||||
*/
|
||||
handleToolChange(toolName) {
|
||||
const store = this.brushStoreList[toolName];
|
||||
if (!store) return;
|
||||
this.brushStore = store;
|
||||
}
|
||||
/**
|
||||
* 注册默认笔刷
|
||||
* @private
|
||||
|
||||
Reference in New Issue
Block a user