This commit is contained in:
李志鹏
2026-01-22 13:46:55 +08:00
parent 6c921730ef
commit ca17956135
2 changed files with 13 additions and 11 deletions

View File

@@ -79,7 +79,10 @@ export class PartManager {
this.cleanupEvents();
this.clearPartObject();
this.clearPointData();
}else{
// this.clearPointData();
}
console.log("切换工具", toolId);
}
/** 初始化选区相关事件 */

View File

@@ -422,7 +422,7 @@ export class ToolManager {
if (tool && typeof tool.setup === "function") {
// console.log(`画布切换工具:${tool.name}(${toolId})`)
this.canvas.toolId = toolId;
tool.setup();
tool.setup(true);
}
// 通知选区管理器工具已改变
@@ -482,7 +482,7 @@ export class ToolManager {
// 如有必要可以调用当前工具的setup方法来全面恢复状态
if (tool && typeof tool.setup === "function") {
tool.setup();
tool.setup(true);
}
}
@@ -707,45 +707,44 @@ export class ToolManager {
/**
* 设置部件选取工具
*/
setupPartTool() {
setupPartTool(isExecute = false) {
if (!this.canvas) return;
this.canvas.isDrawingMode = false;
this.canvas.selection = false;
if (this.canvasManager && this.canvasManager.partManager) {
if (!isExecute && this.canvasManager && this.canvasManager.partManager) {
this.canvasManager.partManager.setCurrentTool(OperationType.PART);
}
}
/**
* 设置部件选取工具--矩形
*/
setupPartRectangleTool() {
setupPartRectangleTool(isExecute = false) {
if (!this.canvas) return;
this.canvas.isDrawingMode = false;
this.canvas.selection = true;
if (this.canvasManager && this.canvasManager.partManager) {
if (!isExecute && this.canvasManager && this.canvasManager.partManager) {
this.canvasManager.partManager.setCurrentTool(OperationType.PART_RECTANGLE);
}
}
/**
* 设置部件选取工具--画笔
*/
setupPartBrushTool() {
setupPartBrushTool(isExecute = false) {
if (!this.canvas) return;
this.canvas.isDrawingMode = true;
this.canvas.selection = false;
if (this.canvasManager && this.canvasManager.partManager) {
if (!isExecute && this.canvasManager && this.canvasManager.partManager) {
this.canvasManager.partManager.setCurrentTool(OperationType.PART_BRUSH);
}
}
/**
* 设置部件选取工具--橡皮擦
*/
setupPartEraserTool() {
setupPartEraserTool(isExecute = false) {
if (!this.canvas) return;
this.canvas.isDrawingMode = false;
this.canvas.selection = false;
if (this.canvasManager && this.canvasManager.partManager) {
if (!isExecute && this.canvasManager && this.canvasManager.partManager) {
this.canvasManager.partManager.setCurrentTool(OperationType.PART_ERASER);
}
}