Git Product home page Git Product logo

kscreenshot's Introduction

kscreenshot

由于该插件还存在问题,不推荐在项目中使用该插件。

npm:

npm install kscreenshot --save

功能

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

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

使用

import kscreenshot from 'kscreenshot'

//65指键盘中的A
new kscreenshot(
    {
        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
cancelCB 撤销截图后的回调函数(关闭按钮,esc,鼠标右键) 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图

kscreenshot's People

Contributors

kejiacheng avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.