保存画布排除特殊图层
This commit is contained in:
@@ -155,15 +155,19 @@ export function validateLayerAssociations(layers, canvasObjects) {
|
||||
/**
|
||||
* 简化layers对象属性,只保留必要的属性
|
||||
* @param {Array} layers 图层数组
|
||||
* @param {Array} excludedLayers 排除的图层ID数组
|
||||
* @returns {Array} 简化后的图层数组
|
||||
*/
|
||||
export function simplifyLayers(layers) {
|
||||
export function simplifyLayers(layers, excludedLayers = []) {
|
||||
if (!layers || !isArray(layers)) {
|
||||
console.warn("simplifyLayers 请传入有效的图层数组:", layers);
|
||||
return [];
|
||||
}
|
||||
|
||||
return layers.map((layer) => {
|
||||
// 检查是否在排除列表中
|
||||
if (excludedLayers && excludedLayers.includes(layer.id)) return null;
|
||||
|
||||
const simplifiedLayer = {
|
||||
id: layer.id,
|
||||
name: layer.name,
|
||||
@@ -215,7 +219,7 @@ export function simplifyLayers(layers) {
|
||||
};
|
||||
|
||||
return simplifiedLayer;
|
||||
});
|
||||
}).filter((layer) => !!layer);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user