fix: 右键删除失效问题修复
This commit is contained in:
@@ -938,7 +938,7 @@ export class LayerManager {
|
|||||||
*/
|
*/
|
||||||
removeLayer(layerId) {
|
removeLayer(layerId) {
|
||||||
// 查找要删除的图层
|
// 查找要删除的图层
|
||||||
const { layer } = findLayerRecursively(this.layers.value, layerId);
|
const { layer, parent } = findLayerRecursively(this.layers.value, layerId);
|
||||||
// 如果是背景层或固定层,不允许删除
|
// 如果是背景层或固定层,不允许删除
|
||||||
if (layer && (layer.isBackground || layer.isFixed)) {
|
if (layer && (layer.isBackground || layer.isFixed)) {
|
||||||
console.warn(layer.isBackground ? "背景层不可删除" : "固定层不可删除");
|
console.warn(layer.isBackground ? "背景层不可删除" : "固定层不可删除");
|
||||||
@@ -946,10 +946,16 @@ export class LayerManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果图层有子图层,提示确认
|
// // 如果图层有子图层,提示确认
|
||||||
if (layer && layer.children && layer.children.length > 0) {
|
// if (layer && layer.children && layer.children.length > 0) {
|
||||||
console.warn("该图层包含子图层,删除将同时删除所有子图层");
|
// console.warn("该图层包含子图层,删除将同时删除所有子图层");
|
||||||
message.warning("该图层包含子图层,删除将同时删除所有子图层");
|
// message.warning("该图层包含子图层,删除将同时删除所有子图层");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 删除的是子图层
|
||||||
|
if (parent && layer) {
|
||||||
|
this.removeChildLayer(layer.id, parent.id);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 直接创建和执行命令
|
// 直接创建和执行命令
|
||||||
|
|||||||
Reference in New Issue
Block a user