# Annotation

#### new Annotation()

Description:

  - Annotation构造函数。

### Methods

#### boardReRenderWH(width, height)

Description:

  - 根据宽高重新渲染画布及画布内的所有批注

##### Parameters:

Name | Type | Description
--- | --- | ---
`width` | int | 宽
`height` | int | 高

#### clear()

Description:

  - 注释清除

#### clearCurrEraser()

Description:

  - 清除橡皮擦

#### clearCurrHlightPoint()

Description:

  - 清除激光笔

#### delImg()

Description:

  - 删除当前高亮的图片

#### download()

Description:

  - 下载白板，带批注和背景

##### Example

    annotation.download();

#### hlightPointInit()

Description:

  - 设置激光笔

#### init(annoDiv, annotationInitType)

Description:

  - 初始化annotation对象

##### Parameters:

Name | Type | Description
--- | --- | ---
`annoDiv` | HTMLDivElement | 注释所在的应用层容器，只能传入div元素
`annotationInitType` | String | 注释初始化类型 可选值: AnnotationInitTypeEnum.proportional, AnnotationInitTypeEnum.full

#### redo()

Description:

  - 注释重做下一步

#### redoShape()

Description:

  - 执行撤销批注对象

#### rotateImg()

Description:

  - 顺时针旋转当前高亮的图片

#### scaleImg(isEnlarge, percentage)

Description:

  - 缩放当前高亮的图片

##### Parameters:

Name | Type | Description
--- | --- | ---
`isEnlarge` | boolean | 是否放大，true为放大，false为缩小
`percentage` | number | 缩放比例，小数，例如0.1

#### setAllowEditImg(isAllow)

Description:

  - 设置图片的编辑状态

##### Parameters:

Name | Type | Description
--- | --- | ---
`isAllow` | Boolean | 白板是否设置为图片模式，在此模式下画笔不生效，设置画笔时请关闭图片模式

#### setArrowLength(value)

Description:

  - 注释设置箭头宽度

##### Example

    annotation.setArrowLength(10);

##### Parameters:

Name | Type | Description
--- | --- | ---
`value` | int | 箭头宽度

#### setArrowType(value)

Description:

  - 注释设置箭头类别

##### Example

    annotation.setArrowType(arrowTypeEnum.double);

##### Parameters:

Name | Type | Description
--- | --- | ---
`value` | arrowTypeEnum | 箭头类别，枚举型

#### setColor(value)

Description:

  - 注释设置颜色

##### Example

    annotation.setColor('rgba(255,0,0,1');

##### Parameters:

Name | Type | Description
--- | --- | ---
`value` | String | 颜色，采用rgb和rgba格式

#### setColorOpacity(value)

Description:

  - 注释设置颜色透明度

##### Example

    annotation.setColor('rgba(255,0,0,1');

##### Parameters:

Name | Type | Description
--- | --- | ---
`value` | String | 颜色，采用rgb和rgba格式

#### setFillColor(value)

Description:

  - 注释设置颜色填充类别

##### Example

    annotation.setFillColor(fillTypeEnum.full);

##### Parameters:

Name | Type | Description
--- | --- | ---
`value` | fillTypeEnum | 颜色填充类别，枚举型

#### setLineWidth(value)

Description:

  - 注释设置线条宽度

##### Example

    annotation.setLineWidth(1);

##### Parameters:

Name | Type | Description
--- | --- | ---
`value` | int | 线条宽度

#### setShapeType(type)

Description:

  - 注释设置几何形状，如矩形，随机线等 注释类型，如鼠标、注释、橡皮擦

##### Example

    annotation.setShapeType(shapeTypeEnum.polyline);

##### Parameters:

Name | Type | Description
--- | --- | ---
`type` | canvasTypeEnum | 几何形 和 注释状态 枚举型

#### startHlightPoint()

Description:

  - 设置激光笔

#### startTextInput(themeConfig)

Description:

  - 开始输入文字

##### Parameters:

Name | Type | Description
--- | --- | ---
`themeConfig` | object | 主题样式，用于自定义文字输入框确认和取消按钮，例如：{confirm: {color: '#000000', text: '确定'}, cancel: {color: '#001100', text: '取消'}}

#### undo()

Description:

  - 注释撤销上一步

#### undoShape()

Description:

  - 执行撤销批注对象

#### uploadImg(accessToken, fileTarget) → {object}

Description:

  - 上传图片

##### Parameters:

Name | Type | Description
--- | --- | ---
`accessToken` | String | 认证串
`fileTarget` | object | input:file控件选择的图片文件对象

##### Returns:

Promise

Type
  object