Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Canvas/CoverActions/download.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/UI/Canvas/CoverActions/download.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/CoverActions/download.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/CoverActions/download.js index 25e82ca..f667526 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/CoverActions/download.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/CoverActions/download.js | |||
@@ -1,117 +1,115 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | // | 24 | // |
27 | //download.js | 25 | //download.js |
28 | //Download | 26 | //Download |
29 | // | 27 | // |
30 | //Created by Giulio Cesare Solaroli on 3/15/10 | 28 | //Created by Giulio Cesare Solaroli on 3/15/10 |
31 | //Copyright 2010 Clipperz | 29 | //Copyright 2010 Clipperz |
32 | //This code was generated by Opacity. You may use or modify it in any way. | 30 | //This code was generated by Opacity. You may use or modify it in any way. |
33 | // | 31 | // |
34 | 32 | ||
35 | var kClipperz_PM_UI_Canvas_CoverActions_downloadWidth = 46.0; | 33 | var kClipperz_PM_UI_Canvas_CoverActions_downloadWidth = 46.0; |
36 | var kClipperz_PM_UI_Canvas_CoverActions_downloadHeight = 46.0; | 34 | var kClipperz_PM_UI_Canvas_CoverActions_downloadHeight = 46.0; |
37 | 35 | ||
38 | function Clipperz_PM_UI_Canvas_CoverActions_download(canvas, aColor, aFillColor, aThickness) | 36 | function Clipperz_PM_UI_Canvas_CoverActions_download(canvas, aColor, aFillColor, aThickness) |
39 | { | 37 | { |
40 | var context = canvas.getContext("2d"); | 38 | var context = canvas.getContext("2d"); |
41 | var alignStroke; | 39 | var alignStroke; |
42 | var resolution; | 40 | var resolution; |
43 | var stroke; | 41 | var stroke; |
44 | var path; | 42 | var path; |
45 | var pointX; | 43 | var pointX; |
46 | var pointY; | 44 | var pointY; |
47 | if (window.devicePixelRatio) | 45 | if (window.devicePixelRatio) |
48 | resolution = window.devicePixelRatio; | 46 | resolution = window.devicePixelRatio; |
49 | else | 47 | else |
50 | resolution = 1.0; | 48 | resolution = 1.0; |
51 | resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_CoverActions_downloadWidth + canvas.height / kClipperz_PM_UI_Canvas_CoverActions_downloadHeight); | 49 | resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_CoverActions_downloadWidth + canvas.height / kClipperz_PM_UI_Canvas_CoverActions_downloadHeight); |
52 | 50 | ||
53 | context.save(); | 51 | context.save(); |
54 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_CoverActions_downloadWidth, canvas.height / kClipperz_PM_UI_Canvas_CoverActions_downloadHeight); | 52 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_CoverActions_downloadWidth, canvas.height / kClipperz_PM_UI_Canvas_CoverActions_downloadHeight); |
55 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_CoverActions_downloadWidth, kClipperz_PM_UI_Canvas_CoverActions_downloadHeight); | 53 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_CoverActions_downloadWidth, kClipperz_PM_UI_Canvas_CoverActions_downloadHeight); |
56 | 54 | ||
57 | // arrow | 55 | // arrow |
58 | 56 | ||
59 | stroke = aThickness; | 57 | stroke = aThickness; |
60 | stroke *= resolution; | 58 | stroke *= resolution; |
61 | if (stroke < 1.0) | 59 | if (stroke < 1.0) |
62 | stroke = Math.ceil(stroke); | 60 | stroke = Math.ceil(stroke); |
63 | else | 61 | else |
64 | stroke = Math.round(stroke); | 62 | stroke = Math.round(stroke); |
65 | stroke /= resolution; | 63 | stroke /= resolution; |
66 | alignStroke = (0.5 * stroke * resolution) % 1.0; | 64 | alignStroke = (0.5 * stroke * resolution) % 1.0; |
67 | context.beginPath(); | 65 | context.beginPath(); |
68 | pointX = 16.5; | 66 | pointX = 16.5; |
69 | pointY = 22.5; | 67 | pointY = 22.5; |
70 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 68 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
71 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 69 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
72 | context.moveTo(pointX, pointY); | 70 | context.moveTo(pointX, pointY); |
73 | pointX = 19.5; | 71 | pointX = 19.5; |
74 | pointY = 8.5; | 72 | pointY = 8.5; |
75 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 73 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
76 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 74 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
77 | context.lineTo(pointX, pointY); | 75 | context.lineTo(pointX, pointY); |
78 | pointX = 30.038; | 76 | pointX = 30.038; |
79 | pointY = 10.605; | 77 | pointY = 10.605; |
80 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 78 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
81 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 79 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
82 | context.lineTo(pointX, pointY); | 80 | context.lineTo(pointX, pointY); |
83 | pointX = 27.354; | 81 | pointX = 27.354; |
84 | pointY = 24.354; | 82 | pointY = 24.354; |
85 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 83 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
86 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 84 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
87 | context.lineTo(pointX, pointY); | 85 | context.lineTo(pointX, pointY); |
88 | pointX = 33.28; | 86 | pointX = 33.28; |
89 | pointY = 25.293; | 87 | pointY = 25.293; |
90 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 88 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
91 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 89 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
92 | context.lineTo(pointX, pointY); | 90 | context.lineTo(pointX, pointY); |
93 | pointX = 19.81; | 91 | pointX = 19.81; |
94 | pointY = 36.828; | 92 | pointY = 36.828; |
95 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 93 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
96 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 94 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
97 | context.lineTo(pointX, pointY); | 95 | context.lineTo(pointX, pointY); |
98 | pointX = 10.07; | 96 | pointX = 10.07; |
99 | pointY = 21.617; | 97 | pointY = 21.617; |
100 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 98 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
101 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 99 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
102 | context.lineTo(pointX, pointY); | 100 | context.lineTo(pointX, pointY); |
103 | pointX = 16.5; | 101 | pointX = 16.5; |
104 | pointY = 22.5; | 102 | pointY = 22.5; |
105 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | 103 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; |
106 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | 104 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; |
107 | context.lineTo(pointX, pointY); | 105 | context.lineTo(pointX, pointY); |
108 | context.closePath(); | 106 | context.closePath(); |
109 | context.fillStyle = aFillColor; | 107 | context.fillStyle = aFillColor; |
110 | context.fill(); | 108 | context.fill(); |
111 | context.strokeStyle = aColor; | 109 | context.strokeStyle = aColor; |
112 | context.lineWidth = stroke; | 110 | context.lineWidth = stroke; |
113 | context.lineCap = "square"; | 111 | context.lineCap = "square"; |
114 | context.stroke(); | 112 | context.stroke(); |
115 | 113 | ||
116 | context.restore(); | 114 | context.restore(); |
117 | } | 115 | } |