From 3e427c6f846c7df8f3628c72e58e646761f14f1c Mon Sep 17 00:00:00 2001 From: Dipansh Khandelwal Date: Wed, 20 Dec 2017 00:25:00 +0530 Subject: [PATCH] Add save option Save our drawing canvas --- images/save.png | Bin 0 -> 5176 bytes index.html | 3 +++ js/activity.js | 16 ++++++++++++++++ 3 files changed, 19 insertions(+) create mode 100644 images/save.png diff --git a/images/save.png b/images/save.png new file mode 100644 index 0000000000000000000000000000000000000000..cf2c68a2ed2d8b356628583ff8f83900e1d6c02d GIT binary patch literal 5176 zcmeHLi#JvI+ut+Z$vYX+g>-C;Or)uicOTj$B9}@I(M5jUrc;}UoZPRcQf`NhQN~u0 z7?NUCN`#EdE;hM_5WjPh+;bVXuz%lk#+lz*^Zo(vyzhGVT4$a0e4pp}JfF|!+23^* z5jHFf>E(>&5Clo@*==eIL0`hc&womQlgMwwSm5gm4_gZpD5nnY2f=?h8e17dP+pAG z{EuHjkOXA2?|>ON|DSsh2*MzUfFKHjXb40I0wEZL5D-E^2rW!v2!vq}MnD(^VYIN8 zKp+Bx2m&G~h@ge76arBgL=g~0K@<&;AR2*a45A5$rXU&w02@F9EYJ+9Y2h5?VN4}oD6hS5TOU@V9T0wXAlpoMY)3y`D;jG{1# z2I>JRP>az7MpGCKxriCjKR)aK%!9#*!+91ijtx%9WEIB^@7B$Z_5Q|U%T%<;sHT2<-*SwUqNiT0ttBBSs+gyw~9dRE)_kK`=_dfQvE#MfmUgRTMAounG# z#0i-w!Ii!!_0An#R0z*R__}XMV%U)~K@V`@Q9E`EeQV1-@^Jciu?g=BH+`1wCEn6FK== z>H>a2qteduAM*1u9vb1Lg>)*$Xojv?gdGhGMw8f*<wB z!ccL2RM{HxeRo(d`<&_yH%+!uiGK`x+y{Ps?;68X?^;}PX1AcAx&GBBy(i7TcCiFE zx6detnX??Ln@(~wFIj&`YaWv)Bh*=8O#zYpaWxFVv$-vJe{O%pKif|Ezi-T8I$mr= zlbLQNkB(Ol_|&WYyzM#Oied$wzcEv%*U9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X9wEZFcf|l48KFes2DsC18NY__)O;It1KkC0mYRGUK~qfdPbP3QV@()#Utr%a#NEihsPi2@ z{BFVvK0J418Hee-8(y0<#vnt26O2LWDl!XuUd2gEIU{S47FvZH+{rDt#sc$_FehW>n~$?!3@+y|H>r?Qr}6w&bX*0C zNZUV)dLKXdj_=#>x@MSVvTJ-)O{b^U1*?4mnn`pqmuG5S7lxVOVhQ=I-mPx2Wnm;ef^Bq%}+s@Ef#RQ+Vu2X z5OaNz#J*13f`0o>|G!_r& z_N1SB^!-FC9 zvt8%e;4--$Jy=uBKfR*ij@svGUhuEyEm%5GY0G%7ZvGiT&o8|{Z|@oER^cmn-ZEy6 z#H#&bRH^-G)b;kUu%K77Bzh>D%Lwg0?bq`(`ZBug7)!>=K{;^5O2J~$Mb>HmE5B`$ z71|$}tC(kIXBkqLLiqL%lEZFVUN-NP4}LWJ0)3MsnQVKx5U+mSwA}#D=NfQ5H~B1c z+z-2G(QfS?Z?9+b?o6*M+AHv#_MDq>_v3nA#gw|blW(SkhFJ$+<4Mp`|NXbh{=uTe YZ*^m>2CIWJg#W?VW5zPgF*$kpU#Ws_HUIzs literal 0 HcmV?d00001 diff --git a/index.html b/index.html index 88e80ac..7660ceb 100644 --- a/index.html +++ b/index.html @@ -16,6 +16,9 @@ +
diff --git a/js/activity.js b/js/activity.js index 2595c9b..e9fc15f 100644 --- a/js/activity.js +++ b/js/activity.js @@ -251,5 +251,21 @@ define(function (require) { update = true; shape = shape + 1; } + + function downloadCanvas(link, canvasId, filename) { + link.href = document.getElementById(canvasId).toDataURL(); + link.download = filename; + print_voucher(); + } + function print_voucher(){ + var win=window.open(); + win.document.write("
"); + win.print(); + win.location.reload(); + } + document.getElementById('save-button').addEventListener('click', function() { + downloadCanvas(this, 'myCanvas', 'My_Drawing.png'); + }, false); + }); });