Merge remote-tracking branch 'origin/StableVersion' into develop
This commit is contained in:
@@ -295,6 +295,102 @@ function JSSetRemoveImage(fun){
|
||||
cornerSize: 24
|
||||
})
|
||||
}
|
||||
function JSSetGroup(data){
|
||||
let rect
|
||||
if(data.gradient){
|
||||
let colorStops = []
|
||||
data.gradient.gradientList.forEach(item=>{
|
||||
let obj = {
|
||||
offset:item.left.split('%')[0]/100,
|
||||
color:`rgba(${item.rgba.r},${item.rgba.g},${item.rgba.b},${item.rgba.a})`
|
||||
}
|
||||
colorStops.push(obj)
|
||||
})
|
||||
let { x0, y0, x1, y1 } = calculateGradientCoordinate(100,120,data.gradient.angle)
|
||||
let linear = new fabric.Gradient({
|
||||
type: 'linear', // 线性渐变
|
||||
// coords: { x1: 0, y1: 0, x2: 200, y2: 0 }, // 渐变方向
|
||||
coords: { x1:x0, y1:y0, x2:x1, y2:y1 }, // 渐变方向
|
||||
colorStops: colorStops,
|
||||
})
|
||||
var color = new fabric.Rect({
|
||||
top:0,
|
||||
left:0,
|
||||
width: 110,
|
||||
height: 130,
|
||||
textAlign: "left",
|
||||
fill: linear // 设置渐变填充
|
||||
// fill: `rgb(${data.rgbValue.r},${data.rgbValue.g},${data.rgbValue.b})`,
|
||||
});
|
||||
var text = new fabric.Text('',{
|
||||
left: 0,
|
||||
top: 0,
|
||||
fontSize: 0,
|
||||
fontFamily: "Arial",
|
||||
textAlign: "left",
|
||||
fill: "black",
|
||||
});
|
||||
let text1 = new fabric.Text('',{
|
||||
left: 0,
|
||||
top: 0,
|
||||
width: 20,
|
||||
fontSize: 0,
|
||||
fontFamily: "Arial",
|
||||
textAlign: "left",
|
||||
});
|
||||
rect = {text,text1,color,width:110}
|
||||
}else{
|
||||
var text = new fabric.Text(data.tcx,{
|
||||
left: 0,
|
||||
top: 60,
|
||||
fontSize: 14,
|
||||
fontFamily: "Arial",
|
||||
textAlign: "left",
|
||||
fill: "black",
|
||||
});
|
||||
let text1 = new fabric.Text(data.name,{
|
||||
left: 0,
|
||||
top: 80,
|
||||
width: 20,
|
||||
fontSize: 14,
|
||||
fontFamily: "Arial",
|
||||
textAlign: "left",
|
||||
});
|
||||
let width = 110 > text1.width ? 110 : text1.width;
|
||||
var color = new fabric.Rect({
|
||||
width: width,
|
||||
height: 60,
|
||||
textAlign: "left",
|
||||
fill: `rgb(${data.rgbValue.r},${data.rgbValue.g},${data.rgbValue.b})`,
|
||||
});
|
||||
rect = {text,text1,color,width}
|
||||
}
|
||||
return rect
|
||||
}
|
||||
function JSSetPencil(str,canvas){
|
||||
let pencil
|
||||
if(str == 'PencilBrush'){
|
||||
pencil = new fabric.PencilBrush(canvas,{}); //普通笔
|
||||
}else if(str == 'Marking'){
|
||||
pencil = new fabric.PencilBrush(canvas,); //记号笔
|
||||
}else if(str == 'InkBrush'){
|
||||
pencil = new fabric.InkBrush(canvas,{}); //油画笔
|
||||
}else if(str=='CrayonBrush'){
|
||||
pencil = new fabric.CrayonBrush(canvas,{}); //蜡笔
|
||||
}else if(str == 'RibbonBrush'){
|
||||
pencil = new fabric.RibbonBrush(canvas,{width: 1,}); //色带
|
||||
}else if(str == 'MarkerBrush'){
|
||||
pencil = new fabric.MarkerBrush(canvas,{}); //书写笔
|
||||
// pencil = new fabric.PenBrush(canvas,{}); //书写笔
|
||||
}else if(str == 'WritingBrush'){
|
||||
pencil = new fabric.WritingBrush(canvas,{}); //毛笔
|
||||
}else if(str == 'LongfurBrush'){
|
||||
pencil = new fabric.LongfurBrush(canvas,{width: 1,}); //色带
|
||||
}else if(str == 'SpraypaintBrush'){
|
||||
pencil = new fabric.SpraypaintBrush(canvas,{}); //长毛刷
|
||||
}
|
||||
return pencil
|
||||
}
|
||||
export {
|
||||
multiselectJS,
|
||||
JSRectUpdata,
|
||||
@@ -304,5 +400,7 @@ export {
|
||||
JScreateCheck,
|
||||
exportSele,
|
||||
JSSetTexture,
|
||||
JSSetRemoveImage
|
||||
JSSetRemoveImage,
|
||||
JSSetGroup,
|
||||
JSSetPencil,
|
||||
}
|
||||
Reference in New Issue
Block a user