fix
This commit is contained in:
@@ -1468,9 +1468,12 @@ backgroundObject.scaleY,'CanvasManager resetCanvasSizeByFixedLayer')
|
|||||||
}
|
}
|
||||||
/** 修复JSON数据中的ID丢失问题 */
|
/** 修复JSON数据中的ID丢失问题 */
|
||||||
FixJsonIdLoss(json){
|
FixJsonIdLoss(json){
|
||||||
|
const layerIds = [];
|
||||||
const layers = json?.layers || [];
|
const layers = json?.layers || [];
|
||||||
const objects = json?.canvas?.objects || [];
|
const objects = json?.canvas?.objects || [];
|
||||||
layers.forEach((layer) => {
|
layers.forEach((layer) => {
|
||||||
|
layerIds.push(layer.id);
|
||||||
|
layer.children?.forEach((child) => layerIds.push(child.id));
|
||||||
if(!layer.fabricObjects?.[0]?.id && !layer.fabricObject?.id){
|
if(!layer.fabricObjects?.[0]?.id && !layer.fabricObject?.id){
|
||||||
const obj = objects?.find((o) => o.layerId === layer.id);
|
const obj = objects?.find((o) => o.layerId === layer.id);
|
||||||
if(obj) {
|
if(obj) {
|
||||||
@@ -1488,7 +1491,15 @@ backgroundObject.scaleY,'CanvasManager resetCanvasSizeByFixedLayer')
|
|||||||
})
|
})
|
||||||
// 排除的对象id
|
// 排除的对象id
|
||||||
const excludedObjects = [SpecialLayerId.PART_SELECTOR];
|
const excludedObjects = [SpecialLayerId.PART_SELECTOR];
|
||||||
json.canvas.objects = objects.filter((v) => !excludedObjects.includes(v.id));
|
json.canvas.objects = objects.filter((v) => {
|
||||||
|
// 指定ID排除
|
||||||
|
if(excludedObjects.includes(v.id)) return false;
|
||||||
|
|
||||||
|
if(v.isBackground || v.isFixed) return true;
|
||||||
|
// 当前图层不存在当前对象
|
||||||
|
if(!layerIds.includes(v.layerId)) return false;
|
||||||
|
return true
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1961,13 +1961,13 @@ export class LayerManager {
|
|||||||
if (this.commandManager) {
|
if (this.commandManager) {
|
||||||
// 使用命令管理器执行命令
|
// 使用命令管理器执行命令
|
||||||
const result = await this.commandManager.execute(command);
|
const result = await this.commandManager.execute(command);
|
||||||
// this.clipboardData = null; // 清空剪贴板数据 复制一次
|
this.clipboardData = null; // 清空剪贴板数据 复制一次
|
||||||
// 执行命令
|
// 执行命令
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await command.execute();
|
const result = await command.execute();
|
||||||
// this.clipboardData = null; // 清空剪贴板数据 复制一次就清空,避免重复粘贴 出现 错误后也清空 总之就是清空 不用给自己找麻烦
|
this.clipboardData = null; // 清空剪贴板数据 复制一次就清空,避免重复粘贴 出现 错误后也清空 总之就是清空 不用给自己找麻烦
|
||||||
// 执行命令
|
// 执行命令
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user