feat: 修复画布部分bug

This commit is contained in:
bighuixiang
2025-06-23 00:40:45 +08:00
parent ea1480dd7c
commit 4da5f7d105
14 changed files with 718 additions and 198 deletions

View File

@@ -127,7 +127,10 @@ export class BatchInitializeRedGreenModeCommand extends Command {
);
// 4. 确保背景图层大小和衣服地图大小一致
await this._setupBackgroundLayer(backgroundLayer, this.clothingImage);
const backgroundObject = await this._setupBackgroundLayer(
backgroundLayer,
this.clothingImage
);
// 8. 设置普通图层透明度
this._setupNormalLayerOpacity(normalLayers); // 这里不需要在这里设置透明度 由图层统一处理
@@ -136,7 +139,7 @@ export class BatchInitializeRedGreenModeCommand extends Command {
this.newEmptyLayerId = await this._createAndActivateEmptyLayer();
// 设置普通图层的裁剪对象为衣服底图
if (this.redGreenImage) {
if (backgroundObject) {
// const clipPathImg = this.redGreenImage;
// clipPathImg.set({
// absolutePositioned: true,
@@ -144,7 +147,7 @@ export class BatchInitializeRedGreenModeCommand extends Command {
// 克隆衣服底图作为裁剪对象
this.redGreenImageMask = await new Promise((resolve, reject) => {
this.redGreenImage.clone((clonedImg) => {
backgroundObject.clone((clonedImg) => {
if (!clonedImg) {
reject(new Error("无法克隆红绿图"));
return;
@@ -366,6 +369,10 @@ export class BatchInitializeRedGreenModeCommand extends Command {
fill: "transparent", // 确保背景是透明的
});
}
object.setCoords();
return object;
}
/**