feat: 优化填充组图层背景命令,支持实时更新和撤销功能,改进填充对象的处理逻辑
This commit is contained in:
@@ -228,18 +228,18 @@ export class RasterizeLayerCommand extends Command {
|
||||
const objectsWithZIndex = [];
|
||||
|
||||
this.layersToRasterize.forEach((layer) => {
|
||||
if (layer.fill) {
|
||||
const { object } = findObjectById(this.canvas, layer.fill.id);
|
||||
if (object) {
|
||||
// 获取对象在画布中的z-index(数组索引)
|
||||
const zIndex = allCanvasObjects.indexOf(object);
|
||||
objectsWithZIndex.push({
|
||||
object: object,
|
||||
zIndex: zIndex,
|
||||
layerObj: layer.fill,
|
||||
});
|
||||
}
|
||||
}
|
||||
// if (layer.fill) {
|
||||
// const { object } = findObjectById(this.canvas, layer.fill.id);
|
||||
// if (object) {
|
||||
// // 获取对象在画布中的z-index(数组索引)
|
||||
// const zIndex = allCanvasObjects.indexOf(object);
|
||||
// objectsWithZIndex.push({
|
||||
// object: object,
|
||||
// zIndex: zIndex,
|
||||
// layerObj: layer.fill,
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
if (layer.fabricObjects && layer.fabricObjects.length > 0) {
|
||||
layer.fabricObjects.forEach((layerObj) => {
|
||||
if (layerObj && layerObj.id) {
|
||||
@@ -532,18 +532,18 @@ export class ExportLayerToImageCommand extends Command {
|
||||
const objectsWithZIndex = [];
|
||||
|
||||
this.layersToRasterize.forEach((layer) => {
|
||||
if (layer.fill) {
|
||||
const { object } = findObjectById(this.canvas, layer.fill.id);
|
||||
if (object) {
|
||||
// 获取对象在画布中的z-index(数组索引)
|
||||
const zIndex = allCanvasObjects.indexOf(object);
|
||||
objectsWithZIndex.push({
|
||||
object: object,
|
||||
zIndex: zIndex,
|
||||
layerObj: layer.fill,
|
||||
});
|
||||
}
|
||||
}
|
||||
// if (layer.fill) {
|
||||
// const { object } = findObjectById(this.canvas, layer.fill.id);
|
||||
// if (object) {
|
||||
// // 获取对象在画布中的z-index(数组索引)
|
||||
// const zIndex = allCanvasObjects.indexOf(object);
|
||||
// objectsWithZIndex.push({
|
||||
// object: object,
|
||||
// zIndex: zIndex,
|
||||
// layerObj: layer.fill,
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
if (layer.fabricObjects && layer.fabricObjects.length > 0) {
|
||||
layer.fabricObjects.forEach((layerObj) => {
|
||||
if (layerObj && layerObj.id) {
|
||||
|
||||
Reference in New Issue
Block a user