修复画布删除最后一个活动图层bug
This commit is contained in:
@@ -678,7 +678,15 @@ function deleteFun(){
|
|||||||
|
|
||||||
function removeLayer(layerId) {
|
function removeLayer(layerId) {
|
||||||
// Check if this is the last layer - prevent deletion
|
// Check if this is the last layer - prevent deletion
|
||||||
if (layers.value.length <= 2) {
|
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(
|
console.warn(
|
||||||
"Cannot delete the last layer. At least one layer must remain."
|
"Cannot delete the last layer. At least one layer must remain."
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user