update clipper

This commit is contained in:
lxsang 2020-07-14 23:15:28 +02:00
parent 9192578205
commit 0e6ba3c41d
8 changed files with 29 additions and 13 deletions

View File

@ -6,6 +6,7 @@ Clipper use `html2canvas` to capture AntOS desktop or a specific window.
It is able to crop the captured image before saving to a file
## Change logs
* v0.1.1-a use ALT-S as global shortcut for screen capture
* v0.1.0-a initial version

View File

@ -6,6 +6,7 @@ Clipper use `html2canvas` to capture AntOS desktop or a specific window.
It is able to crop the captured image before saving to a file
## Change logs
* v0.1.1-a use ALT-S as global shortcut for screen capture
* v0.1.0-a initial version

File diff suppressed because one or more lines are too long

View File

@ -6,7 +6,7 @@
"author": "",
"email": ""
},
"version":"0.1.0-a",
"version":"0.1.1-a",
"category":"Other",
"iconclass":"fa fa-scissors",
"mimes":["none"],

Binary file not shown.

View File

@ -89,18 +89,31 @@ class Clipper extends this.OS.application.BaseApplication
@bindKey "CTRL-S", () => @actionFile "#{@name}-Save"
@bindKey "ALT-W", () => @actionFile "#{@name}-Saveas"
@notify __("User ALT-S global shortcut to capture the entire VDE")
@_gui.bindKey "CTRL-S", ()=>
return unless html2canvas
html2canvas(document.body).then (canvas) =>
@_gui.launch "Clipper", [canvas]
return unless @args and @args.length is 1
@copycanvas @args[0]
copycanvas: (canvas)->
@scene.height = canvas.height
@scene.width = canvas.width
@scene.getContext('2d').drawImage(canvas, 0, 0)
@dirty = true
capture: (el, windoff) ->
@hide() if windoff
html2canvas(el).then (canvas) =>
@scene.height = canvas.height
@scene.width = canvas.width
@scene.getContext('2d').drawImage(canvas, 0, 0)
@notify __("Screen captured")
@show() if windoff
@dirty = true
@load new Promise (resolve, reject) =>
html2canvas(el).then (canvas) =>
@copycanvas canvas
@show() if windoff
resolve()
.catch (e) -> reject __e e
.then () => @notify __("Screen captured")
.catch (e) => @error e.toString(), e
menu: () ->
menu = [{
text: "__(File)",
@ -152,5 +165,6 @@ class Clipper extends this.OS.application.BaseApplication
@dirty = false
@quit()
Clipper.singleton = true
this.OS.register "Clipper", Clipper

View File

@ -6,7 +6,7 @@
"author": "",
"email": ""
},
"version":"0.1.0-a",
"version":"0.1.1-a",
"category":"Other",
"iconclass":"fa fa-scissors",
"mimes":["none"],

View File

@ -50,7 +50,7 @@
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/Clipper/README.md",
"category": "Other",
"author": "",
"version": "0.1.0-a",
"version": "0.1.1-a",
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/Clipper/build/release/Clipper.zip"
},
{