Commit 47dface0 authored by wjf's avatar wjf

l

parent 1d950373
......@@ -45,6 +45,9 @@ interface INodeData {
'backgroundImage'?,
'borderColor'?,
'borderWidth'?,
maskBegin?:boolean,
maskEnd?:boolean,
}
export interface RenderOptions {
......@@ -116,6 +119,13 @@ export async function toCanvas(data: ICData, options: RenderOptions = {}, callba
})
if (p.length) await Promise.all(p)
nodes.forEach((n) => {
if(n.maskBegin){
ctx.save();
ctx.globalAlpha = 0;
drawBackgroundColor(n,ctx,scale)
ctx.globalAlpha = 1;//可能不需要
ctx.clip()
}
//通用属性先绘制,背景颜色,边框等等
//背景颜色
if (n.backgroundColor) drawBackgroundColor(n, ctx, scale)
......@@ -133,6 +143,10 @@ export async function toCanvas(data: ICData, options: RenderOptions = {}, callba
drawText(n, ctx, scale)
break
}
if(n.maskEnd){
ctx.restore();
}
})
let result: any = canvas
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment