fix
This commit is contained in:
@@ -123,8 +123,7 @@ export default defineComponent({
|
||||
for (const [allItemIndex, allItem] of allBoardData.value[key].entries()) {
|
||||
await new Promise((resolve,reject)=>{
|
||||
if(key == 'colorBoards'){
|
||||
position.x = 0
|
||||
position.y += position.height
|
||||
|
||||
var text = new fabric.Text(allItem.tcx, {
|
||||
left: 0,
|
||||
top: 60,
|
||||
@@ -141,16 +140,21 @@ export default defineComponent({
|
||||
fontFamily: 'Arial',
|
||||
textAlign: "left",
|
||||
});
|
||||
let width = 110>text1.width?110:text1.width
|
||||
var color = new fabric.Rect({
|
||||
width: 130>text1.width?130:text1.width,
|
||||
width: width,
|
||||
height: 60,
|
||||
textAlign: "left",
|
||||
fill: `rgb(${allItem.r},${allItem.g},${allItem.b})`,
|
||||
fill: `rgb(${allItem.rgbValue.r},${allItem.rgbValue.g},${allItem.rgbValue.b})`,
|
||||
});
|
||||
if((position.x+width > canvasWH.value.width) || (oldKey != key)){
|
||||
position.x = 0
|
||||
position.y += position.height
|
||||
}
|
||||
var group = new fabric.Group([color, text, text1], {
|
||||
left: position.x,
|
||||
top: position.y,
|
||||
width:130,
|
||||
width:width,
|
||||
fill:'rgb(255,255,255)',
|
||||
cornerSize: 10, // 选中时,角的大小为20
|
||||
transparentCorners: false, // 选中时,角是被填充了。true 空心;false 实心
|
||||
@@ -159,6 +163,8 @@ export default defineComponent({
|
||||
});
|
||||
// 将矩形对象添加到 canvas 中
|
||||
canvas.add(group);
|
||||
oldKey = key
|
||||
position.x += width + margin
|
||||
position.height = group.height+margin
|
||||
resolve()
|
||||
}else{
|
||||
@@ -184,9 +190,10 @@ export default defineComponent({
|
||||
// lockRotation:true,
|
||||
// lockScalingX:true,
|
||||
lockRotation:true,
|
||||
crossOrigin: 'anonymous',
|
||||
transparentCorners: false, // 选中时,角是被填充了。true 空心;false 实心
|
||||
// cornerColor: "#a1de93", // 选中时,角的颜色是 青色
|
||||
},{ crossOrigin: 'Anonymous' })
|
||||
})
|
||||
position.height = img.height*scaleWH+margin
|
||||
if(key == 'sketchboardFiles'){
|
||||
position.x += img.width*scaleWH+margin
|
||||
@@ -227,7 +234,7 @@ export default defineComponent({
|
||||
canvas.add(img);
|
||||
oldKey = key
|
||||
resolve()
|
||||
})
|
||||
},{crossOrigin: 'Anonymous'})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user