|
16 | 16 | /**
|
17 | 17 | * Crops, rotates and zooms the image to this element
|
18 | 18 | *
|
19 |
| - * 20170406 orif-jr - Added modularized code procedure |
| 19 | + * 20170724 orif-jr - Added mobile support |
20 | 20 | * 20170720 orif-jr - Enhanced watchers for src and rotation
|
| 21 | + * 20170406 orif-jr - Added modularized code procedure |
21 | 22 | */
|
22 | 23 | module.directive('ngCroppie', ['$timeout', function ($timeout) {
|
23 | 24 | return {
|
|
34 | 35 | exif: '@',
|
35 | 36 | orientation: '@',
|
36 | 37 | update: '=',
|
37 |
| - ngModel: '=' |
| 38 | + ngModel: '=', |
| 39 | + mobile: '@' |
38 | 40 | },
|
39 | 41 | link: function (scope, elem, attr) {
|
40 | 42 | // defaults
|
|
46 | 48 | }
|
47 | 49 |
|
48 | 50 | // catches
|
49 |
| - scope.viewport.w = (scope.viewport.w != undefined) ? scope.viewport.w : 300; |
50 |
| - scope.viewport.h = (scope.viewport.h != undefined) ? scope.viewport.h : 300; |
51 |
| - scope.boundry.w = (scope.boundry.w != undefined) ? scope.boundry.w : 400; |
52 |
| - scope.boundry.h = (scope.boundry.h != undefined) ? scope.boundry.h : 400; |
| 51 | + if (scope.mobile === true) { |
| 52 | + scope.viewport.w = (scope.viewport.w != undefined) ? scope.viewport.w : 200; |
| 53 | + scope.viewport.h = (scope.viewport.h != undefined) ? scope.viewport.h : 250; |
| 54 | + scope.boundry.w = (scope.boundry.w != undefined) ? scope.boundry.w : 250; |
| 55 | + scope.boundry.h = (scope.boundry.h != undefined) ? scope.boundry.h : 300; |
| 56 | + } else { |
| 57 | + scope.viewport.w = (scope.viewport.w != undefined) ? scope.viewport.w : 300; |
| 58 | + scope.viewport.h = (scope.viewport.h != undefined) ? scope.viewport.h : 300; |
| 59 | + scope.boundry.w = (scope.boundry.w != undefined) ? scope.boundry.w : 400; |
| 60 | + scope.boundry.h = (scope.boundry.h != undefined) ? scope.boundry.h : 400; |
| 61 | + } |
53 | 62 |
|
54 | 63 | // viewport cannot be larger than the boundaries
|
55 | 64 | if (scope.viewport.w > scope.boundry.w) {
|
|
0 commit comments