Merge branch 'dev_vite' of ssh://18.167.251.121:10002/aidlab/aida_front into dev_vite
This commit is contained in:
@@ -2569,7 +2569,6 @@ export class CreateImageLayerCommand extends Command {
|
|||||||
this.fabricImage = options.fabricImage;
|
this.fabricImage = options.fabricImage;
|
||||||
this.toolManager = options.toolManager;
|
this.toolManager = options.toolManager;
|
||||||
this.layerName = options.layerName || null;
|
this.layerName = options.layerName || null;
|
||||||
|
|
||||||
this.imageId = generateId("image_");
|
this.imageId = generateId("image_");
|
||||||
|
|
||||||
// 存储执行过程中的结果
|
// 存储执行过程中的结果
|
||||||
@@ -2617,6 +2616,18 @@ export class CreateImageLayerCommand extends Command {
|
|||||||
this.commands.push(createLayerCmd);
|
this.commands.push(createLayerCmd);
|
||||||
this.executedCommands.push(createLayerCmd);
|
this.executedCommands.push(createLayerCmd);
|
||||||
|
|
||||||
|
// 新加功能-选区套索内添加图片自动居中
|
||||||
|
const { parent } = findLayerRecursively(this.layerManager.layers.value, this.newLayerId);
|
||||||
|
if(parent && parent.selectObject){
|
||||||
|
let {top,left,width,height} = parent.selectObject;
|
||||||
|
const ltop = top + height / 2;
|
||||||
|
const lleft = left + width / 2;
|
||||||
|
this.fabricImage.set({
|
||||||
|
top: ltop,
|
||||||
|
left: lleft,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 2. 添加图片对象到图层命令
|
// 2. 添加图片对象到图层命令
|
||||||
const addObjectCmd = new AddObjectToLayerCommand({
|
const addObjectCmd = new AddObjectToLayerCommand({
|
||||||
canvas: this.layerManager.canvas,
|
canvas: this.layerManager.canvas,
|
||||||
@@ -4197,6 +4208,7 @@ export class RemoveChildLayerCommand extends Command {
|
|||||||
this.isActiveLayer = this.layerId === this.activeLayerId.value;
|
this.isActiveLayer = this.layerId === this.activeLayerId.value;
|
||||||
|
|
||||||
this.originalObjects = this.canvas.getObjects().filter((obj) => {
|
this.originalObjects = this.canvas.getObjects().filter((obj) => {
|
||||||
|
obj.parentId = this.parentId;
|
||||||
return obj.layerId === this.layerId;
|
return obj.layerId === this.layerId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -398,7 +398,7 @@ const handleToolClick = (tool) => {
|
|||||||
.tools-list{
|
.tools-list{
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 1.0rem;
|
gap: 0.7rem;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
|
|||||||
@@ -706,7 +706,8 @@ export class CanvasEventManager {
|
|||||||
if (e.target.id) {
|
if (e.target.id) {
|
||||||
// 如果该元素是分组图层的一部分,也更新分组图层的缩略图
|
// 如果该元素是分组图层的一部分,也更新分组图层的缩略图
|
||||||
if (e.target.parentId) {
|
if (e.target.parentId) {
|
||||||
setTimeout(() => this.updateLayerThumbnail(e.target.parentId), 50);
|
// setTimeout(() => this.updateLayerThumbnail(e.target.parentId), 50);
|
||||||
|
this.thumbnailManager.generateLayerThumbnail(e.target.parentId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user