feat: 更新填充组图层背景命令,增强图层管理和颜色填充功能,优化图层选择和渲染逻辑
This commit is contained in:
@@ -89,6 +89,7 @@ export class LayerManager {
|
||||
this.activeLayerId = options.activeLayerId;
|
||||
this.commandManager = options.commandManager;
|
||||
this.canvasManager = options.canvasManager || null;
|
||||
this.lastSelectLayerId = options.lastSelectLayerId || { value: null }; // 上次选中的图层ID
|
||||
|
||||
this.backgroundFillManager = new BackgroundFillManager({
|
||||
canvas: this.canvas,
|
||||
@@ -394,6 +395,7 @@ export class LayerManager {
|
||||
* @param {boolean} undoable 是否可撤销
|
||||
*/
|
||||
async fillLayerBackground(layerId, fillColor, undoable = true) {
|
||||
layerId = this.activeLayerId.value || layerId;
|
||||
await this.backgroundFillManager.fillLayerBackground(layerId, fillColor, undoable);
|
||||
}
|
||||
|
||||
@@ -708,6 +710,7 @@ export class LayerManager {
|
||||
* @param {string} layerId 图层ID
|
||||
*/
|
||||
setActiveLayer(layerId, options = {}) {
|
||||
// this.lastSelectLayerId.value = layerId; // 更新最后选择的图层ID
|
||||
if (layerId === this.activeLayerId.value) {
|
||||
console.warn("当前图层已是活动图层,无需重复设置");
|
||||
return;
|
||||
@@ -953,13 +956,13 @@ export class LayerManager {
|
||||
}
|
||||
}
|
||||
|
||||
if (child.fill) {
|
||||
// 如果图层有填充颜色,设置所有对象的填充颜色
|
||||
const { object } = findObjectById(this.canvas, child.fill.id);
|
||||
if (object) {
|
||||
acc.push(object);
|
||||
}
|
||||
}
|
||||
// if (child.fill) {
|
||||
// // 如果图层有填充颜色,设置所有对象的填充颜色
|
||||
// const { object } = findObjectById(this.canvas, child.fill.id);
|
||||
// if (object) {
|
||||
// acc.push(object);
|
||||
// }
|
||||
// }
|
||||
|
||||
return acc;
|
||||
}, []);
|
||||
|
||||
Reference in New Issue
Block a user