fix
This commit is contained in:
@@ -429,8 +429,7 @@ class MyCanvas {
|
||||
getActiveObject &&
|
||||
getActiveObject.custom.dashed &&
|
||||
this.layer.selectLayer.group.custom?.groupType == 'Grid' &&
|
||||
this.operation == 'movePosition' &&
|
||||
getActiveObject._objects.length == 1
|
||||
this.operation == 'movePosition'
|
||||
){
|
||||
this.setclipPathImg()
|
||||
}
|
||||
@@ -625,7 +624,6 @@ class MyCanvas {
|
||||
});
|
||||
MyCanvas.canvas.bringToFront(this.createPatterning.polyLineBtn);//设置优先级最高
|
||||
}else if(this.operation){
|
||||
console.log(23232);
|
||||
this.createPatterning.state = false
|
||||
MyCanvas.canvas.renderAll();
|
||||
if(this.operation == 'dashed'){
|
||||
@@ -642,8 +640,7 @@ class MyCanvas {
|
||||
async setclipPathImg(){//裁剪图片
|
||||
if(!this.clipPath.clipGroup)return
|
||||
this.clipPath.isImg = true
|
||||
|
||||
let clipPathElement = this.clipPath.clipGroup._objects.filter(obj => obj.type != 'image')[0]
|
||||
let clipPathElement = this.clipPath.clipGroup._objects.filter(obj => obj.custom)[0]
|
||||
let imgBG = MyCanvas.canvas.getObjects().filter(obj => obj.custom.isSelectable && obj.type == 'rect')[0];
|
||||
let position = {
|
||||
left:this.clipPath.clipGroup?.left - (imgBG.left?imgBG.left:0),
|
||||
@@ -1432,7 +1429,8 @@ class MyCanvas {
|
||||
height: MyCanvas.canvas.height
|
||||
}))
|
||||
}
|
||||
addLayer(options){
|
||||
async addLayer(options){
|
||||
console.log(options);
|
||||
if(this.createPatterning.state)return
|
||||
this.clipPath.clipGroup = MyCanvas.canvas.getObjects().filter(obj => obj.custom?.dashed)?.[0];
|
||||
if (options.target.type === 'group' && options.target.custom?.layerId) return;
|
||||
@@ -1472,8 +1470,35 @@ class MyCanvas {
|
||||
})
|
||||
|
||||
if(!options?.target?.custom?.dashed && this.layer.selectLayer.group.custom.groupType == 'Grid'){
|
||||
console.log(this.layer.selectLayer.group);
|
||||
this.layer.selectLayer.group.add(options.target)
|
||||
await new Promise((resolve, reject) => {
|
||||
let clipPathElement = this.clipPath.clipGroup._objects.filter(obj => obj.custom)[0]
|
||||
let clipPathLect = this.clipPath.clipGroup.left
|
||||
let clipPathTop = this.clipPath.clipGroup.top
|
||||
|
||||
clipPathElement.clone((clipPathElementCloned)=>{
|
||||
clipPathElementCloned.set({
|
||||
// left:this.clipPath.clipGroup.left,
|
||||
// top:this.clipPath.clipGroup.top,
|
||||
left:clipPathLect,
|
||||
top:clipPathTop,
|
||||
absolutePositioned:true,
|
||||
})
|
||||
let optionLect = (options.target.left - this.clipPath.clipGroup.left) - this.clipPath.clipGroup.width/2
|
||||
let optionTop = (options.target.top - this.clipPath.clipGroup.top) - this.clipPath.clipGroup.height/2
|
||||
options.target.clone((cloned)=>{
|
||||
cloned.set({
|
||||
left:optionLect,
|
||||
top:optionTop,
|
||||
clipPath:clipPathElementCloned,
|
||||
})
|
||||
this.clipPath.clipGroup.add(cloned)
|
||||
console.log(this.clipPath.clipGroup);
|
||||
MyCanvas.canvas.remove(options.target)
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
// this.setGroupGrid('all')
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user