feat: 添加图层缩略图更新功能,优化变换命令执行后的图层状态
This commit is contained in:
@@ -60,6 +60,19 @@ export class TransformCommand extends Command {
|
|||||||
// 应用最终变换状态
|
// 应用最终变换状态
|
||||||
await this._applyTransform(targetObject, this.finalState);
|
await this._applyTransform(targetObject, this.finalState);
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
// 现在图层就是元素本身,直接更新元素的缩略图
|
||||||
|
this?.layerManager?.canvasManager?.thumbnailManager?.generateLayerThumbnail?.(
|
||||||
|
this.layer.id
|
||||||
|
);
|
||||||
|
if (this.parent) {
|
||||||
|
// 如果有父图层,更新父图层的缩略图
|
||||||
|
this?.layerManager?.canvasManager?.thumbnailManager?.generateLayerThumbnail?.(
|
||||||
|
this.parent.id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}, 300);
|
||||||
|
|
||||||
// 触发画布更新
|
// 触发画布更新
|
||||||
this.canvas.renderAll();
|
this.canvas.renderAll();
|
||||||
|
|
||||||
@@ -86,6 +99,18 @@ export class TransformCommand extends Command {
|
|||||||
// 应用初始变换状态
|
// 应用初始变换状态
|
||||||
await this._applyTransform(targetObject, this.initialState);
|
await this._applyTransform(targetObject, this.initialState);
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
// 现在图层就是元素本身,直接更新元素的缩略图
|
||||||
|
this?.layerManager?.canvasManager?.thumbnailManager?.generateLayerThumbnail?.(
|
||||||
|
this.layer.id
|
||||||
|
);
|
||||||
|
if (this.parent) {
|
||||||
|
// 如果有父图层,更新父图层的缩略图
|
||||||
|
this?.layerManager?.canvasManager?.thumbnailManager?.generateLayerThumbnail?.(
|
||||||
|
this.parent.id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}, 300);
|
||||||
// 触发画布更新
|
// 触发画布更新
|
||||||
this.canvas.renderAll();
|
this.canvas.renderAll();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user