0.0.4 • Published 5 years ago

react-screenshot-editor v0.0.4

Weekly downloads
5
License
MIT
Repository
-
Last release
5 years ago

react-screenshot-editor

介绍

使用html2canvas对浏览器窗口可视范围进行截图,并使用线性或马赛克两种画笔进行编辑。

Demo

使用

import Editor from 'react-screenshot-editor';

<Editor 
  type="line" 
  width= {600}
  height={450}
  editorDidMount={this.handleEditorDidMount} 
  />

API

名称类型默认值备注
classNamestring''类名
optionsobject{ useCORS: true,scale: 1}html2canvas的配置信息,参考
typeline or mosaicline画笔类型:线或马赛克
lineWidthnumber2线性画笔宽度
strokeStylestringred线性画笔颜色
widthnumber600画布宽度
heightnumber450画布高度
rationumber0.9导出图片的质量,取值:0~1
editorDidMount(editor)=>void-编辑器挂载后的回调

editorDidMount 中的 editor

包含以下属性或方法:

  • 属性context:目标canvascontext(不建议直接操作)
  • 方法autoScreenShot: 重新执行截图
  • 方法getImageURL: 导出图片Base64数据

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago