Skip to content

FridayDai/kscreenshot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dyscreenshot

web前端截图工具。借鉴了kscreenshot

npm:

npm install dyscreenshot --save

功能

该截图工具带有下载,复制功能,并可用工具栏对截图进行简单绘制。

工具栏功能从左到右依次为:颜色,文字,椭圆,矩形,线条,箭头,后退,完成。

使用

import dyscreenshot from 'dyscreenshot'

//65指键盘中的A
new dyscreenshot(
    {
        key: 65 
    }
)

当按下shift + A将会触发截图功能

参数

参数 说明 类型 默认值
key 截图触发按键(例:65时则同时按下shit + A则触发截图) number 65
toolShow 工具栏各个工具显示(具体见下面toolshow配置) object 默认每个工具都显示
copyPath 参数为base64格式的图片(该功能不建议使用,最好是结合nw electron等工具实现复制功能。js目前暂未找到能兼容各客户端的方法,因此最好return null) Function noob
needDownload 是否下载截图后的图片 bool false
endCB 结束截图后的回调函数 Function noob
immediately 是否立即开启截图 bool false

toolShow配置

参数 说明 类型 默认值
complete 控制确认按键显示 bool true
quit 控制退出按键显示 bool true
back 控制后退按键显示 bool true
arrow 控制箭头按键显示 bool true
drawLine 控制线条按键显示(可以输入数字,初始化线条粗细,[1-10]) bool true
rect 控制矩形按键显示 bool true
ellipse 控制椭圆按键显示 bool true
text 控制文字按键显示 bool true
color 控制颜色版按键显示 bool true

方法

startScreenShot() 开启截图
endScreenShot() 结束截图

结合NW,Electron等前端桌面开发库可实现整个显示屏截图

实现demo图

About

web截图工具

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 90.3%
  • CSS 8.4%
  • HTML 1.3%