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
Hide 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 {
...
@@ -67,7 +67,7 @@ export interface RenderOptions {
*/
*/
export
async
function
toCanvas
(
data
:
ICData
,
options
:
RenderOptions
=
{},
callback
?:
(
canvas
:
HTMLCanvasElement
)
=>
void
):
Promise
<
HTMLCanvasElement
|
string
>
{
export
async
function
toCanvas
(
data
:
ICData
,
options
:
RenderOptions
=
{},
callback
?:
(
canvas
:
HTMLCanvasElement
)
=>
void
):
Promise
<
HTMLCanvasElement
|
string
>
{
const
{
type
:
exportType
=
'png'
,
quality
=
0.7
}
=
options
const
{
type
:
exportType
=
'png'
,
quality
=
0.7
}
=
options
let
{
scale
:
dpiScale
=
1
}
=
options
let
{
scale
:
dpiScale
=
1
}
=
options
const
scale
=
(
window
[
'devicePixelRatio'
]
||
1
)
*
dpiScale
const
scale
=
(
window
[
'devicePixelRatio'
]
||
1
)
*
dpiScale
...
@@ -146,9 +146,15 @@ export async function toCanvas(data: ICData, options: RenderOptions = {}, callba
...
@@ -146,9 +146,15 @@ export async function toCanvas(data: ICData, options: RenderOptions = {}, callba
break
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
)
{
if
(
n
.
maskEnd
)
{
...
...
test.html
View file @
5295e7ef
...
@@ -79,7 +79,8 @@
...
@@ -79,7 +79,8 @@
word-wrap
:
break-word
;
word-wrap
:
break-word
;
font-family
:
Arial
;
font-family
:
Arial
;
font-style
:
italic
;
font-style
:
italic
;
background-color
:
red
;
/*background-color: red;*/
border
:
1px
solid
red
;
}
}
</style>
</style>
...
@@ -107,7 +108,7 @@
...
@@ -107,7 +108,7 @@
<script
type=
"text/babel"
>
<script
type=
"text/babel"
>
ReactDOM
.
render
(
ReactDOM
.
render
(
<
div
id
=
"poster"
className
=
"poster"
>
<
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
><
p
className
=
"ppp"
>
hello
<
/p></
div
>
<
/div>
,
<
/div>
,
document
.
getElementById
(
'app'
)
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