feat: 1.固定图层缩略图(完成)
2.工具栏新增插槽(完成) 3.loadJSON的元素顺序回发生错误
This commit is contained in:
@@ -348,14 +348,18 @@ export class CanvasManager {
|
||||
}
|
||||
}
|
||||
|
||||
setCanvasSize(width, height) {
|
||||
async setCanvasSize(width, height) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.canvas.setWidth(width);
|
||||
this.canvas.setHeight(height);
|
||||
|
||||
// 重置视图变换以确保元素位置正确
|
||||
this._resetViewportTransform();
|
||||
// this._resetViewportTransform();
|
||||
if (this.canvas.getZoom() !== 1 || this.canvas.viewportTransform[0] !== 1) {
|
||||
this.canvas.setViewportTransform([1, 0, 0, 1, 0, 0]);
|
||||
await this.resetZoom();
|
||||
}
|
||||
|
||||
// 居中所有画布元素,包括背景层和其他元素
|
||||
this.centerAllObjects();
|
||||
@@ -964,7 +968,6 @@ export class CanvasManager {
|
||||
this.layers.value,
|
||||
this.canvas.getObjects()
|
||||
);
|
||||
|
||||
// 验证图层关联关系 - 稳定后可以注释
|
||||
const isValidate = validateLayerAssociations(
|
||||
this.layers.value,
|
||||
@@ -972,6 +975,9 @@ export class CanvasManager {
|
||||
);
|
||||
|
||||
console.log("图层关联验证结果:", isValidate);
|
||||
// 排序
|
||||
// 使用LayerSort工具重新排列画布对象(如果可用)
|
||||
await this?.layerManager?.layerSort?.rearrangeObjects();
|
||||
|
||||
this.layerManager.activeLayerId.value =
|
||||
this.layers.value[0]?.id || parsedJson?.activeLayerId || null;
|
||||
|
||||
Reference in New Issue
Block a user