chore: plugin test

This commit is contained in:
Yanyan-Wang 2021-01-07 14:34:35 +08:00 committed by Yanyan Wang
parent f44ad3fa75
commit f9e4a0dc73
10 changed files with 137 additions and 6 deletions

View File

@ -5,6 +5,7 @@
- chore: ts lint;
- feat: getEdgeConfig for create-edge behavior;
- fix: uniqueId with timestamp and random;
- fix: fix zoom-canvas and drag-canvas with enableOptimize conflict problem shrink the settimeout;
#### 4.1.0-beta.1

View File

@ -246,7 +246,7 @@ export default {
}
}
}
}, 500);
}, 100);
this.set('timeout', timeout);
}

View File

@ -50,7 +50,7 @@ describe('zoom-canvas', () => {
default: [
{
type: 'zoom-canvas',
// enableOptimize: true
// enableOptimize: true,
},
],
},

View File

@ -18,4 +18,8 @@ module.exports = {
diagnostics: false,
},
},
testPathIgnorePatterns: [
'/tests/unit/image-minimap-spec.ts',
'/tests/unit/edge-filter-lens-spec.ts',
],
};

View File

@ -1,6 +1,6 @@
---
title: Clear/Destroy Canvas
order: 17
order: 18
---
### graph.clear()

View File

@ -1,6 +1,6 @@
---
title: 清除/销毁画布
order: 17
order: 18
---
### graph.clear()

View File

@ -1,6 +1,6 @@
---
title: Export Image
order: 16
order: 17
---
### graph.downloadFullImage(name, type, imageConfig)

View File

@ -1,6 +1,6 @@
---
title: 导出图片
order: 16
order: 17
---
### graph.downloadFullImage(name, type, imageConfig)

View File

@ -0,0 +1,63 @@
---
title: Water Marker
order: 16
---
### graph.setTextWaterMarker(texts, config)
Add text water marker for the canvas. Note that, images downloaded by `downloadImage` or `downloadFullImage` will not contains the water markers.
**Parameters**
| Name | Type | Required | Description |
| --- | --- | --- | --- |
| texts | String[] | true | The text array for the water marker, the each item in the array with take one line |
| config | Object | false | The configurations for the text water marker, the properties are listed below |
`config` is the configurations for the text water marker with:
| Name | Type | Required | Description |
| --- | --- | --- | --- |
| width | Number | false | The width of a single marker, which controls the horizontal space between two single markers, `150` by default |
| height | Number | false | The height of a single marker, which controls the vertical space between two single markers, `100` by default |
| compatible | Boolean | false | Whether compatible with the browsers which does not support `pointer-events`, `false` by default |
| text | Object | false | The style sttributes for the text shapes, the default value is: `{ x: 0, y: 60, lineHeight: 20, rotate: 20, fontSize: 14, fontFamily: 'Microsoft YaHei', fill: 'rgba(0, 0, 0, 0.1)', baseline: 'Middle', }` |
**Usage**
```javascript
graph.setTextWaterMarker(['AntV', 'G6']);
```
### graph.setImageWaterMarker(imgURL, config)
Add image water markers for the graph. Note that, images downloaded by `downloadImage` or `downloadFullImage` will not contains the water markers.
**Parameters**
| Name | Type | Required | Description |
| --- | --- | --- | --- |
| imgURL | String[] | true | The url of the image for the water marker, the default value is `'https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg'` |
| config | Object | false | The configurations for the image watermarker, the properties are listed below |
`config` is the configurations for the image water marker with:
| Name | Type | Required | Description |
| --- | --- | --- | --- |
| width | Number | false | The width of a single marker, which controls the horizontal space between two single markers, `150` by default |
| height | Number | false | The height of a single marker, which controls the vertical space between two single markers, `130` by default |
| compatible | Boolean | false | Whether compatible with the browsers which does not support `pointer-events`, `false` by default |
| image | Object | false | The style sttributes for the image shapes, the default value is: `{ x: 0, y: 0, width: 30, height: 20, rotate: 0 }` |
**Usage**
```javascript
graph.setImageWaterMarker(
'https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg',
{
width: 300,
height: 200,
image: { rotate: Math.PI / 3 },
},
);
```

View File

@ -0,0 +1,63 @@
---
title: 增加水印
order: 16
---
### graph.setTextWaterMarker(texts, config)
为画布添加文字水印。注意,使用 `downloadImage``downloadFullImage` 下载图片将不会带有水印。
**参数**
| 名称 | 类型 | 是否必选 | 描述 |
| ------ | -------- | -------- | ---------------------------------------- |
| texts | String[] | true | 水印文字内容数组,数组中的不同项将会换行 |
| config | Object | false | 文字水印配置项,可选,具体字段见下方 |
其中config 为文字水印配置项,具体字段:
| 名称 | 类型 | 是否必选 | 描述 |
| --- | --- | --- | --- |
| width | Number | false | 单个水印的宽,可控制单个水印之间的水平间距,默认 `150` |
| height | Number | false | 单个水印的高,可控制单个水印之间的竖直间距,默认 `100` |
| compatible | Boolean | false | 是否需要兼容不支持 `pointer-events` 属性的浏览器,默认为 `false` |
| text | Object | false | 文本图形的样式属性,默认为:`{ x: 0, y: 60, lineHeight: 20, rotate: 20, fontSize: 14, fontFamily: 'Microsoft YaHei', fill: 'rgba(0, 0, 0, 0.1)', baseline: 'Middle', }` |
**用法**
```javascript
graph.setTextWaterMarker(['AntV', 'G6']);
```
### graph.setImageWaterMarker(imgURL, config)
为画布添加图片水印。注意,使用 `downloadImage``downloadFullImage` 下载图片将不会带有水印。
**参数**
| 名称 | 类型 | 是否必选 | 描述 |
| --- | --- | --- | --- |
| imgURL | String[] | true | 水印图片,默认为 'https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg' |
| config | Object | false | 图片水印配置项,可选,具体字段见下方 |
其中config 为图片水印配置项,具体字段:
| 名称 | 类型 | 是否必选 | 描述 |
| --- | --- | --- | --- |
| width | Number | false | 单个水印的宽,可控制单个水印之间的水平间距,默认 `150` |
| height | Number | false | 单个水印的高,可控制单个水印之间的竖直间距,默认 `130` |
| compatible | Boolean | false | 是否需要兼容不支持 `pointer-events` 属性的浏览器,默认为 `false` |
| image | Object | false | 图片图形的样式属性,默认为:`{ x: 0, y: 0, width: 30, height: 20, rotate: 0 }` |
**用法**
```javascript
graph.setImageWaterMarker(
'https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg',
{
width: 300,
height: 200,
image: { rotate: Math.PI / 3 },
},
);
```