Skip to content

Commit

Permalink
docs: update content
Browse files Browse the repository at this point in the history
  • Loading branch information
inottn committed Dec 26, 2023
1 parent 5091bef commit d6a743f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
21 changes: 18 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const miniposter = new MiniPoster(canvas, config);

可绘制的元素类型如下:

### container
### type: container

```js
const container = {
Expand All @@ -129,7 +129,7 @@ const container = {
| overflow | 'visible' \| 'hidden' | 'visible' | 子元素溢出时的行为,可参考对应 CSS 属性 |
| children | object[] | - | 子元素 |

### image
### type: image

```js
const image = {
Expand All @@ -148,7 +148,7 @@ const image = {
| borderRadius | number | 0 | 边框圆角 |
| objectFit | 'fill' \| 'contain' \| 'cover' | 'fill' | 图片的展示模式,可参考对应 CSS 属性 |

### text
### type: text

```js
const text = {
Expand Down Expand Up @@ -176,3 +176,18 @@ const text = {
## miniposter.getSize(id)

获取指定元素的宽高信息

## miniposter.export(config)

将当前画布指定区域导出为图片

| 字段名 | 类型 | 默认值 | 说明 |
| ---------- | -------------- | -------- | --------------------------------------------------------------------------- |
| x | number | 0 | 指定的画布区域的左上角横坐标 |
| y | number | 0 | 指定的画布区域的左上角纵坐标 |
| width | number | 画布宽度 | 指定的画布区域的宽度 |
| height | number | 画布高度 | 指定的画布区域的高度 |
| destWidth | number | 画布宽度 | 输出的图片的宽度 |
| destHeight | number | 画布高度 | 输出的图片的高度 |
| fileType | 'png' \| 'jpg' | 'png' | 目标文件的类型 |
| quality | number | 1 | 图片的质量,目前仅对 jpg 有效。取值范围为 (0, 1],不在范围内时当作 1 处理。 |
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
"test:coverage": "vitest --coverage",
"lint": "eslint ./src --ext .js,.ts,.mjs,.cjs",
"lint:tsc": "tsc --noEmit --skipLibCheck",
"docs:dev": "pnpm -C docs run dev",
"docs:build": "pnpm -C docs run build",
"prepare": "husky install"
},
"publishConfig": {
Expand Down

0 comments on commit d6a743f

Please sign in to comment.