Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
html-shot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
劳工
html-shot
Commits
47dface0
Commit
47dface0
authored
Oct 08, 2021
by
wjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l
parent
1d950373
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
toCanvas.ts
src/toCanvas.ts
+14
-0
No files found.
src/toCanvas.ts
View file @
47dface0
...
@@ -45,6 +45,9 @@ interface INodeData {
...
@@ -45,6 +45,9 @@ interface INodeData {
'backgroundImage'
?,
'backgroundImage'
?,
'borderColor'
?,
'borderColor'
?,
'borderWidth'
?,
'borderWidth'
?,
maskBegin
?:
boolean
,
maskEnd
?:
boolean
,
}
}
export
interface
RenderOptions
{
export
interface
RenderOptions
{
...
@@ -116,6 +119,13 @@ export async function toCanvas(data: ICData, options: RenderOptions = {}, callba
...
@@ -116,6 +119,13 @@ export async function toCanvas(data: ICData, options: RenderOptions = {}, callba
})
})
if
(
p
.
length
)
await
Promise
.
all
(
p
)
if
(
p
.
length
)
await
Promise
.
all
(
p
)
nodes
.
forEach
((
n
)
=>
{
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
)
if
(
n
.
backgroundColor
)
drawBackgroundColor
(
n
,
ctx
,
scale
)
...
@@ -133,6 +143,10 @@ export async function toCanvas(data: ICData, options: RenderOptions = {}, callba
...
@@ -133,6 +143,10 @@ export async function toCanvas(data: ICData, options: RenderOptions = {}, callba
drawText
(
n
,
ctx
,
scale
)
drawText
(
n
,
ctx
,
scale
)
break
break
}
}
if
(
n
.
maskEnd
){
ctx
.
restore
();
}
})
})
let
result
:
any
=
canvas
let
result
:
any
=
canvas
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment