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