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
5295e7ef
Commit
5295e7ef
authored
Apr 07, 2022
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
边框绘制
parent
87a3c689
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
toCanvas.ts
src/toCanvas.ts
+9
-3
test.html
test.html
+3
-2
No files found.
src/toCanvas.ts
View file @
5295e7ef
...
...
@@ -67,7 +67,7 @@ export interface RenderOptions {
*/
export
async
function
toCanvas
(
data
:
ICData
,
options
:
RenderOptions
=
{},
callback
?:
(
canvas
:
HTMLCanvasElement
)
=>
void
):
Promise
<
HTMLCanvasElement
|
string
>
{
const
{
type
:
exportType
=
'png'
,
quality
=
0.7
}
=
options
let
{
scale
:
dpiScale
=
1
}
=
options
let
{
scale
:
dpiScale
=
1
}
=
options
const
scale
=
(
window
[
'devicePixelRatio'
]
||
1
)
*
dpiScale
...
...
@@ -146,9 +146,15 @@ export async function toCanvas(data: ICData, options: RenderOptions = {}, callba
break
}
if
(
n
.
host
)
{
if
(
!
n
.
maskBegin
)
{
let
node
=
n
if
(
n
.
host
){
node
=
n
.
host
}
//边框
if
(
n
.
host
.
borderWidth
)
drawBorder
(
n
.
host
,
ctx
,
scale
)
if
(
node
.
borderWidth
)
{
drawBorder
(
node
,
ctx
,
scale
)
}
}
if
(
n
.
maskEnd
)
{
...
...
test.html
View file @
5295e7ef
...
...
@@ -79,7 +79,8 @@
word-wrap
:
break-word
;
font-family
:
Arial
;
font-style
:
italic
;
background-color
:
red
;
/*background-color: red;*/
border
:
1px
solid
red
;
}
</style>
...
...
@@ -107,7 +108,7 @@
<script
type=
"text/babel"
>
ReactDOM
.
render
(
<
div
id
=
"poster"
className
=
"poster"
>
<
img
className
=
"img"
src
=
"//yun.duiba.com.cn/aurora/14e3d0fa0e1ff54553a2c8c094b1caffd90f0a43.png"
/>
{
/*<img className="img" src="//yun.duiba.com.cn/aurora/14e3d0fa0e1ff54553a2c8c094b1caffd90f0a43.png"/>*/
}
<
div
><
p
className
=
"ppp"
>
hello
<
/p></
div
>
<
/div>
,
document
.
getElementById
(
'app'
)
...
...
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