feat: 优化填充组图层背景命令,支持实时更新和撤销功能,改进填充对象的处理逻辑

This commit is contained in:
bighuixiang
2025-07-16 11:35:52 +08:00
parent e31a619bd6
commit 5f29e488ed
9 changed files with 372 additions and 201 deletions

View File

@@ -96,10 +96,10 @@ export class LayerSort {
* @returns {number} 更新后的z-index
*/
processLayerObjects(layer, currentZIndex, zIndexMap) {
if (layer.fill) {
// 如果图层有填充,则填充在最底层
zIndexMap.set(layer.fill.id, currentZIndex++);
}
// if (layer.fill) {
// // 如果图层有填充,则填充在最底层
// zIndexMap.set(layer.fill.id, currentZIndex++);
// }
// 检查是否有子图层(组图层)
if (layer.children?.length > 0) {
// 处理每个子图层

View File

@@ -391,13 +391,17 @@ const createRasterizedImageWithMask = async ({
*/
const cloneObjectAsync = (obj) => {
return new Promise((resolve, reject) => {
obj.clone((cloned) => {
if (cloned) {
resolve(cloned);
} else {
reject(new Error("对象克隆失败"));
}
});
try {
obj?.clone?.((cloned) => {
if (cloned) {
resolve(cloned);
} else {
reject(new Error("对象克隆失败"));
}
}, {});
} catch (error) {
reject(new Error(`克隆对象时发生错误: ${error.message}`));
}
});
};