111
This commit is contained in:
@@ -79,7 +79,10 @@ export class PartManager {
|
|||||||
this.cleanupEvents();
|
this.cleanupEvents();
|
||||||
this.clearPartObject();
|
this.clearPartObject();
|
||||||
this.clearPointData();
|
this.clearPointData();
|
||||||
|
}else{
|
||||||
|
// this.clearPointData();
|
||||||
}
|
}
|
||||||
|
console.log("切换工具", toolId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 初始化选区相关事件 */
|
/** 初始化选区相关事件 */
|
||||||
|
|||||||
@@ -422,7 +422,7 @@ export class ToolManager {
|
|||||||
if (tool && typeof tool.setup === "function") {
|
if (tool && typeof tool.setup === "function") {
|
||||||
// console.log(`画布切换工具:${tool.name}(${toolId})`)
|
// console.log(`画布切换工具:${tool.name}(${toolId})`)
|
||||||
this.canvas.toolId = toolId;
|
this.canvas.toolId = toolId;
|
||||||
tool.setup();
|
tool.setup(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 通知选区管理器工具已改变
|
// 通知选区管理器工具已改变
|
||||||
@@ -482,7 +482,7 @@ export class ToolManager {
|
|||||||
|
|
||||||
// 如有必要,可以调用当前工具的setup方法来全面恢复状态
|
// 如有必要,可以调用当前工具的setup方法来全面恢复状态
|
||||||
if (tool && typeof tool.setup === "function") {
|
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;
|
if (!this.canvas) return;
|
||||||
this.canvas.isDrawingMode = false;
|
this.canvas.isDrawingMode = false;
|
||||||
this.canvas.selection = false;
|
this.canvas.selection = false;
|
||||||
|
if (!isExecute && this.canvasManager && this.canvasManager.partManager) {
|
||||||
if (this.canvasManager && this.canvasManager.partManager) {
|
|
||||||
this.canvasManager.partManager.setCurrentTool(OperationType.PART);
|
this.canvasManager.partManager.setCurrentTool(OperationType.PART);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 设置部件选取工具--矩形
|
* 设置部件选取工具--矩形
|
||||||
*/
|
*/
|
||||||
setupPartRectangleTool() {
|
setupPartRectangleTool(isExecute = false) {
|
||||||
if (!this.canvas) return;
|
if (!this.canvas) return;
|
||||||
this.canvas.isDrawingMode = false;
|
this.canvas.isDrawingMode = false;
|
||||||
this.canvas.selection = true;
|
this.canvas.selection = true;
|
||||||
if (this.canvasManager && this.canvasManager.partManager) {
|
if (!isExecute && this.canvasManager && this.canvasManager.partManager) {
|
||||||
this.canvasManager.partManager.setCurrentTool(OperationType.PART_RECTANGLE);
|
this.canvasManager.partManager.setCurrentTool(OperationType.PART_RECTANGLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 设置部件选取工具--画笔
|
* 设置部件选取工具--画笔
|
||||||
*/
|
*/
|
||||||
setupPartBrushTool() {
|
setupPartBrushTool(isExecute = false) {
|
||||||
if (!this.canvas) return;
|
if (!this.canvas) return;
|
||||||
this.canvas.isDrawingMode = true;
|
this.canvas.isDrawingMode = true;
|
||||||
this.canvas.selection = false;
|
this.canvas.selection = false;
|
||||||
if (this.canvasManager && this.canvasManager.partManager) {
|
if (!isExecute && this.canvasManager && this.canvasManager.partManager) {
|
||||||
this.canvasManager.partManager.setCurrentTool(OperationType.PART_BRUSH);
|
this.canvasManager.partManager.setCurrentTool(OperationType.PART_BRUSH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 设置部件选取工具--橡皮擦
|
* 设置部件选取工具--橡皮擦
|
||||||
*/
|
*/
|
||||||
setupPartEraserTool() {
|
setupPartEraserTool(isExecute = false) {
|
||||||
if (!this.canvas) return;
|
if (!this.canvas) return;
|
||||||
this.canvas.isDrawingMode = false;
|
this.canvas.isDrawingMode = false;
|
||||||
this.canvas.selection = 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);
|
this.canvasManager.partManager.setCurrentTool(OperationType.PART_ERASER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user