feat(CanvasManager): enhance image layer management and event handling

This commit is contained in:
bighuixiang
2025-06-26 00:37:07 +08:00
parent afa3b69f71
commit 2fcba962d1
16 changed files with 901 additions and 448 deletions

View File

@@ -569,7 +569,7 @@ export class LayerManager {
* @param {string} layerId 目标图层ID如果不提供则使用当前活动图层
* @returns {Object} 添加的对象
*/
addObjectToLayer(fabricObject, layerId = null) {
addObjectToLayer(fabricObject, layerId = null, options = {}) {
const targetLayerId = layerId || this.activeLayerId.value;
// 如果没有指定图层ID也没有活动图层则返回错误
@@ -597,6 +597,9 @@ export class LayerManager {
layerManager: this,
});
// 设置命令的撤销状态
if (isBoolean(options.undoable)) command.undoable = options.undoable; // 是否撤销
// 执行命令
if (this.commandManager) {
this.commandManager.execute(command);