提交 e45fa81d 编写于 作者: L lanyill

Canvas js文档整改-3.1release

Signed-off-by: Nlanyill <lanyi3@huawei.com>
上级 2eb82e1e
...@@ -97,12 +97,36 @@ isPointInPath(path?: Path2D, x: number, y: number): boolean ...@@ -97,12 +97,36 @@ isPointInPath(path?: Path2D, x: number, y: number): boolean
- 示例 - 示例
``` ```
<!-- xxx.hml --> <!-- xxx.hml -->
<div style="width: 180px; height: 60px;"> <div class="container" style="width: 500px; height: 500px;">
<text>In path:{{textValue}}</text> <text class="textsize">In path:{{textValue}}</text>
<canvas ref="canvas" style="width: 500px; height: 500px; background-color: #ffff00;"></canvas> <canvas ref="canvas" style="width: 500px; height: 500px; background-color: #ffff00;"></canvas>
</div> </div>
``` ```
```
/* xxx.css */
.container {
display: flex;
flex-direction: column;
background-color: #F1F3F5;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
}
canvas {
width: 600px;
height: 600px;
background-color: #fdfdfd;
border: none;
}
.textsize {
font-size: 40px;
}
```
``` ```
// xxx.js // xxx.js
export default { export default {
...@@ -149,12 +173,36 @@ isPointInStroke(path?: Path2D, x: number, y: number): boolean ...@@ -149,12 +173,36 @@ isPointInStroke(path?: Path2D, x: number, y: number): boolean
- 示例 - 示例
``` ```
<!-- xxx.hml --> <!-- xxx.hml -->
<div style="width: 180px; height: 60px;"> <div class="container" style="width: 500px; height: 500px;">
<text>In path:{{textValue}}</text> <text class="textsize">In stroke:{{textValue}}</text>
<canvas ref="canvas" style="width: 500px; height: 500px; background-color: #ffff00;"></canvas> <canvas ref="canvas" style="width: 500px; height: 500px; background-color: #ffff00;"></canvas>
</div> </div>
``` ```
```
/* xxx.css */
.container {
display: flex;
flex-direction: column;
background-color: #F1F3F5;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
}
canvas {
width: 600px;
height: 600px;
background-color: #fdfdfd;
border: none;
}
.textsize {
font-size: 40px;
}
```
``` ```
// xxx.js // xxx.js
export default { export default {
...@@ -186,12 +234,36 @@ resetTransform(): void ...@@ -186,12 +234,36 @@ resetTransform(): void
- 示例 - 示例
``` ```
<!-- xxx.hml --> <!-- xxx.hml -->
<div style="width: 180px; height: 60px;"> <div class="container" style="width: 500px; height: 500px;">
<text>In path:{{textValue}}</text> <text class="textsize">In path:{{textValue}}</text>
<canvas ref="canvas" style="width: 500px; height: 500px; background-color: #ffff00;"></canvas> <canvas ref="canvas" style="width: 500px; height: 500px; background-color: #ffff00;"></canvas>
</div> </div>
``` ```
```
/* xxx.css */
.container {
display: flex;
flex-direction: column;
background-color: #F1F3F5;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
}
canvas {
width: 600px;
height: 600px;
background-color: #fdfdfd;
border: none;
}
.textsize {
font-size: 40px;
}
```
``` ```
//xxx.js //xxx.js
export default { export default {
......
...@@ -56,7 +56,7 @@ export default { ...@@ -56,7 +56,7 @@ export default {
path.closePath(); path.closePath();
// 门 // 门
path.moveTo(250, 450); path.moveTo(250, 450);
path.rect(250, 450, 350, 600); path.rect(250, 450, 100, 600);
path.closePath(); path.closePath();
// 烟囱 // 烟囱
path.moveTo(365, 250); path.moveTo(365, 250);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册