布局修改 部分bug修复

This commit is contained in:
X1627315083
2025-08-22 10:27:48 +08:00
parent 141821a843
commit 594bf5ce0a
275 changed files with 5675 additions and 13049 deletions

View File

@@ -33,11 +33,13 @@ export class BrushManager {
* @param {Object} options.canvas fabric.js画布实例
* @param {Object} options.brushStore 笔刷数据存储(可选)
* @param {Object} options.layerManager 图层管理器实例(可选)
* @param {Function} options.t 国际化函数
*/
constructor(options = {}) {
this.canvas = options.canvas;
this.brushStore = options.brushStore || BrushStore;
this.layerManager = options.layerManager; // 添加图层管理器引用
this.t = options.t
// 当前活动笔刷
this.activeBrush = null;
@@ -59,76 +61,89 @@ export class BrushManager {
_registerDefaultBrushes() {
// 注册铅笔笔刷
brushRegistry.register("pencil", PencilBrush, {
name: "Pencil",
name: this.t("Canvas.Pencil"),
description: "基础铅笔工具,适合精细线条绘制",
category: "基础笔刷",
t:this.t,
category: this.t('Canvas.BasicBrushes'),
});
// 注册材质笔刷
brushRegistry.register("texture", TextureBrush, {
name: "Texture",
name: this.t("Canvas.Texture"),
description: "使用纹理图片作为笔刷,支持缩放和透明度",
category: "基础笔刷",
t:this.t,
category: this.t('Canvas.BasicBrushes'),
});
// 注册集成的笔刷类型
brushRegistry.register("crayon", CrayonBrush, {
name: "Crayon",
name: this.t("Canvas.Crayon"),
description: "使用纹理图片作为笔刷,支持缩放和透明度",
category: "基础笔刷",
t:this.t,
category: this.t('Canvas.BasicBrushes'),
});
brushRegistry.register("fur", FurBrush, {
name: "Fur",
name: this.t("Canvas.Fur"),
description: "使用纹理图片作为笔刷,支持缩放和透明度",
category: "基础笔刷",
t:this.t,
category: this.t('Canvas.BasicBrushes'),
});
brushRegistry.register("ink", InkBrush, {
name: "Ink",
name: this.t("Canvas.Ink"),
description: "墨水笔刷,适合书写和绘图",
category: "基础笔刷",
t:this.t,
category: this.t('Canvas.BasicBrushes'),
});
brushRegistry.register("", LongfurBrush, {
name: "Longfur",
name: this.t("Canvas.Longfur"),
description: "长毛发笔刷,适合绘制动物毛皮、草或头发",
category: "基础笔刷",
t:this.t,
category: this.t('Canvas.BasicBrushes'),
});
brushRegistry.register("writing", WritingBrush, {
name: "Writing",
name: this.t("Canvas.Writing"),
description: "书法笔刷,模拟中国传统书法毛笔效果,具有笔锋和墨色变化",
category: "基础笔刷",
t:this.t,
category: this.t('Canvas.BasicBrushes'),
});
brushRegistry.register("marker", MarkerBrush, {
name: "Marker",
name: this.t("Canvas.Marker"),
description: "马克笔笔刷,适合粗线条和填充",
category: "基础笔刷",
t:this.t,
category: this.t('Canvas.BasicBrushes'),
});
brushRegistry.register("pen", CustomPenBrush, {
name: "Pen",
name: this.t("Canvas.Pen"),
description: "自定义钢笔笔刷,适合书写和绘图",
category: "基础笔刷",
t:this.t,
category: this.t('Canvas.BasicBrushes'),
});
brushRegistry.register("ribbon", RibbonBrush, {
name: "Ribbon",
name: this.t("Canvas.Ribbon"),
description: "丝带笔刷,适合创建流动的丝带效果",
category: "基础笔刷",
t:this.t,
category: this.t('Canvas.BasicBrushes'),
});
brushRegistry.register("shaded", ShadedBrush, {
name: "Shaded",
name: this.t("Canvas.Shaded"),
description: "阴影笔刷,适合创建渐变和阴影效果",
category: "基础笔刷",
t:this.t,
category: this.t('Canvas.BasicBrushes'),
});
brushRegistry.register("spray", SprayBrush, {
name: "spray",
name: this.t("Canvas.Spray"),
description: "模拟喷枪效果,创建散点效果",
category: "基础笔刷",
t:this.t,
category: this.t('Canvas.BasicBrushes'),
});
// brushRegistry.register("sketchy", SketchyBrush);
// brushRegistry.register("spraypaint", SpraypaintBrush, {
// name: "Spraypaint",
// description: "喷漆笔刷,模拟喷漆效果",
// category: "基础笔刷",
// t:this.t,
// category: this.t('Canvas.BasicBrushes'),
// });
// // // 注册喷枪笔刷
@@ -140,7 +155,7 @@ export class BrushManager {
// id: "spray",
// name: "Spray",
// description: "模拟喷枪效果,创建散点效果",
// category: "基础笔刷",
// category: this.t('Canvas.BasicBrushes'),
// ...options,
// });
// }