印花图层等禁止添加图层

This commit is contained in:
李志鹏
2026-01-12 09:42:07 +08:00
parent 7fc0e3bace
commit 85a158ea3e
8 changed files with 9 additions and 8 deletions

View File

@@ -144,7 +144,7 @@ export class AddLayerCommand extends Command {
// 先在一级图层中查找
for (let i = 0; i < layers.length; i++) {
const layer = layers[i];
if (layer.isPrintTrimsGroup) continue;
if (layer.id === layerId) {
return {
layer: layer,

View File

@@ -493,7 +493,7 @@ export class CreateTextCommand extends Command {
// 先在一级图层中查找
for (let i = 0; i < layers.length; i++) {
const layer = layers[i];
if (layer.isPrintTrimsGroup) continue;
if (layer.id === layerId) {
return {
layer: layer,

View File

@@ -576,7 +576,7 @@ function handleLayerClick(layer, event) {
if (event.ctrlKey || event.metaKey || event.shiftKey || isMultiSelectMode.value) {
toggleLayerSelection(layer, event);
} else {
if(!layer.isFixedClipMask) lastSelectLayerId.value = layer.id; // 更新最后选中的图层ID
if(!layer.isPrintTrimsGroup) lastSelectLayerId.value = layer.id; // 更新最后选中的图层ID
// 普通点击:进入单选模式
// selectedLayerIds.value = [layer.id];
// isMultiSelectMode.value = false;
@@ -596,7 +596,7 @@ function handleLayerClick(layer, event) {
layerManager?.updateLayersObjectsInteractivity();
}
}
if(!layer.isFixedClipMask) lastSelectedIndex.value = sortableRootLayers.value.findIndex((l) => l.id === layer.id);
if(!layer.isPrintTrimsGroup) lastSelectedIndex.value = sortableRootLayers.value.findIndex((l) => l.id === layer.id);
}
}

View File

@@ -1644,7 +1644,7 @@ export class CanvasManager {
fabricObjects: [],
children: children,
clippingMask: groupRect.toObject(),
isFixedClipMask: true,
isPrintTrimsGroup: true,
specialType: SpecialType.PRINT_TRIMS_G,
});
this.layers.value.splice(groupIndex, 0, groupLayer);

View File

@@ -3271,7 +3271,7 @@ export class LayerManager {
* @private
*/
_setupGroupMaskMovementSync(activeSelection, layer) {
if (!activeSelection || !layer || !layer.clippingMask || layer.isFixedClipMask) {
if (!activeSelection || !layer || !layer.clippingMask || layer.isPrintTrimsGroup) {
return;
}

View File

@@ -203,7 +203,7 @@ export function createLayer(options = {}) {
isHidenDragHandle: options.isHidenDragHandle || false,
isDisableUnlock: options.isDisableUnlock || false,
isFixedOther: options.isFixedOther || false,
isFixedClipMask: options.isFixedClipMask || false,
isPrintTrimsGroup: options.isPrintTrimsGroup || false,
// 确保不是背景图层
isBackground: false,

View File

@@ -177,7 +177,7 @@ export function simplifyLayers(layers, excludedLayers = []) {
isBackground: layer.isBackground || false,
isFixed: layer.isFixed || false,
isFixedOther: layer.isFixedOther || false,
isFixedClipMask: layer.isFixedClipMask || false,
isPrintTrimsGroup: layer.isPrintTrimsGroup || false,
isHidenDragHandle: layer.isHidenDragHandle || false,
isDisableUnlock: layer.isDisableUnlock || false,
clippingMask:

View File

@@ -191,6 +191,7 @@
};
const setFill = async (item) => {
if (!item) return null;
console.log(item.scale);
const cwidth = canvas.width;
const cheight = canvas.height;
let image = await urlToCanvas(item.path);