导出印花等所有信息
This commit is contained in:
@@ -524,15 +524,16 @@ export class LayerManager {
|
||||
* @param {string} name 图层名称
|
||||
* @param {string} type 图层类型
|
||||
* @param {Object} options 额外选项
|
||||
* @param {boolean} isCmd 是否创建命令
|
||||
* @returns {string} 新创建的图层ID
|
||||
*/
|
||||
async createLayer(name = null, type = LayerType.EMPTY, options = {}) {
|
||||
async createLayer(name = null, type = LayerType.EMPTY, options = {}, isCmd = true) {
|
||||
// 生成唯一ID
|
||||
const layerId = options.id || options.layerId || generateId("layer_");
|
||||
|
||||
// 计算普通图层数量(非背景、非固定)
|
||||
const normalLayersCount = this.layers.value.filter(
|
||||
(layer) => !layer.isBackground && !layer.isFixed
|
||||
(layer) => !layer.isBackground && !layer.isFixed && !layer.isFixedOther
|
||||
).length;
|
||||
// 计算插入位置,如果没有指定insertIndex,则根据当前选中图层决定插入位置
|
||||
// 添加到图层列表
|
||||
@@ -544,7 +545,7 @@ export class LayerManager {
|
||||
// 创建新图层
|
||||
const newLayer = createLayer({
|
||||
id: layerId,
|
||||
name: name || `图层 ${normalLayersCount + 1}`,
|
||||
name: name || this.t("Canvas.EmptyLayer"),
|
||||
type: type,
|
||||
visible: true,
|
||||
locked: false,
|
||||
@@ -573,13 +574,13 @@ export class LayerManager {
|
||||
}
|
||||
|
||||
// 执行命令
|
||||
if (this.commandManager) {
|
||||
if (isCmd && this.commandManager) {
|
||||
await this.commandManager.execute(command);
|
||||
} else {
|
||||
} else{
|
||||
await command.execute();
|
||||
}
|
||||
|
||||
return layerId;
|
||||
return isCmd ? layerId : command;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -973,7 +974,7 @@ export class LayerManager {
|
||||
})
|
||||
// const normalLayers = this.layers.value.filter((l) => !l.isBackground && !l.isFixed && !l.isFixedOther);
|
||||
console.log("普通图层:", normalLayers)
|
||||
if (isChild ? parentLength <= 1 : normalLayers.length <= 1) {
|
||||
if (isChild ? parentLength <= 1 : false) {//normalLayers.length <= 1
|
||||
console.warn("不能删除唯一的普通图层");
|
||||
message.warning(this.t("Canvas.cannotDeleteOnlyLayer"));
|
||||
return false;
|
||||
@@ -3446,7 +3447,7 @@ export class LayerManager {
|
||||
this.layers.value.forEach(layer => {
|
||||
if(layer.id === SpecialLayerId.SPECIAL_GROUP){
|
||||
layer.children.forEach(child => {
|
||||
if(child.blendMode && child.blendMode !== BlendMode.NORMAL){
|
||||
if(child.visible && child.blendMode && child.blendMode !== BlendMode.NORMAL){
|
||||
blendModeLayerIds.push(child.id);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user