qcobjects-sdk 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/.eslintrc.json +28 -0
  2. package/.github/FUNDING.yml +12 -0
  3. package/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
  4. package/.github/ISSUE_TEMPLATE/custom.md +10 -0
  5. package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  6. package/.github/ISSUE_TEMPLATE/issue-template.md +33 -0
  7. package/.github/workflows/codeql-analysis.yml +71 -0
  8. package/.github/workflows/npmpublish-beta.yml +38 -0
  9. package/.github/workflows/npmpublish-lts.yml +38 -0
  10. package/.github/workflows/npmpublish-main.yml +38 -0
  11. package/CHANGELOG.md +47 -0
  12. package/QCObjects-SDK.js +108 -232
  13. package/README.md +951 -6
  14. package/VERSION +1 -0
  15. package/css/base-modal.css +43 -0
  16. package/css/basic-layout-embedded-nav.css +14 -0
  17. package/css/basic-layout.css +76 -0
  18. package/css/components/horizontal-list.css +64 -0
  19. package/css/components/list.css +57 -0
  20. package/css/components/splashscreen.css +111 -0
  21. package/css/modal.css +46 -0
  22. package/demo-tests/test-component-grid.html +63 -0
  23. package/demo-tests/test-component-list.html +53 -0
  24. package/demo-tests/test-component-notifications.html +49 -0
  25. package/demo-tests/test-component-slider.html +68 -0
  26. package/favicon.ico +0 -0
  27. package/js/org.qcobjects.cloud.auth.session.data.js +136 -0
  28. package/js/org.qcobjects.cloud.auth.session.usertoken.js +107 -0
  29. package/js/org.qcobjects.components.grid.js +71 -0
  30. package/js/org.qcobjects.components.js +277 -0
  31. package/js/org.qcobjects.components.list.js +57 -0
  32. package/js/org.qcobjects.components.notifications.js +190 -0
  33. package/js/org.qcobjects.components.slider.js +217 -0
  34. package/js/org.qcobjects.components.splashscreen.js +622 -0
  35. package/js/org.qcobjects.controllers.form.js +214 -0
  36. package/js/org.qcobjects.controllers.grid.js +289 -0
  37. package/js/org.qcobjects.controllers.js +42 -0
  38. package/js/org.qcobjects.controllers.list.js +241 -0
  39. package/js/org.qcobjects.controllers.slider.js +148 -0
  40. package/js/org.qcobjects.controllers.swagger.js +86 -0
  41. package/js/org.qcobjects.effects.js +388 -0
  42. package/js/org.qcobjects.i18n_messages.js +58 -0
  43. package/js/org.qcobjects.modal.controllers.js +47 -0
  44. package/js/org.qcobjects.modal.effects.js +57 -0
  45. package/js/org.qcobjects.models.js +48 -0
  46. package/js/org.qcobjects.tools.canvas.js +59 -0
  47. package/js/org.qcobjects.tools.js +68 -0
  48. package/js/org.qcobjects.tools.layouts.js +82 -0
  49. package/js/org.qcobjects.views.js +42 -0
  50. package/package.json +17 -4
  51. package/spec/support/jasmine.json +16 -0
  52. package/spec/testsSpec.js +9 -0
  53. package/templates/components/modalyoulose.tpl.html +3 -0
  54. package/templates/components/modalyouwin.tpl.html +4 -0
  55. package/templates/components/splashscreen.tpl.html +128 -0
  56. package/templates/components/swagger-ui.tpl.html +22 -0
  57. package/v2.4 version +1 -0
@@ -0,0 +1,388 @@
1
+ /**
2
+ * QCObjects SDK 2.4
3
+ * ________________
4
+ *
5
+ * Author: Jean Machuca <correojean@gmail.com>
6
+ *
7
+ * Cross Browser Javascript Framework for MVC Patterns
8
+ * QuickCorp/QCObjects is licensed under the
9
+ * GNU Lesser General Public License v3.0
10
+ * [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
11
+ *
12
+ * Permissions of this copyleft license are conditioned on making available
13
+ * complete source code of licensed works and modifications under the same
14
+ * license or the GNU GPLv3. Copyright and license notices must be preserved.
15
+ * Contributors provide an express grant of patent rights. However, a larger
16
+ * work using the licensed work through interfaces provided by the licensed
17
+ * work may be distributed under different terms and without source code for
18
+ * the larger work.
19
+ *
20
+ * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
21
+ *
22
+ * Everyone is permitted to copy and distribute verbatim copies of this
23
+ * license document, but changing it is not allowed.
24
+ */
25
+ "use strict";
26
+ (function () {
27
+ Package("org.qcobjects.effects.base", [
28
+ class Fade extends Effect {
29
+
30
+ constructor () {
31
+ super(...arguments);
32
+ }
33
+
34
+ apply(element, alphaFrom, alphaTo) {
35
+ var da = alphaTo - alphaFrom;
36
+ this.animate({
37
+ duration: this.duration,
38
+ timing(timeFraction) {
39
+ return timeFraction;
40
+ },
41
+ draw(progress) {
42
+ logger.debug("animation progress: " + progress.toString());
43
+ var alpha = alphaFrom + (progress * da / 100);
44
+ logger.debug("alpha: " + alpha.toString());
45
+ element.style.opacity = alpha.toString();
46
+ }
47
+ });
48
+ }
49
+ },
50
+
51
+ class Move extends Effect {
52
+
53
+ constructor () {
54
+ super(...arguments);
55
+ }
56
+
57
+ apply(element, xfrom, yfrom, xto, yto) {
58
+ var dx = xto - xfrom;
59
+ var dy = yto - yfrom;
60
+ element.style.transform = "translate(" + xfrom + "px," + yfrom + "px)";
61
+ this.animate({
62
+ duration: this.duration,
63
+ timing(timeFraction) {
64
+ return timeFraction;
65
+ },
66
+ draw(progress) {
67
+ logger.debug("animation progress: " + progress.toString());
68
+ var y = yfrom + (progress * dy / 100);
69
+ var x = xfrom + (progress * dx / 100);
70
+ logger.debug("x: " + x.toString() + " y:" + y.toString());
71
+ element.style.transform = "translate(" + x + "px," + y + "px)";
72
+ }
73
+ });
74
+ }
75
+
76
+ }
77
+
78
+
79
+ ]);
80
+
81
+ Package("org.qcobjects.effects.extended", [
82
+
83
+
84
+ class MoveXInFromRight extends Move {
85
+ constructor () {
86
+ super(...arguments);
87
+ }
88
+
89
+ apply(element) {
90
+ super.apply.call(this, element, element.width, 0, 0, 0);
91
+ }
92
+ },
93
+
94
+ class MoveXInFromLeft extends Move {
95
+ constructor () {
96
+ super(...arguments);
97
+ }
98
+
99
+ apply(element) {
100
+ super.apply.call(this, element, -element.width, 0, 0, 0);
101
+ }
102
+ },
103
+
104
+ class MoveYInFromBottom extends Move {
105
+ constructor () {
106
+ super(...arguments);
107
+ }
108
+
109
+ apply(element) {
110
+ super.apply.call(this, element, 0, element.height, 0, 0);
111
+ }
112
+
113
+ },
114
+
115
+ class MoveYInFromTop extends Move {
116
+ constructor () {
117
+ super(...arguments);
118
+ }
119
+
120
+ apply(element) {
121
+ super.apply.call(this, element, 0, -element.height, 0, 0);
122
+ }
123
+ },
124
+
125
+ class RotateX extends Effect {
126
+ constructor () {
127
+ super(...arguments);
128
+ }
129
+
130
+ apply(element, angleFrom, angleTo) {
131
+ var da = angleTo - angleFrom;
132
+ this.animate({
133
+ duration: this.duration,
134
+ timing(timeFraction) {
135
+ return timeFraction;
136
+ },
137
+ draw(progress) {
138
+ logger.debug("animation progress: " + progress.toString());
139
+ var angle = Math.round(angleFrom + (progress * da / 100));
140
+ logger.debug("angle: " + angle.toString());
141
+ element.style.transform = "rotate3d(1,0,0," + angle.toString() + "deg)";
142
+ }
143
+ });
144
+ }
145
+
146
+ },
147
+
148
+ class RotateY extends Effect {
149
+ constructor () {
150
+ super(...arguments);
151
+ }
152
+
153
+ apply(element, angleFrom, angleTo) {
154
+ var da = angleTo - angleFrom;
155
+ this.animate({
156
+ duration: this.duration,
157
+ timing(timeFraction) {
158
+ return timeFraction;
159
+ },
160
+ draw(progress) {
161
+ logger.debug("animation progress: " + progress.toString());
162
+ var angle = Math.round(angleFrom + (progress * da / 100));
163
+ logger.debug("angle: " + angle.toString());
164
+ element.style.transform = "rotate3d(0,1,0," + angle.toString() + "deg)";
165
+ }
166
+ });
167
+ }
168
+ },
169
+
170
+ class RotateZ extends Effect {
171
+ constructor () {
172
+ super(...arguments);
173
+ }
174
+
175
+ apply(element, angleFrom, angleTo) {
176
+ var da = angleTo - angleFrom;
177
+ this.animate({
178
+ duration: this.duration,
179
+ timing(timeFraction) {
180
+ return timeFraction;
181
+ },
182
+ draw(progress) {
183
+ logger.debug("animation progress: " + progress.toString());
184
+ var angle = Math.round(angleFrom + (progress * da / 100));
185
+ logger.debug("angle: " + angle.toString());
186
+ element.style.transform = "rotate3d(0,0,1," + angle.toString() + "deg)";
187
+ }
188
+ });
189
+ }
190
+
191
+ },
192
+
193
+ class Rotate extends Effect {
194
+ constructor () {
195
+ super(...arguments);
196
+ }
197
+
198
+ apply(element, angleFrom, angleTo) {
199
+ var da = angleTo - angleFrom;
200
+ this.animate({
201
+ duration: this.duration,
202
+ timing(timeFraction) {
203
+ return timeFraction;
204
+ },
205
+ draw(progress) {
206
+ logger.debug("animation progress: " + progress.toString());
207
+ var angle = Math.round(angleFrom + (progress * da / 100));
208
+ logger.debug("angle: " + angle.toString());
209
+ element.style.transform = "rotate3d(1,1,1," + angle.toString() + "deg)";
210
+ }
211
+ });
212
+ }
213
+ },
214
+
215
+ class Radius extends Effect {
216
+ constructor () {
217
+ super(...arguments);
218
+ }
219
+
220
+ apply(element, radiusFrom, radiusTo) {
221
+ var dr = radiusTo - radiusFrom;
222
+ this.animate({
223
+ duration: this.duration,
224
+ timing(timeFraction) {
225
+ return timeFraction;
226
+ },
227
+ draw(progress) {
228
+ logger.debug("animation progress: " + progress.toString());
229
+ var radius = radiusFrom + (progress * dr / 100);
230
+ logger.debug("radius: " + radius.toString());
231
+ element.style.borderRadius = radius.toString() + "px";
232
+ }
233
+ });
234
+ }
235
+
236
+ },
237
+
238
+ class Resize extends Effect {
239
+ constructor () {
240
+ super(...arguments);
241
+ }
242
+
243
+ apply(element, scaleFrom, scaleTo) {
244
+ var ds = scaleTo - scaleFrom;
245
+ this.animate({
246
+ duration: this.duration,
247
+ timing(timeFraction) {
248
+ return timeFraction;
249
+ },
250
+ draw(progress) {
251
+ logger.debug("animation progress: " + progress.toString());
252
+ var scale = scaleFrom + (progress * ds / 100);
253
+ logger.debug("resize: " + scale.toString());
254
+ element.style.transformOrigin = "center";
255
+ element.style.transform = "scale(" + scale + "," + scale + ")";
256
+ }
257
+ });
258
+ }
259
+
260
+ },
261
+
262
+ class WipeLeft extends Effect {
263
+ constructor () {
264
+ super(...arguments);
265
+ }
266
+
267
+ apply(element, scaleFrom, scaleTo) {
268
+ var ds = scaleTo - scaleFrom;
269
+ this.animate({
270
+ duration: this.duration,
271
+ timing(timeFraction) {
272
+ return timeFraction;
273
+ },
274
+ draw(progress) {
275
+ logger.debug("animation progress: " + progress.toString());
276
+ var scale = scaleFrom + (progress * ds / 100);
277
+ logger.debug("wipe: " + scale.toString());
278
+ element.style.transformOrigin = "right";
279
+ element.style.transform = "scaleX(" + scale + ")";
280
+ }
281
+ });
282
+ }
283
+
284
+ },
285
+
286
+ class WipeRight extends Effect {
287
+ constructor () {
288
+ super(...arguments);
289
+ }
290
+
291
+ apply(element, scaleFrom, scaleTo) {
292
+ var ds = scaleTo - scaleFrom;
293
+ this.animate({
294
+ duration: this.duration,
295
+ timing(timeFraction) {
296
+ return timeFraction;
297
+ },
298
+ draw(progress) {
299
+ logger.debug("animation progress: " + progress.toString());
300
+ var scale = scaleFrom + (progress * ds / 100);
301
+ logger.debug("wipe: " + scale.toString());
302
+ element.style.transformOrigin = "left";
303
+ element.style.transform = "scaleX(" + scale + ")";
304
+ }
305
+ });
306
+ }
307
+
308
+ },
309
+
310
+ class WipeUp extends Effect {
311
+ constructor () {
312
+ super(...arguments);
313
+ }
314
+
315
+ apply(element, scaleFrom, scaleTo) {
316
+ var ds = scaleTo - scaleFrom;
317
+ this.animate({
318
+ duration: this.duration,
319
+ timing(timeFraction) {
320
+ return timeFraction;
321
+ },
322
+ draw(progress) {
323
+ logger.debug("animation progress: " + progress.toString());
324
+ var scale = scaleFrom + (progress * ds / 100);
325
+ logger.debug("wipe: " + scale.toString());
326
+ element.style.transformOrigin = "bottom";
327
+ element.style.transform = "scaleY(" + scale + ")";
328
+ }
329
+ });
330
+ }
331
+
332
+ },
333
+
334
+ class WipeDown extends Effect {
335
+ constructor () {
336
+ super(...arguments);
337
+ }
338
+
339
+ apply(element, scaleFrom, scaleTo) {
340
+ var ds = scaleTo - scaleFrom;
341
+ this.animate({
342
+ duration: this.duration,
343
+ timing(timeFraction) {
344
+ return timeFraction;
345
+ },
346
+ draw(progress) {
347
+ logger.debug("animation progress: " + progress.toString());
348
+ var scale = scaleFrom + (progress * ds / 100);
349
+ logger.debug("wipe: " + scale.toString());
350
+ element.style.transformOrigin = "top";
351
+ element.style.transform = "scaleY(" + scale + ")";
352
+ }
353
+ });
354
+ }
355
+ }
356
+
357
+ ]);
358
+ Package("org.qcobjects.modal.effects",[
359
+
360
+ class ModalFade extends Fade {
361
+ constructor () {
362
+ super(...arguments);
363
+ this.duration=500;
364
+ }
365
+
366
+ },
367
+
368
+ class ModalMoveDown extends Move {
369
+ constructor () {
370
+ super(...arguments);
371
+ this.duration=300;
372
+
373
+ }
374
+
375
+ },
376
+
377
+ class ModalMoveUp extends Move {
378
+ constructor () {
379
+ super(...arguments);
380
+ this.duration=800;
381
+
382
+ }
383
+
384
+ }
385
+
386
+ ]);
387
+
388
+ }).call(null);
@@ -0,0 +1,58 @@
1
+ /**
2
+ * QCObjects SDK 2.4
3
+ * ________________
4
+ *
5
+ * Author: Jean Machuca <correojean@gmail.com>
6
+ *
7
+ * Cross Browser Javascript Framework for MVC Patterns
8
+ * QuickCorp/QCObjects is licensed under the
9
+ * GNU Lesser General Public License v3.0
10
+ * [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
11
+ *
12
+ * Permissions of this copyleft license are conditioned on making available
13
+ * complete source code of licensed works and modifications under the same
14
+ * license or the GNU GPLv3. Copyright and license notices must be preserved.
15
+ * Contributors provide an express grant of patent rights. However, a larger
16
+ * work using the licensed work through interfaces provided by the licensed
17
+ * work may be distributed under different terms and without source code for
18
+ * the larger work.
19
+ *
20
+ * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
21
+ *
22
+ * Everyone is permitted to copy and distribute verbatim copies of this
23
+ * license document, but changing it is not allowed.
24
+ */
25
+ (function() {
26
+ "use strict";
27
+ Package("org.qcobjects.i18n_messages", [
28
+
29
+ class i18n_messages extends InheritClass {
30
+
31
+ constructor () {
32
+ super(...arguments);
33
+ var i18n = this;
34
+ if (CONFIG.get("use_i18n")){
35
+ CONFIG.set("lang", "en");
36
+ if (!global.get("i18n")){
37
+ global.set("i18n", {
38
+ messages: i18n.messages
39
+ });
40
+ } else {
41
+ global.set("i18n", {
42
+ messages: global.get("i18n").messages.concat(i18n.messages)
43
+ });
44
+ }
45
+ }
46
+
47
+ }
48
+
49
+ _load_i18n_packages_ (){
50
+ return CONFIG.get("i18n_languages",[]).map((i18n_packagename)=>{
51
+ Import(`org.quickcorp.i18n_messages.${i18n_packagename}`);
52
+ });
53
+ }
54
+
55
+ }
56
+ ]);
57
+ (new i18n_messages())._load_i18n_packages_();
58
+ }).call(null);
@@ -0,0 +1,47 @@
1
+ /**
2
+ * QCObjects SDK 2.4
3
+ * ________________
4
+ *
5
+ * Author: Jean Machuca <correojean@gmail.com>
6
+ *
7
+ * Cross Browser Javascript Framework for MVC Patterns
8
+ * QuickCorp/QCObjects is licensed under the
9
+ * GNU Lesser General Public License v3.0
10
+ * [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
11
+ *
12
+ * Permissions of this copyleft license are conditioned on making available
13
+ * complete source code of licensed works and modifications under the same
14
+ * license or the GNU GPLv3. Copyright and license notices must be preserved.
15
+ * Contributors provide an express grant of patent rights. However, a larger
16
+ * work using the licensed work through interfaces provided by the licensed
17
+ * work may be distributed under different terms and without source code for
18
+ * the larger work.
19
+ *
20
+ * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
21
+ *
22
+ * Everyone is permitted to copy and distribute verbatim copies of this
23
+ * license document, but changing it is not allowed.
24
+ */
25
+ (function() {
26
+ "use strict";
27
+ Package("org.qcobjects.modal.controllers",[
28
+
29
+ class ModalController extends Controller {
30
+
31
+ constructor () {
32
+ super(...arguments);
33
+ this.dependencies=[];
34
+ this.component=null;
35
+ }
36
+
37
+ done (){
38
+ var component = this.component;
39
+ component.body.innerHTML = component.body.innerHTML.replace("/{{content}}/g",component.submodal.template);
40
+
41
+ }
42
+
43
+ }
44
+
45
+ ]);
46
+
47
+ }).call(null);
@@ -0,0 +1,57 @@
1
+ /**
2
+ * QCObjects SDK 2.4
3
+ * ________________
4
+ *
5
+ * Author: Jean Machuca <correojean@gmail.com>
6
+ *
7
+ * Cross Browser Javascript Framework for MVC Patterns
8
+ * QuickCorp/QCObjects is licensed under the
9
+ * GNU Lesser General Public License v3.0
10
+ * [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
11
+ *
12
+ * Permissions of this copyleft license are conditioned on making available
13
+ * complete source code of licensed works and modifications under the same
14
+ * license or the GNU GPLv3. Copyright and license notices must be preserved.
15
+ * Contributors provide an express grant of patent rights. However, a larger
16
+ * work using the licensed work through interfaces provided by the licensed
17
+ * work may be distributed under different terms and without source code for
18
+ * the larger work.
19
+ *
20
+ * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
21
+ *
22
+ * Everyone is permitted to copy and distribute verbatim copies of this
23
+ * license document, but changing it is not allowed.
24
+ */
25
+ (function() {
26
+ "use strict";
27
+ Package("org.qcobjects.modal.effects",[
28
+
29
+ class ModalFade extends Fade {
30
+ constructor () {
31
+ super();
32
+ this.duration=500;
33
+ }
34
+
35
+ },
36
+
37
+ class ModalMoveDown extends Move {
38
+ constructor () {
39
+ super();
40
+ this.duration=300;
41
+
42
+ }
43
+
44
+ },
45
+
46
+ class ModalMoveUp extends Move {
47
+ constructor () {
48
+ super();
49
+ this.duration=800;
50
+
51
+ }
52
+
53
+ }
54
+
55
+ ]);
56
+
57
+ }).call(null);
@@ -0,0 +1,48 @@
1
+ /**
2
+ * QCObjects SDK 2.4
3
+ * ________________
4
+ *
5
+ * Author: Jean Machuca <correojean@gmail.com>
6
+ *
7
+ * Cross Browser Javascript Framework for MVC Patterns
8
+ * QuickCorp/QCObjects is licensed under the
9
+ * GNU Lesser General Public License v3.0
10
+ * [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
11
+ *
12
+ * Permissions of this copyleft license are conditioned on making available
13
+ * complete source code of licensed works and modifications under the same
14
+ * license or the GNU GPLv3. Copyright and license notices must be preserved.
15
+ * Contributors provide an express grant of patent rights. However, a larger
16
+ * work using the licensed work through interfaces provided by the licensed
17
+ * work may be distributed under different terms and without source code for
18
+ * the larger work.
19
+ *
20
+ * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
21
+ *
22
+ * Everyone is permitted to copy and distribute verbatim copies of this
23
+ * license document, but changing it is not allowed.
24
+ */
25
+ (function() {
26
+ "use strict";
27
+ Package("org.qcobjects.models",[
28
+
29
+ class Contact extends VO {
30
+
31
+ constructor (){
32
+ super(...arguments);
33
+ this.first_name="";
34
+ this.last_name="";
35
+ this.address="";
36
+ this.postalCode="";
37
+ this.city="";
38
+ this.country="";
39
+ this.email="";
40
+ this.phone="";
41
+
42
+ }
43
+
44
+ }
45
+
46
+ ]);
47
+
48
+ }).call(null);
@@ -0,0 +1,59 @@
1
+ /**
2
+ * QCObjects SDK 2.4
3
+ * ________________
4
+ *
5
+ * Author: Jean Machuca <correojean@gmail.com>
6
+ *
7
+ * Cross Browser Javascript Framework for MVC Patterns
8
+ * QuickCorp/QCObjects is licensed under the
9
+ * GNU Lesser General Public License v3.0
10
+ * [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
11
+ *
12
+ * Permissions of this copyleft license are conditioned on making available
13
+ * complete source code of licensed works and modifications under the same
14
+ * license or the GNU GPLv3. Copyright and license notices must be preserved.
15
+ * Contributors provide an express grant of patent rights. However, a larger
16
+ * work using the licensed work through interfaces provided by the licensed
17
+ * work may be distributed under different terms and without source code for
18
+ * the larger work.
19
+ *
20
+ * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
21
+ *
22
+ * Everyone is permitted to copy and distribute verbatim copies of this
23
+ * license document, but changing it is not allowed.
24
+ */
25
+ "use strict";
26
+ (function() {
27
+ Package("org.qcobjects.tools.canvas",[
28
+
29
+ class CanvasTool extends InheritClass {
30
+ constructor () {
31
+ super(...arguments);
32
+ }
33
+
34
+ drawImageFilled (img, canvas, zoom=1, px=0, py=0){
35
+ // get the scale
36
+ var scale = Math.max(canvas.width / img.width, canvas.height / img.height);
37
+ scale = scale*zoom;
38
+ // get the top left position of the image
39
+ var x = (canvas.width / 2) - (img.width / 2) * scale;
40
+ var y = (canvas.height / 2) - (img.height / 2) * scale;
41
+ var ctx = canvas.getContext("2d");
42
+ ctx.drawImage(img, (px+x), (py+y), img.width * scale, img.height * scale);
43
+ }
44
+
45
+ getImageResized (img, width, height, resizedImage, zoom=1, px=0, py=0){
46
+ var canvas = document.createElement("canvas");
47
+ canvas.width = width;
48
+ canvas.height = height;
49
+ canvas.style.width = width;
50
+ canvas.style.height = height;
51
+ this.drawImageFilled(img,canvas,zoom,px,py);
52
+ resizedImage.src = canvas.toDataURL("image/png");
53
+ return canvas;
54
+ }
55
+
56
+ }
57
+ ]);
58
+
59
+ }).call(null);