去除画布打印信息
This commit is contained in:
@@ -843,7 +843,6 @@ export class CanvasManager {
|
||||
updateMaskPosition(backgroundLayerObject) {
|
||||
if (!backgroundLayerObject || !this.maskLayer || !this.canvas.clipPath)
|
||||
return;
|
||||
console.log("backgroundLayerObject");
|
||||
const left = backgroundLayerObject.left;
|
||||
const top = backgroundLayerObject.top;
|
||||
|
||||
@@ -1294,7 +1293,6 @@ export class CanvasManager {
|
||||
}
|
||||
|
||||
loadJSON(json, calllBack) {
|
||||
console.log("加载画布JSON数据:", json);
|
||||
|
||||
// 确保传入的json是字符串格式
|
||||
if (typeof json === "object") {
|
||||
@@ -1305,6 +1303,7 @@ export class CanvasManager {
|
||||
// 解析JSON字符串
|
||||
try {
|
||||
const parsedJson = JSON.parse(json);
|
||||
console.log("加载画布JSON数据:", parsedJson);
|
||||
this.canvasWidth.value = parsedJson.canvasWidth || this.width;
|
||||
this.canvasHeight.value = parsedJson.canvasHeight || this.height;
|
||||
this.canvasColor.value = parsedJson.canvasColor || this.backgroundColor;
|
||||
@@ -1330,7 +1329,7 @@ export class CanvasManager {
|
||||
// this.canvasHeight.value = parsedJson.canvasHeight || this.height;
|
||||
// this.canvasColor.value = parsedJson.canvasColor || this.backgroundColor;
|
||||
|
||||
console.log("是否检测到红绿图模式内容:", this.enabledRedGreenMode);
|
||||
// console.log("是否检测到红绿图模式内容:", this.enabledRedGreenMode);
|
||||
|
||||
// 重置视图变换以确保元素位置正确
|
||||
this._resetViewportTransform(1);
|
||||
@@ -1342,7 +1341,7 @@ export class CanvasManager {
|
||||
|
||||
// 清除当前画布内容
|
||||
// this.canvas.clear(); // 清除画布内容 可以先去掉 这样加载闪动的情况就比较少 如果有问题 可以再打开
|
||||
console.log("清除当前画布内容", canvasData);
|
||||
// console.log("清除当前画布内容", canvasData);
|
||||
delete canvasData.clipPath; // 删除当前裁剪路径
|
||||
// 加载画布数据
|
||||
this.canvas.loadFromJSON(canvasData, async () => {
|
||||
@@ -1371,7 +1370,6 @@ export class CanvasManager {
|
||||
// 重置画布数据
|
||||
await this.setCanvasSize(this.canvas.width, this.canvas.height);
|
||||
await this.centerBackgroundLayer(this.canvas.width, this.canvas.height);
|
||||
// await this.createOtherLayers(this.props.otherData);
|
||||
// 重新构建对象关系
|
||||
// restoreObjectLayerAssociations(this.layers.value, this.canvas.getObjects());
|
||||
// 验证图层关联关系 - 稳定后可以注释
|
||||
|
||||
@@ -681,7 +681,7 @@ export class ExportManager {
|
||||
isEnhanceImg, // 是否是增强图片
|
||||
});
|
||||
|
||||
console.log("导出图片数据URL:", dataURL);
|
||||
// console.log("导出图片数据URL:", dataURL);
|
||||
return dataURL;
|
||||
|
||||
// // 创建与画布相同尺寸的临时画布
|
||||
|
||||
@@ -149,7 +149,7 @@ export class LayerManager {
|
||||
*/
|
||||
initCommandManager() {
|
||||
// 命令注册逻辑已移除,现在直接使用命令类实例化和执行
|
||||
console.log("CommandManager 已初始化,使用直接命令调用模式");
|
||||
// console.log("CommandManager 已初始化,使用直接命令调用模式");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,7 +161,7 @@ export class LayerManager {
|
||||
this.layerSort = createLayerSort(this.canvas, this.layers, {
|
||||
commandManager: this.commandManager,
|
||||
});
|
||||
console.log("图层排序工具已初始化");
|
||||
// console.log("图层排序工具已初始化");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ export class LayerManager {
|
||||
// 更新所有对象的交互性
|
||||
this.updateLayersObjectsInteractivity();
|
||||
|
||||
console.log(`已切换到${mode}模式`);
|
||||
// console.log(`已切换到${mode}模式`);
|
||||
}
|
||||
|
||||
setToolManager(toolManager) {
|
||||
@@ -332,7 +332,7 @@ export class LayerManager {
|
||||
|
||||
// 私有方法:应用交互规则
|
||||
async _applyInteractionRules({ isMoveing }) {
|
||||
console.log("updateLayersObjectsInteractivity ===>", this.editorMode);
|
||||
// console.log("updateLayersObjectsInteractivity ===>", this.editorMode);
|
||||
const objects = this.canvas.getObjects();
|
||||
const editorMode = this.editorMode || CanvasConfig.defaultTool;
|
||||
const layers = this.layers?.value || [];
|
||||
@@ -975,7 +975,7 @@ export class LayerManager {
|
||||
return !layer.isFixed && !layer.isFixedOther && !layer.isBackground
|
||||
})
|
||||
// const normalLayers = this.layers.value.filter((l) => !l.isBackground && !l.isFixed && !l.isFixedOther);
|
||||
console.log("普通图层:", normalLayers)
|
||||
// console.log("普通图层:", normalLayers)
|
||||
if (isChild ? parentLength <= 1 : false) {//normalLayers.length <= 1
|
||||
console.warn("不能删除唯一的普通图层");
|
||||
message.warning(this.t("Canvas.cannotDeleteOnlyLayer"));
|
||||
@@ -1096,14 +1096,14 @@ export class LayerManager {
|
||||
if (this.commandManager) {
|
||||
const result = this.commandManager.execute(command);
|
||||
if (result) {
|
||||
console.log(`✅ 图层移动成功: ${direction}`);
|
||||
// console.log(`✅ 图层移动成功: ${direction}`);
|
||||
}
|
||||
return result;
|
||||
} else {
|
||||
const result = command.execute();
|
||||
if (result) {
|
||||
// 更新画布渲染顺序
|
||||
console.log(`✅ 图层移动成功: ${direction}`);
|
||||
// console.log(`✅ 图层移动成功: ${direction}`);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1147,7 +1147,6 @@ export class LayerManager {
|
||||
|
||||
return acc;
|
||||
}, []);
|
||||
console.log("==========", allObjects)
|
||||
// if (layer.fill) {
|
||||
// // 如果图层有填充颜色,设置所有对象的填充颜色
|
||||
// const { object } = findObjectById(this.canvas, layer.fill.id);
|
||||
@@ -1845,7 +1844,7 @@ export class LayerManager {
|
||||
input.select();
|
||||
document.execCommand("copy");
|
||||
document.body.removeChild(input);
|
||||
console.log(`已复制图层:${layer.name}`);
|
||||
// console.log(`已复制图层:${layer.name}`);
|
||||
|
||||
return this.clipboardData;
|
||||
}
|
||||
@@ -1870,7 +1869,7 @@ export class LayerManager {
|
||||
|
||||
// 检查是否是唯一的普通图层
|
||||
const normalLayers = this.layers.value.filter((l) => !l.isBackground && !l.isFixed && !l.isFixedOther);
|
||||
console.log("普通图层:", normalLayers)
|
||||
// console.log("普通图层:", normalLayers)
|
||||
if (normalLayers.length <= 1) {
|
||||
console.warn("不能剪切唯一的普通图层");
|
||||
return null;
|
||||
@@ -1930,7 +1929,7 @@ export class LayerManager {
|
||||
// 更新对象交互性
|
||||
this.updateLayersObjectsInteractivity();
|
||||
|
||||
console.log(`已剪切图层:${layer.name}`);
|
||||
// console.log(`已剪切图层:${layer.name}`);
|
||||
|
||||
return this.clipboardData;
|
||||
}
|
||||
@@ -1944,7 +1943,7 @@ export class LayerManager {
|
||||
* @returns {string} 新创建的图层ID
|
||||
*/
|
||||
async pasteLayer(event) {
|
||||
console.log("剪贴板数据:", this.clipboardData,event);
|
||||
// console.log("剪贴板数据:", this.clipboardData,event);
|
||||
if (!this.clipboardData) {
|
||||
console.error("剪贴板中没有图层数据");
|
||||
return null;
|
||||
@@ -2099,7 +2098,7 @@ export class LayerManager {
|
||||
// 重新初始化基本图层
|
||||
this.initializeLayers();
|
||||
|
||||
console.log("已清空画布");
|
||||
// console.log("已清空画布");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2312,7 +2311,7 @@ export class LayerManager {
|
||||
});
|
||||
|
||||
if (emptyLayerIds.length > 0) {
|
||||
console.log(`已清理 ${emptyLayerIds.length} 个空图层`);
|
||||
// console.log(`已清理 ${emptyLayerIds.length} 个空图层`);
|
||||
}
|
||||
|
||||
return emptyLayerIds;
|
||||
@@ -2344,7 +2343,7 @@ export class LayerManager {
|
||||
this.canvasManager = null;
|
||||
this.toolManager = null;
|
||||
|
||||
console.log("LayerManager 已销毁");
|
||||
// console.log("LayerManager 已销毁");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2652,13 +2651,13 @@ export class LayerManager {
|
||||
// 启用红绿图模式
|
||||
enableRedGreenMode() {
|
||||
this.isRedGreenMode = true;
|
||||
console.log("图层管理器:红绿图模式已启用");
|
||||
// console.log("图层管理器:红绿图模式已启用");
|
||||
}
|
||||
|
||||
// 禁用红绿图模式
|
||||
disableRedGreenMode() {
|
||||
this.isRedGreenMode = false;
|
||||
console.log("图层管理器:红绿图模式已禁用");
|
||||
// console.log("图层管理器:红绿图模式已禁用");
|
||||
}
|
||||
|
||||
// 检查是否为红绿图模式
|
||||
@@ -2708,14 +2707,14 @@ export class LayerManager {
|
||||
: LayerSortUtils.shouldUseAsyncProcessing(objectsCount, layersCount);
|
||||
|
||||
if (shouldUseAsync) {
|
||||
console.log(
|
||||
`使用异步排序处理 ${objectsCount} 个对象, ${layersCount} 个图层`
|
||||
);
|
||||
// console.log(
|
||||
// `使用异步排序处理 ${objectsCount} 个对象, ${layersCount} 个图层`
|
||||
// );
|
||||
return this.layerSort.rearrangeObjectsAsync();
|
||||
} else {
|
||||
console.log(
|
||||
`使用同步排序处理 ${objectsCount} 个对象, ${layersCount} 个图层`
|
||||
);
|
||||
// console.log(
|
||||
// `使用同步排序处理 ${objectsCount} 个对象, ${layersCount} 个图层`
|
||||
// );
|
||||
this.layerSort.rearrangeObjects();
|
||||
}
|
||||
}
|
||||
@@ -2735,7 +2734,7 @@ export class LayerManager {
|
||||
const result = this.layerSort.smartSort(targetLayerIds);
|
||||
|
||||
if (result) {
|
||||
console.log("智能排序完成");
|
||||
// console.log("智能排序完成");
|
||||
// 更新对象交互性
|
||||
this.updateLayersObjectsInteractivity();
|
||||
}
|
||||
@@ -2761,9 +2760,9 @@ export class LayerManager {
|
||||
const stats = this.layerSort.optimizeLayerStructure();
|
||||
|
||||
if (stats.removedEmptyLayers > 0 || stats.reorderedLayers > 0) {
|
||||
console.log(
|
||||
`图层结构优化完成: 清理空图层 ${stats.removedEmptyLayers} 个, 重新排序 ${stats.reorderedLayers} 个图层`
|
||||
);
|
||||
// console.log(
|
||||
// `图层结构优化完成: 清理空图层 ${stats.removedEmptyLayers} 个, 重新排序 ${stats.reorderedLayers} 个图层`
|
||||
// );
|
||||
// 更新对象交互性
|
||||
this.updateLayersObjectsInteractivity();
|
||||
}
|
||||
@@ -2838,9 +2837,9 @@ export class LayerManager {
|
||||
});
|
||||
|
||||
if (result) {
|
||||
console.log(
|
||||
`图层 ${layerId} - oldIndex: ${oldIndex} 已移动到位置 ${newIndex}`
|
||||
);
|
||||
// console.log(
|
||||
// `图层 ${layerId} - oldIndex: ${oldIndex} 已移动到位置 ${newIndex}`
|
||||
// );
|
||||
// 更新对象交互性
|
||||
// this.updateLayersObjectsInteractivity();
|
||||
}
|
||||
@@ -2917,9 +2916,9 @@ export class LayerManager {
|
||||
const result = this.layerSort.reorderLayers(oldIndex, newIndex, layerId);
|
||||
|
||||
if (result) {
|
||||
console.log(
|
||||
`高级排序完成: 图层 ${layerId} 从位置 ${oldIndex} 移动到 ${newIndex}`
|
||||
);
|
||||
// console.log(
|
||||
// `高级排序完成: 图层 ${layerId} 从位置 ${oldIndex} 移动到 ${newIndex}`
|
||||
// );
|
||||
// 更新对象交互性
|
||||
this.updateLayersObjectsInteractivity();
|
||||
}
|
||||
@@ -2944,9 +2943,9 @@ export class LayerManager {
|
||||
);
|
||||
|
||||
if (result) {
|
||||
console.log(
|
||||
`高级子图层排序完成: 图层 ${layerId} 在父图层 ${parentId} 中从位置 ${oldIndex} 移动到 ${newIndex}`
|
||||
);
|
||||
// console.log(
|
||||
// `高级子图层排序完成: 图层 ${layerId} 在父图层 ${parentId} 中从位置 ${oldIndex} 移动到 ${newIndex}`
|
||||
// );
|
||||
// 重新排列画布对象
|
||||
this.rearrangeCanvasObjects();
|
||||
}
|
||||
@@ -2971,7 +2970,7 @@ export class LayerManager {
|
||||
// 重新排列画布对象
|
||||
this.rearrangeCanvasObjects();
|
||||
|
||||
console.log("使用LayerSort工具完成图层排序");
|
||||
// console.log("使用LayerSort工具完成图层排序");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2979,7 +2978,7 @@ export class LayerManager {
|
||||
* 当图层顺序发生变化后调用此方法确保画布对象顺序正确
|
||||
*/
|
||||
forceRebuildCanvasOrder() {
|
||||
console.log("强制重建画布对象顺序");
|
||||
// console.log("强制重建画布对象顺序");
|
||||
|
||||
if (this.layerSort) {
|
||||
// 使用LayerSort的高级排序
|
||||
@@ -3010,7 +3009,7 @@ export class LayerManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
console.log(`开始批量重新排序 ${reorderOperations.length} 个图层`);
|
||||
// console.log(`开始批量重新排序 ${reorderOperations.length} 个图层`);
|
||||
|
||||
let allSuccessful = true;
|
||||
|
||||
@@ -3042,7 +3041,7 @@ export class LayerManager {
|
||||
}
|
||||
|
||||
if (allSuccessful) {
|
||||
console.log("批量图层排序完成");
|
||||
// console.log("批量图层排序完成");
|
||||
} else {
|
||||
console.warn("批量图层排序部分失败");
|
||||
}
|
||||
@@ -3079,11 +3078,11 @@ export class LayerManager {
|
||||
// 执行命令
|
||||
if (this.commandManager) {
|
||||
const result = await this.commandManager.execute(command);
|
||||
result && console.log(`✅ 成功合并组图层: ${groupLayer.name}`);
|
||||
// result && console.log(`✅ 成功合并组图层: ${groupLayer.name}`);
|
||||
return result;
|
||||
} else {
|
||||
const result = await command.execute();
|
||||
result && console.log(`✅ 成功合并组图层: ${groupLayer.name}`);
|
||||
// result && console.log(`✅ 成功合并组图层: ${groupLayer.name}`);
|
||||
return result || [];
|
||||
}
|
||||
}
|
||||
@@ -3132,13 +3131,13 @@ export class LayerManager {
|
||||
if (this.commandManager) {
|
||||
const result = await this.commandManager.execute(command);
|
||||
if (result) {
|
||||
console.log(`✅ 成功栅格化图层: ${targetLayer.name}`);
|
||||
// console.log(`✅ 成功栅格化图层: ${targetLayer.name}`);
|
||||
}
|
||||
return result;
|
||||
} else {
|
||||
const result = await command.execute();
|
||||
if (result) {
|
||||
console.log(`✅ 成功栅格化图层: ${targetLayer.name}`);
|
||||
// console.log(`✅ 成功栅格化图层: ${targetLayer.name}`);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -3209,13 +3208,13 @@ export class LayerManager {
|
||||
if (this.commandManager) {
|
||||
const result = await this.commandManager.execute(command);
|
||||
if (result) {
|
||||
console.log(`✅ 成功导出图层: ${targetLayer.name}`);
|
||||
// console.log(`✅ 成功导出图层: ${targetLayer.name}`);
|
||||
}
|
||||
return result;
|
||||
} else {
|
||||
const result = await command.execute();
|
||||
if (result) {
|
||||
console.log(`✅ 成功导出图层: ${targetLayer.name}`);
|
||||
// console.log(`✅ 成功导出图层: ${targetLayer.name}`);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -3259,7 +3258,7 @@ export class LayerManager {
|
||||
// 执行命令
|
||||
const result = await command.execute(false);
|
||||
if (result) {
|
||||
console.log(`✅ 成功导出图层: ${targetLayer.name}`);
|
||||
// console.log(`✅ 成功导出图层: ${targetLayer.name}`);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -3294,12 +3293,12 @@ export class LayerManager {
|
||||
const isSginleObject = e.target === activeSelection?._objects?.[0];
|
||||
if (e.target === activeSelection || isSginleObject) {
|
||||
hasMoved = false; // 重置移动状态
|
||||
console.log("🎯 开始移动组选择对象");
|
||||
// console.log("🎯 开始移动组选择对象");
|
||||
// 记录遮罩初始位置
|
||||
console.log(
|
||||
"🖼️ 记录遮罩初始位置",
|
||||
`${layer.clippingMask.left || 0}, ${layer.clippingMask.top || 0}`
|
||||
);
|
||||
// console.log(
|
||||
// "🖼️ 记录遮罩初始位置",
|
||||
// `${layer.clippingMask.left || 0}, ${layer.clippingMask.top || 0}`
|
||||
// );
|
||||
// 记录初始位置
|
||||
initialLeft = isSginleObject ? e.target.left : activeSelection.left;
|
||||
initialTop = isSginleObject ? e.target.top : activeSelection.top;
|
||||
@@ -3366,12 +3365,12 @@ export class LayerManager {
|
||||
const isSginleObject = e.target === activeSelection?._objects?.[0];
|
||||
if (isSginleObject) {
|
||||
// 如果是单个对象,不处理
|
||||
console.log("🚫 单个对象不处理移动完成");
|
||||
// console.log("🚫 单个对象不处理移动完成");
|
||||
hasMoved = false; // 重置移动状态
|
||||
return;
|
||||
}
|
||||
if ((target === activeSelection || isSginleObject) && hasMoved) {
|
||||
console.log("✅ 组选择对象移动完成");
|
||||
// console.log("✅ 组选择对象移动完成");
|
||||
|
||||
// 计算最终移动距离
|
||||
const deltaX = target.left - initialLeft;
|
||||
@@ -3410,7 +3409,7 @@ export class LayerManager {
|
||||
// 鼠标抬起事件处理 - 备用方案
|
||||
const handleMouseUp = (e) => {
|
||||
if (hasMoved && this.canvas.getActiveObject() === activeSelection) {
|
||||
console.log("🖱️ 鼠标抬起 - 备用移动完成处理");
|
||||
// console.log("🖱️ 鼠标抬起 - 备用移动完成处理");
|
||||
handleModified(e);
|
||||
}
|
||||
};
|
||||
@@ -3424,7 +3423,7 @@ export class LayerManager {
|
||||
this.canvas.off("selection:cleared", cleanup);
|
||||
this.canvas.off("selection:updated", cleanup);
|
||||
|
||||
console.log("🧹 清理组遮罩移动同步事件监听器");
|
||||
// console.log("🧹 清理组遮罩移动同步事件监听器");
|
||||
};
|
||||
|
||||
// 绑定事件监听器
|
||||
@@ -3437,7 +3436,7 @@ export class LayerManager {
|
||||
this.canvas.on("selection:cleared", cleanup);
|
||||
this.canvas.on("selection:updated", cleanup);
|
||||
|
||||
console.log("🎨 已设置组遮罩移动同步 - 使用 object:modified 事件");
|
||||
// console.log("🎨 已设置组遮罩移动同步 - 使用 object:modified 事件");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,7 +27,7 @@ export class ThumbnailManager {
|
||||
const { layer } = findLayerRecursively(this.layers.value, layerId);
|
||||
|
||||
if (!fabricObjects || fabricObjects.length === 0) {
|
||||
console.warn("⚠️ 无法生成缩略图:没有可栅格化的对象 返回空缩略图");
|
||||
// console.warn("⚠️ 无法生成缩略图:没有可栅格化的对象 返回空缩略图");
|
||||
// 如果没有对象,返回默认缩略图
|
||||
if (layer) {
|
||||
layer.thumbnailUrl = this.defaultThumbnail; // 更新图层对象的缩略图
|
||||
@@ -123,7 +123,7 @@ export class ThumbnailManager {
|
||||
*/
|
||||
_collectLayersAndObjects(layerId) {
|
||||
if (!layerId) {
|
||||
console.warn("⚠️ 无效的图层ID,无法收集对象");
|
||||
// console.warn("⚠️ 无效的图层ID,无法收集对象");
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -199,17 +199,17 @@ export class ThumbnailManager {
|
||||
// 提取排序后的对象
|
||||
const objectsToRasterize = objectsWithZIndex.map((item) => item.object);
|
||||
|
||||
console.log(
|
||||
`📊 收集到 ${layersToRasterize.length} 个图层,${objectsToRasterize.length} 个对象进行栅格化`
|
||||
);
|
||||
console.log(
|
||||
"🔢 对象z-index顺序:",
|
||||
objectsWithZIndex.map((item) => ({
|
||||
id: item.object.id,
|
||||
type: item.object.type,
|
||||
zIndex: item.zIndex,
|
||||
}))
|
||||
);
|
||||
// console.log(
|
||||
// `📊 收集到 ${layersToRasterize.length} 个图层,${objectsToRasterize.length} 个对象进行栅格化`
|
||||
// );
|
||||
// console.log(
|
||||
// "🔢 对象z-index顺序:",
|
||||
// objectsWithZIndex.map((item) => ({
|
||||
// id: item.object.id,
|
||||
// type: item.object.type,
|
||||
// zIndex: item.zIndex,
|
||||
// }))
|
||||
// );
|
||||
|
||||
return objectsToRasterize;
|
||||
}
|
||||
|
||||
@@ -420,7 +420,7 @@ export class ToolManager {
|
||||
|
||||
// 设置工具特定的状态
|
||||
if (tool && typeof tool.setup === "function") {
|
||||
console.log(`画布切换工具:${tool.name}(${toolId})`)
|
||||
// console.log(`画布切换工具:${tool.name}(${toolId})`)
|
||||
this.canvas.toolId = toolId;
|
||||
tool.setup();
|
||||
}
|
||||
@@ -695,7 +695,7 @@ export class ToolManager {
|
||||
|
||||
// // 设置矩形选区模式
|
||||
// // 这里需要具体的矩形选区工具实现
|
||||
console.log("矩形选区工具已激活");
|
||||
// console.log("矩形选区工具已激活");
|
||||
|
||||
if (this.canvasManager && this.canvasManager.selectionManager) {
|
||||
this.canvasManager.selectionManager.setCurrentTool(
|
||||
@@ -894,7 +894,7 @@ export class ToolManager {
|
||||
this._rasterizeLayerForLiquify(layerId);
|
||||
},
|
||||
onCancel: () => {
|
||||
console.log("用户取消了栅格化操作");
|
||||
// console.log("用户取消了栅格化操作");
|
||||
// 用户取消,触发液化面板显示事件但不能液化
|
||||
document.dispatchEvent(
|
||||
new CustomEvent("showLiquifyPanel", {
|
||||
@@ -1286,7 +1286,7 @@ export class ToolManager {
|
||||
*/
|
||||
showTextEditor(textObject, layer) {
|
||||
// 这个方法将在TextEditorPanel组件实现后调用
|
||||
console.log("显示文本编辑面板", textObject, layer);
|
||||
// console.log("显示文本编辑面板", textObject, layer);
|
||||
// 将发出一个事件,让Vue组件捕获并显示编辑面板
|
||||
document.dispatchEvent(
|
||||
new CustomEvent("showTextEditor", {
|
||||
@@ -1302,7 +1302,7 @@ export class ToolManager {
|
||||
*/
|
||||
hideTextEditor() {
|
||||
// 这个方法将在TextEditorPanel组件实现后调用
|
||||
console.log("隐藏文本编辑面板");
|
||||
// console.log("隐藏文本编辑面板");
|
||||
// 将发出一个事件,让Vue组件捕获并隐藏编辑面板
|
||||
document.dispatchEvent(
|
||||
new CustomEvent("hideTextEditor", {
|
||||
@@ -1323,7 +1323,7 @@ export class ToolManager {
|
||||
if (this.brushIndicator) {
|
||||
this.brushIndicator.dispose();
|
||||
this.brushIndicator = null;
|
||||
console.log("笔刷指示器已清理");
|
||||
// console.log("笔刷指示器已清理");
|
||||
}
|
||||
|
||||
// 移除文本编辑相关事件监听器
|
||||
@@ -1348,7 +1348,7 @@ export class ToolManager {
|
||||
this.canvas.isDrawingMode = false;
|
||||
this.canvas.selection = false;
|
||||
|
||||
console.log("文本工具已激活");
|
||||
// console.log("文本工具已激活");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1424,7 +1424,7 @@ export class ToolManager {
|
||||
// 切换到红色笔刷工具作为默认工具
|
||||
this.setTool(OperationType.RED_BRUSH);
|
||||
|
||||
console.log("工具管理器已进入红绿图模式");
|
||||
// console.log("工具管理器已进入红绿图模式");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1437,7 +1437,7 @@ export class ToolManager {
|
||||
// 切换回选择工具
|
||||
this.setTool(OperationType.SELECT);
|
||||
|
||||
console.log("工具管理器已退出红绿图模式");
|
||||
// console.log("工具管理器已退出红绿图模式");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1495,7 +1495,7 @@ export class ToolManager {
|
||||
// 更新指示器颜色
|
||||
this.brushIndicator.updateColor(brushColor);
|
||||
|
||||
console.log(`笔刷指示器已启用,大小: ${brushSize}, 颜色: ${brushColor}`);
|
||||
// console.log(`笔刷指示器已启用,大小: ${brushSize}, 颜色: ${brushColor}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1506,7 +1506,7 @@ export class ToolManager {
|
||||
if (!this.brushIndicator) return;
|
||||
|
||||
this.brushIndicator.disable();
|
||||
console.log("笔刷指示器已禁用");
|
||||
// console.log("笔刷指示器已禁用");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1517,7 +1517,7 @@ export class ToolManager {
|
||||
if (!this.brushIndicator) return;
|
||||
|
||||
this.brushIndicator.updateSize(size);
|
||||
console.log(`笔刷指示器大小已更新为: ${size}`);
|
||||
// console.log(`笔刷指示器大小已更新为: ${size}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1528,7 +1528,7 @@ export class ToolManager {
|
||||
if (!this.brushIndicator) return;
|
||||
|
||||
this.brushIndicator.updateColor(color);
|
||||
console.log(`笔刷指示器颜色已更新为: ${color}`);
|
||||
// console.log(`笔刷指示器颜色已更新为: ${color}`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -299,7 +299,7 @@ export class CommandManager {
|
||||
this.undoStack = [];
|
||||
this.redoStack = [];
|
||||
this._notifyStateChange();
|
||||
console.log("📝 命令历史已清空");
|
||||
// console.log("📝 命令历史已清空");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -485,7 +485,7 @@ export class CanvasEventManager {
|
||||
|
||||
// 调试信息
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
console.log("iPad touchstart:", e.touches.length, "fingers");
|
||||
// console.log("iPad touchstart:", e.touches.length, "fingers");
|
||||
}
|
||||
|
||||
if (e.touches.length === 2) {
|
||||
@@ -500,11 +500,11 @@ export class CanvasEventManager {
|
||||
this.touchState.zoomCenter = { x: centerX, y: centerY };
|
||||
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
console.log("iPad双指缩放开始:", {
|
||||
distance: lastTouchDistance,
|
||||
zoom: lastZoom,
|
||||
center: this.touchState.zoomCenter,
|
||||
});
|
||||
// console.log("iPad双指缩放开始:", {
|
||||
// distance: lastTouchDistance,
|
||||
// zoom: lastZoom,
|
||||
// center: this.touchState.zoomCenter,
|
||||
// });
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
@@ -554,14 +554,14 @@ export class CanvasEventManager {
|
||||
const clampedZoom = Math.max(0.1, Math.min(5, newZoom));
|
||||
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
console.log("iPad双指缩放中:", {
|
||||
currentDistance,
|
||||
lastTouchDistance,
|
||||
scale,
|
||||
currentZoom,
|
||||
newZoom,
|
||||
clampedZoom,
|
||||
});
|
||||
// console.log("iPad双指缩放中:", {
|
||||
// currentDistance,
|
||||
// lastTouchDistance,
|
||||
// scale,
|
||||
// currentZoom,
|
||||
// newZoom,
|
||||
// clampedZoom,
|
||||
// });
|
||||
}
|
||||
|
||||
// 使用缩放中心点进行缩放
|
||||
@@ -839,7 +839,7 @@ export class CanvasEventManager {
|
||||
const hasNewImage = !!fabricImage;
|
||||
|
||||
if (!hasExistingObjects && !hasNewImage) {
|
||||
console.log("没有对象需要合并");
|
||||
// console.log("没有对象需要合并");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -851,7 +851,7 @@ export class CanvasEventManager {
|
||||
|
||||
// 执行高保真合并操作
|
||||
try {
|
||||
console.log(`开始合并图层 ${activeLayer.name} 中的对象为组...`);
|
||||
// console.log(`开始合并图层 ${activeLayer.name} 中的对象为组...`);
|
||||
|
||||
const command = await this.layerManager.LayerObjectsToGroup(
|
||||
activeLayer,
|
||||
@@ -869,7 +869,7 @@ export class CanvasEventManager {
|
||||
|
||||
// 降级处理:如果合并失败,至少保证新图像能添加到图层
|
||||
if (fabricImage && this.layerManager) {
|
||||
console.log("执行降级处理:直接添加图像到图层");
|
||||
// console.log("执行降级处理:直接添加图像到图层");
|
||||
this.layerManager.addObjectToLayer(fabricImage, activeLayer.id);
|
||||
}
|
||||
}
|
||||
@@ -1011,15 +1011,15 @@ export class CanvasEventManager {
|
||||
|
||||
// 调试日志 - 仅在开发环境输出
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
console.log("设备检测结果:", {
|
||||
userAgent,
|
||||
platform,
|
||||
isMobile,
|
||||
isTablet,
|
||||
isDesktop,
|
||||
hasTouchSupport,
|
||||
maxTouchPoints: navigator.maxTouchPoints,
|
||||
});
|
||||
// console.log("设备检测结果:", {
|
||||
// userAgent,
|
||||
// platform,
|
||||
// isMobile,
|
||||
// isTablet,
|
||||
// isDesktop,
|
||||
// hasTouchSupport,
|
||||
// maxTouchPoints: navigator.maxTouchPoints,
|
||||
// });
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -219,7 +219,7 @@ export class KeyboardManager {
|
||||
const text = event.clipboardData?.getData("text/plain") || "";
|
||||
if(/^aida_copy_canvas_layer/.test(text)) return;
|
||||
const items = event.clipboardData?.items || [];
|
||||
console.log(this);
|
||||
// console.log(this);
|
||||
for (const item of items) {
|
||||
if (item.type.indexOf("text/plain") !== -1) {
|
||||
item.getAsString((text) => {
|
||||
@@ -249,7 +249,7 @@ export class KeyboardManager {
|
||||
this.container.addEventListener("touchcancel", this._handleTouchEnd);
|
||||
}
|
||||
|
||||
console.log(`键盘管理器已初始化,平台: ${this.platform}, 触摸设备: ${this.isTouchDevice}`);
|
||||
// console.log(`键盘管理器已初始化,平台: ${this.platform}, 触摸设备: ${this.isTouchDevice}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -437,35 +437,35 @@ export class KeyboardManager {
|
||||
|
||||
case "copy":
|
||||
// 复制逻辑
|
||||
console.log("复制当前选中图层");
|
||||
// console.log("复制当前选中图层");
|
||||
if(this.isRedGreenMode.value) return;
|
||||
this.layerManager.copyLayer(this.layerManager.activeLayerId.value);
|
||||
break;
|
||||
|
||||
case "paste":
|
||||
// 粘贴逻辑
|
||||
console.log("粘贴");
|
||||
// console.log("粘贴");
|
||||
if(this.isRedGreenMode.value) return;
|
||||
this.layerManager.pasteLayer();
|
||||
break;
|
||||
|
||||
case "cut":
|
||||
// 剪切逻辑
|
||||
console.log("剪切");
|
||||
// console.log("剪切");
|
||||
if(this.isRedGreenMode.value) return;
|
||||
this.layerManager.cutLayer(this.layerManager.activeLayerId.value);
|
||||
break;
|
||||
|
||||
case "delete":
|
||||
// 删除逻辑
|
||||
console.log("删除");
|
||||
// console.log("删除");
|
||||
if(this.isRedGreenMode.value) return;
|
||||
this.layerManager.removeLayer(this.layerManager.activeLayerId.value);
|
||||
break;
|
||||
|
||||
case "selectAll":
|
||||
// 全选逻辑
|
||||
console.log("全选");
|
||||
// console.log("全选");
|
||||
if(this.isRedGreenMode.value) return;
|
||||
// 这里需要实现全选逻辑 TODO: 是否在选择模式下才可以全选?
|
||||
if (this.layerManager) {
|
||||
@@ -475,7 +475,7 @@ export class KeyboardManager {
|
||||
|
||||
case "clearSelection":
|
||||
// 清除选择逻辑
|
||||
console.log("清除选择");
|
||||
// console.log("清除选择");
|
||||
// 这里需要实现清除选择逻辑
|
||||
if (this.layerManager) {
|
||||
this.layerManager.clearSelection();
|
||||
@@ -484,7 +484,7 @@ export class KeyboardManager {
|
||||
|
||||
case "save":
|
||||
// 保存逻辑
|
||||
console.log("保存");
|
||||
// console.log("保存");
|
||||
break;
|
||||
|
||||
case "selectTool":
|
||||
@@ -591,7 +591,7 @@ export class KeyboardManager {
|
||||
|
||||
case "contextMenu":
|
||||
// 上下文菜单(通常由右击或触控设备上的特定手势触发)
|
||||
console.log("显示上下文菜单");
|
||||
// console.log("显示上下文菜单");
|
||||
// 这里需要实现显示上下文菜单的逻辑
|
||||
break;
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ export class LiquifyStateManager {
|
||||
// 设备性能检测
|
||||
this.devicePerformance = this._detectDevicePerformance();
|
||||
|
||||
console.log("🎯 液化状态管理器已初始化,设备性能等级:", this.devicePerformance);
|
||||
// console.log("🎯 液化状态管理器已初始化,设备性能等级:", this.devicePerformance);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,7 +48,7 @@ export class LiquifyStateManager {
|
||||
// 显示操作反馈
|
||||
this._showOperationFeedback();
|
||||
|
||||
console.log("🚀 开始液化操作");
|
||||
// console.log("🚀 开始液化操作");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,7 +68,7 @@ export class LiquifyStateManager {
|
||||
// 禁用不必要的画布功能
|
||||
this._disableCanvasFeatures();
|
||||
|
||||
console.log("🖱️ 开始拖拽操作");
|
||||
// console.log("🖱️ 开始拖拽操作");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,7 +98,7 @@ export class LiquifyStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
console.log("✅ 结束拖拽操作");
|
||||
// console.log("✅ 结束拖拽操作");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,7 +116,7 @@ export class LiquifyStateManager {
|
||||
// 隐藏操作反馈
|
||||
this._hideOperationFeedback();
|
||||
|
||||
console.log(`⏱️ 液化操作完成,耗时: ${operationTime.toFixed(2)}ms`);
|
||||
// console.log(`⏱️ 液化操作完成,耗时: ${operationTime.toFixed(2)}ms`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -158,11 +158,11 @@ export class LiquifyStateManager {
|
||||
// 根据性能数据动态调整设置
|
||||
this._adaptivePerformanceOptimization(operationTime);
|
||||
|
||||
console.log(
|
||||
`📊 记录性能指标: ${operationType}/${mode}, 耗时: ${operationTime.toFixed(
|
||||
2
|
||||
)}ms, 渲染模式: ${renderMode}`
|
||||
);
|
||||
// console.log(
|
||||
// `📊 记录性能指标: ${operationType}/${mode}, 耗时: ${operationTime.toFixed(
|
||||
// 2
|
||||
// )}ms, 渲染模式: ${renderMode}`
|
||||
// );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -179,7 +179,7 @@ export class LiquifyStateManager {
|
||||
const currentQuality = this.realtimeUpdater.config.imageQuality || 1.0;
|
||||
if (currentQuality > 0.7) {
|
||||
this.realtimeUpdater.setImageQuality(Math.max(0.7, currentQuality - 0.1));
|
||||
console.log("⚡ 自动降低图像质量以提升性能");
|
||||
// console.log("⚡ 自动降低图像质量以提升性能");
|
||||
}
|
||||
|
||||
// 增加节流时间
|
||||
@@ -188,7 +188,7 @@ export class LiquifyStateManager {
|
||||
33,
|
||||
this.realtimeUpdater.config.throttleTime + 8
|
||||
);
|
||||
console.log("⏱️ 自动增加节流时间以提升性能");
|
||||
// console.log("⏱️ 自动增加节流时间以提升性能");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ export class LiquifyStateManager {
|
||||
this._updateCursor("default");
|
||||
this.cursorCache.clear();
|
||||
|
||||
console.log("🧹 液化状态管理器已清理");
|
||||
// console.log("🧹 液化状态管理器已清理");
|
||||
}
|
||||
|
||||
// === 私有方法 ===
|
||||
|
||||
Reference in New Issue
Block a user