mirror of
https://github.com/antos-rde/antosdk-apps.git
synced 2024-12-26 12:18:21 +01:00
update clipper
This commit is contained in:
parent
9192578205
commit
0e6ba3c41d
@ -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
|
It is able to crop the captured image before saving to a file
|
||||||
|
|
||||||
## Change logs
|
## Change logs
|
||||||
|
* v0.1.1-a use ALT-S as global shortcut for screen capture
|
||||||
* v0.1.0-a initial version
|
* v0.1.0-a initial version
|
||||||
|
|
||||||
|
|
||||||
|
@ -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
|
It is able to crop the captured image before saving to a file
|
||||||
|
|
||||||
## Change logs
|
## Change logs
|
||||||
|
* v0.1.1-a use ALT-S as global shortcut for screen capture
|
||||||
* v0.1.0-a initial version
|
* v0.1.0-a initial version
|
||||||
|
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -6,7 +6,7 @@
|
|||||||
"author": "",
|
"author": "",
|
||||||
"email": ""
|
"email": ""
|
||||||
},
|
},
|
||||||
"version":"0.1.0-a",
|
"version":"0.1.1-a",
|
||||||
"category":"Other",
|
"category":"Other",
|
||||||
"iconclass":"fa fa-scissors",
|
"iconclass":"fa fa-scissors",
|
||||||
"mimes":["none"],
|
"mimes":["none"],
|
||||||
|
Binary file not shown.
@ -89,18 +89,31 @@ class Clipper extends this.OS.application.BaseApplication
|
|||||||
|
|
||||||
@bindKey "CTRL-S", () => @actionFile "#{@name}-Save"
|
@bindKey "CTRL-S", () => @actionFile "#{@name}-Save"
|
||||||
@bindKey "ALT-W", () => @actionFile "#{@name}-Saveas"
|
@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) ->
|
capture: (el, windoff) ->
|
||||||
@hide() if windoff
|
@hide() if windoff
|
||||||
html2canvas(el).then (canvas) =>
|
@load new Promise (resolve, reject) =>
|
||||||
@scene.height = canvas.height
|
html2canvas(el).then (canvas) =>
|
||||||
@scene.width = canvas.width
|
@copycanvas canvas
|
||||||
@scene.getContext('2d').drawImage(canvas, 0, 0)
|
@show() if windoff
|
||||||
@notify __("Screen captured")
|
resolve()
|
||||||
@show() if windoff
|
.catch (e) -> reject __e e
|
||||||
@dirty = true
|
.then () => @notify __("Screen captured")
|
||||||
.catch (e) => @error e.toString(), e
|
.catch (e) => @error e.toString(), e
|
||||||
|
|
||||||
menu: () ->
|
menu: () ->
|
||||||
menu = [{
|
menu = [{
|
||||||
text: "__(File)",
|
text: "__(File)",
|
||||||
@ -152,5 +165,6 @@ class Clipper extends this.OS.application.BaseApplication
|
|||||||
@dirty = false
|
@dirty = false
|
||||||
@quit()
|
@quit()
|
||||||
|
|
||||||
|
Clipper.singleton = true
|
||||||
|
|
||||||
this.OS.register "Clipper", Clipper
|
this.OS.register "Clipper", Clipper
|
@ -6,7 +6,7 @@
|
|||||||
"author": "",
|
"author": "",
|
||||||
"email": ""
|
"email": ""
|
||||||
},
|
},
|
||||||
"version":"0.1.0-a",
|
"version":"0.1.1-a",
|
||||||
"category":"Other",
|
"category":"Other",
|
||||||
"iconclass":"fa fa-scissors",
|
"iconclass":"fa fa-scissors",
|
||||||
"mimes":["none"],
|
"mimes":["none"],
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/Clipper/README.md",
|
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/Clipper/README.md",
|
||||||
"category": "Other",
|
"category": "Other",
|
||||||
"author": "",
|
"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"
|
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/Clipper/build/release/Clipper.zip"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user