diff --git a/Clipper/README.md b/Clipper/README.md index 6364bfa..e71ce42 100644 --- a/Clipper/README.md +++ b/Clipper/README.md @@ -6,7 +6,8 @@ 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.2-a use ALT-S as global shortcut for screen capture +* v0.1.1-a use CTRL-S as global shortcut for screen capture * v0.1.0-a initial version diff --git a/Clipper/build/debug/README.md b/Clipper/build/debug/README.md index 6364bfa..e71ce42 100644 --- a/Clipper/build/debug/README.md +++ b/Clipper/build/debug/README.md @@ -6,7 +6,8 @@ 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.2-a use ALT-S as global shortcut for screen capture +* v0.1.1-a use CTRL-S as global shortcut for screen capture * v0.1.0-a initial version diff --git a/Clipper/build/debug/chessboard.gif b/Clipper/build/debug/chessboard.gif deleted file mode 100644 index 9871140..0000000 Binary files a/Clipper/build/debug/chessboard.gif and /dev/null differ diff --git a/Clipper/build/debug/main.js b/Clipper/build/debug/main.js index bd6cfd2..f012d21 100644 --- a/Clipper/build/debug/main.js +++ b/Clipper/build/debug/main.js @@ -2,7 +2,7 @@ * html2canvas 1.0.0-rc.5 * Copyright (c) 2020 Niklas von Hertzen * Released under MIT License - */var A,e;(function(){var A;(A=class extends this.OS.application.BaseApplication{constructor(A){super("Clipper",A)}main(){var A;if(this.scene=this.find("scene"),this.wrapper=this.find("wrapper"),this.cropwin=this.find("cropwin"),this.dirty=!1,this.currfile="Untitled".asFileHandle(),$(this.cropwin).css("position","absolute").hide(),this.find("btnCptScreen").onbtclick=()=>this.capture(document.body,!0),this.find("btnCptWindow").onbtclick=()=>{var A,e,t,r,n,B,s;for(e in s=[],n=OS.PM.processes)for(A=0,t=(B=n[e]).length;A{if(A)return this.capture(A.el)})},A=this.find("btnCrop"),this.cropselect=A=>{var e,t,r;return t=$(this.cropwin).offset(),r=A.clientX-t.left,e=A.clientY-t.top,$(this.cropwin).css("width",r+"px").css("height",e+"px")},this.cropup=e=>($(window).off("mousemove",this.cropselect),$(window).off("mouseup",this.cropup),this.ask({text:__("Crop the selected zone ?")}).then(e=>{var t,r,n,B,s,o,i,a;if(A.enable=!0,A.selected=!1,t=$(this.cropwin).offset(),s=$(this.scene).offset(),i=t.left-s.left,a=t.top-s.top,o=$(this.cropwin).width(),B=$(this.cropwin).height(),$(this.cropwin).hide(),$(this.cropwin).css("width","0px").css("height","0px"),e)return n=(r=this.scene.getContext("2d")).getImageData(i,a,o,B),this.scene.width=o,this.scene.height=B,r.putImageData(n,0,0),this.dirty=!0})),this.cropdown=e=>{var t;return A.enable=!1,t=$(this.scheme).offset(),$(this.cropwin).css("left",e.clientX-t.left+"px").css("top",e.clientY-t.top+"px").show(),$(window).off("mousedown",this.cropdown),$(window).mousemove(this.cropselect),$(window).mouseup(this.cropup)},A.onbtclick=()=>A.selected?$(window).mousedown(this.cropdown):$(window).off("mousedown",this.cropdown),this.bindKey("CTRL-S",()=>this.actionFile(this.name+"-Save")),this.bindKey("ALT-W",()=>this.actionFile(this.name+"-Saveas")),this.notify(__("User ALT-S global shortcut to capture the entire VDE")),this._gui.bindKey("CTRL-S",()=>{if(html2canvas)return html2canvas(document.body).then(A=>this._gui.launch("Clipper",[A]))}),this.args&&1===this.args.length)return this.copycanvas(this.args[0])}copycanvas(A){return this.scene.height=A.height,this.scene.width=A.width,this.scene.getContext("2d").drawImage(A,0,0),this.dirty=!0}capture(A,e){return e&&this.hide(),this.load(new Promise((t,r)=>html2canvas(A).then(A=>(this.copycanvas(A),e&&this.show(),t())).catch((function(A){return r(__e(A))})))).then(()=>this.notify(__("Screen captured"))).catch(A=>this.error(A.toString(),A))}menu(){return[{text:"__(File)",nodes:[{text:"__(Save)",dataid:this.name+"-Save",shortcut:"C-S"},{text:"__(Save as)",dataid:this.name+"-Saveas",shortcut:"A-W"}],onchildselect:A=>this.actionFile(A.data.item.data.dataid)}]}save(){return this.currfile.cache=this.scene.toDataURL("image/png"),this.currfile.write("base64").then(A=>(this.notify(__("File saved")),this.dirty=!1)).catch(A=>this.error(__("Cannot save to file: {0}",A.toString()),A))}actionFile(A){var e;switch(e=()=>this.openDialog("FileDialog",{title:__("Save as"),file:this.currfile}).then(A=>{var e;return e=A.file.path.asFileHandle(),"file"===A.file.type&&(e=e.parent()),this.currfile.setPath(`${e.path}/${A.name}`),this.save(this.currfile)}),A){case this.name+"-Save":return this.currfile.basename?this.save():e();case this.name+"-Saveas":return e()}}cleanup(A){if(this.dirty)return A.preventDefault(),this.ask({title:__("Quit"),text:__("Quit without saving ?")}).then(A=>{if(A)return this.dirty=!1,this.quit()})}}).singleton=!0,this.OS.register("Clipper",A)}).call(this),A=this,e=function(){"use strict"; + */var A,e;(function(){var A;(A=class extends this.OS.application.BaseApplication{constructor(A){super("Clipper",A)}main(){var A;if(this.scene=this.find("scene"),this.wrapper=this.find("wrapper"),this.cropwin=this.find("cropwin"),this.dirty=!1,this.currfile="Untitled".asFileHandle(),$(this.cropwin).css("position","absolute").hide(),this.find("btnCptScreen").onbtclick=()=>this.capture(document.body,!0),this.find("btnCptWindow").onbtclick=()=>{var A,e,t,r,n,B,s;for(e in s=[],n=OS.PM.processes)for(A=0,t=(B=n[e]).length;A{if(A)return this.capture(A.el)})},A=this.find("btnCrop"),this.cropselect=A=>{var e,t,r;return t=$(this.cropwin).offset(),r=A.clientX-t.left,e=A.clientY-t.top,$(this.cropwin).css("width",r+"px").css("height",e+"px")},this.cropup=e=>($(window).off("mousemove",this.cropselect),$(window).off("mouseup",this.cropup),this.ask({text:__("Crop the selected zone ?")}).then(e=>{var t,r,n,B,s,o,i,a;if(A.enable=!0,A.selected=!1,t=$(this.cropwin).offset(),s=$(this.scene).offset(),i=t.left-s.left,a=t.top-s.top,o=$(this.cropwin).width(),B=$(this.cropwin).height(),$(this.cropwin).hide(),$(this.cropwin).css("width","0px").css("height","0px"),e)return n=(r=this.scene.getContext("2d")).getImageData(i,a,o,B),this.scene.width=o,this.scene.height=B,r.putImageData(n,0,0),this.dirty=!0})),this.cropdown=e=>{var t;return A.enable=!1,t=$(this.scheme).offset(),$(this.cropwin).css("left",e.clientX-t.left+"px").css("top",e.clientY-t.top+"px").show(),$(window).off("mousedown",this.cropdown),$(window).mousemove(this.cropselect),$(window).mouseup(this.cropup)},A.onbtclick=()=>A.selected?$(window).mousedown(this.cropdown):$(window).off("mousedown",this.cropdown),this.bindKey("CTRL-S",()=>this.actionFile(this.name+"-Save")),this.bindKey("ALT-W",()=>this.actionFile(this.name+"-Saveas")),this.notify(__("User ALT-S global shortcut to capture the entire VDE")),this._gui.bindKey("ALT-S",()=>{if(html2canvas)return html2canvas(document.body).then(A=>this._gui.launch("Clipper",[A]))}),this.args&&1===this.args.length)return this.copycanvas(this.args[0])}copycanvas(A){return this.scene.height=A.height,this.scene.width=A.width,this.scene.getContext("2d").drawImage(A,0,0),this.dirty=!0}capture(A,e){return e&&this.hide(),this.load(new Promise((t,r)=>html2canvas(A).then(A=>(this.copycanvas(A),e&&this.show(),t())).catch((function(A){return r(__e(A))})))).then(()=>this.notify(__("Screen captured"))).catch(A=>this.error(A.toString(),A))}menu(){return[{text:"__(File)",nodes:[{text:"__(Save)",dataid:this.name+"-Save",shortcut:"C-S"},{text:"__(Save as)",dataid:this.name+"-Saveas",shortcut:"A-W"}],onchildselect:A=>this.actionFile(A.data.item.data.dataid)}]}save(){return this.currfile.cache=this.scene.toDataURL("image/png"),this.currfile.write("base64").then(A=>(this.notify(__("File saved")),this.dirty=!1)).catch(A=>this.error(__("Cannot save to file: {0}",A.toString()),A))}actionFile(A){var e;switch(e=()=>this.openDialog("FileDialog",{title:__("Save as"),file:this.currfile}).then(A=>{var e;return e=A.file.path.asFileHandle(),"file"===A.file.type&&(e=e.parent()),this.currfile.setPath(`${e.path}/${A.name}`),this.save(this.currfile)}),A){case this.name+"-Save":return this.currfile.basename?this.save():e();case this.name+"-Saveas":return e()}}cleanup(A){if(this.dirty)return A.preventDefault(),this.ask({title:__("Quit"),text:__("Quit without saving ?")}).then(A=>{if(A)return this.dirty=!1,this.quit()})}}).singleton=!0,this.OS.register("Clipper",A)}).call(this),A=this,e=function(){"use strict"; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use diff --git a/Clipper/build/debug/package.json b/Clipper/build/debug/package.json index f41d4e4..96a1319 100644 --- a/Clipper/build/debug/package.json +++ b/Clipper/build/debug/package.json @@ -6,7 +6,7 @@ "author": "", "email": "" }, - "version":"0.1.1-a", + "version":"0.1.2-a", "category":"Other", "iconclass":"fa fa-scissors", "mimes":["none"], diff --git a/Clipper/build/release/Clipper.zip b/Clipper/build/release/Clipper.zip index 664e8e8..07b7abe 100644 Binary files a/Clipper/build/release/Clipper.zip and b/Clipper/build/release/Clipper.zip differ diff --git a/Clipper/coffees/main.coffee b/Clipper/coffees/main.coffee index 54ca201..971f5de 100644 --- a/Clipper/coffees/main.coffee +++ b/Clipper/coffees/main.coffee @@ -90,7 +90,7 @@ 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", ()=> + @_gui.bindKey "ALT-S", ()=> return unless html2canvas html2canvas(document.body).then (canvas) => @_gui.launch "Clipper", [canvas] diff --git a/Clipper/package.json b/Clipper/package.json index f41d4e4..96a1319 100644 --- a/Clipper/package.json +++ b/Clipper/package.json @@ -6,7 +6,7 @@ "author": "", "email": "" }, - "version":"0.1.1-a", + "version":"0.1.2-a", "category":"Other", "iconclass":"fa fa-scissors", "mimes":["none"], diff --git a/packages.json b/packages.json index a74b9b0..2c3cd34 100644 --- a/packages.json +++ b/packages.json @@ -50,7 +50,7 @@ "description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/Clipper/README.md", "category": "Other", "author": "", - "version": "0.1.1-a", + "version": "0.1.2-a", "download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/Clipper/build/release/Clipper.zip" }, {