添加画布粘贴外部文字和图片
This commit is contained in:
@@ -357,6 +357,9 @@ export class ToolManager {
|
||||
this.canvasManager?.layerManager?.updateLayersObjectsInteractivity?.();
|
||||
this.canvas?.renderAll();
|
||||
|
||||
// 隐藏文本编辑面板
|
||||
this.hideTextEditor();
|
||||
|
||||
// 如果切换到非画笔工具,禁用笔刷指示器
|
||||
if (!this._shouldShowBrushIndicator(toolId)) {
|
||||
this._disableBrushIndicator();
|
||||
@@ -1014,9 +1017,10 @@ export class ToolManager {
|
||||
* 创建文字对象并添加到画布
|
||||
* @param {Number} x 文本位置x坐标
|
||||
* @param {Number} y 文本位置y坐标
|
||||
* @param {Object} options 文本选项
|
||||
* @param {String} [text] 文本内容
|
||||
* @param {Object} [options] 文本选项
|
||||
*/
|
||||
async createText(x, y, options = {}) {
|
||||
async createText(x, y, text, options = {}) {
|
||||
// 使用命令模式创建文本
|
||||
if (!this.canvas || !this.layerManager) return null;
|
||||
if (this.commandManager) {
|
||||
@@ -1025,6 +1029,7 @@ export class ToolManager {
|
||||
layerManager: this.layerManager,
|
||||
x,
|
||||
y,
|
||||
text,
|
||||
textOptions: options,
|
||||
});
|
||||
// 执行命令
|
||||
@@ -1179,6 +1184,19 @@ export class ToolManager {
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
* 隐藏文本编辑面板
|
||||
*/
|
||||
hideTextEditor() {
|
||||
// 这个方法将在TextEditorPanel组件实现后调用
|
||||
console.log("隐藏文本编辑面板");
|
||||
// 将发出一个事件,让Vue组件捕获并隐藏编辑面板
|
||||
document.dispatchEvent(
|
||||
new CustomEvent("hideTextEditor", {
|
||||
detail: {},
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理资源
|
||||
|
||||
Reference in New Issue
Block a user