修复画布删除最后一个活动图层bug
This commit is contained in:
@@ -678,12 +678,20 @@ function deleteFun(){
|
||||
|
||||
function removeLayer(layerId) {
|
||||
// Check if this is the last layer - prevent deletion
|
||||
if (layers.value.length <= 2) {
|
||||
console.warn(
|
||||
var isChild = false;
|
||||
var parentLength = 0;
|
||||
layers.value.forEach((layer) => {
|
||||
if(layer.children.some(v => v.id == layerId)){
|
||||
isChild = true;
|
||||
parentLength = layer.children.length;
|
||||
}
|
||||
})
|
||||
if(isChild && parentLength == 1 || layers.value.length <= 3){
|
||||
console.warn(
|
||||
"Cannot delete the last layer. At least one layer must remain."
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (canvasManager && canvasManager.canvas) {
|
||||
const layerToRemove = layers.value.find((l) => l.id === layerId);
|
||||
|
||||
Reference in New Issue
Block a user