|
2 | 2 | 'use strict';
|
3 | 3 |
|
4 | 4 | angular.module('ui.nestedSortable')
|
5 |
| - |
| 5 | + |
| 6 | + /** |
| 7 | + * @ngdoc service |
| 8 | + * @name ui.nestedSortable.service:$helper |
| 9 | + * @requires ng.$document |
| 10 | + * @requires ng.$window |
| 11 | + * |
| 12 | + * @description |
| 13 | + * Angular-NestedSortable. |
| 14 | + */ |
6 | 15 | .factory('$helper', ['$document', '$window',
|
7 | 16 | function ($document, $window) {
|
8 | 17 | return {
|
| 18 | + |
| 19 | + /** |
| 20 | + * @ngdoc method |
| 21 | + * @name hippo.theme#height |
| 22 | + * @methodOf ui.nestedSortable.service:$helper |
| 23 | + * |
| 24 | + * @description |
| 25 | + * Get the height of an element. |
| 26 | + * |
| 27 | + * @param {Object} element Angular element. |
| 28 | + * @returns {String} Height |
| 29 | + */ |
9 | 30 | height: function (element) {
|
10 | 31 | return element.prop('scrollHeight');
|
11 | 32 | },
|
12 | 33 |
|
| 34 | + /** |
| 35 | + * @ngdoc method |
| 36 | + * @name hippo.theme#width |
| 37 | + * @methodOf ui.nestedSortable.service:$helper |
| 38 | + * |
| 39 | + * @description |
| 40 | + * Get the width of an element. |
| 41 | + * |
| 42 | + * @param {Object} element Angular element. |
| 43 | + * @returns {String} Width |
| 44 | + */ |
13 | 45 | width: function (element) {
|
14 | 46 | return element.prop('scrollWidth');
|
15 | 47 | },
|
16 | 48 |
|
| 49 | + /** |
| 50 | + * @ngdoc method |
| 51 | + * @name hippo.theme#offset |
| 52 | + * @methodOf ui.nestedSortable.service:$helper |
| 53 | + * |
| 54 | + * @description |
| 55 | + * Get the offset values of an element. |
| 56 | + * |
| 57 | + * @param {Object} element Angular element. |
| 58 | + * @returns {Object} Object with properties width, height, top and left |
| 59 | + */ |
17 | 60 | offset: function (element) {
|
18 | 61 | var boundingClientRect = element[0].getBoundingClientRect();
|
19 | 62 |
|
|
25 | 68 | };
|
26 | 69 | },
|
27 | 70 |
|
| 71 | + /** |
| 72 | + * @ngdoc method |
| 73 | + * @name hippo.theme#positionStarted |
| 74 | + * @methodOf ui.nestedSortable.service:$helper |
| 75 | + * |
| 76 | + * @description |
| 77 | + * Get the start position of the target element according to the provided event properties. |
| 78 | + * |
| 79 | + * @param {Object} e Event |
| 80 | + * @param {Object} target Target element |
| 81 | + * @returns {Object} Object with properties offsetX, offsetY, startX, startY, nowX and dirX. |
| 82 | + */ |
28 | 83 | positionStarted: function (e, target) {
|
29 | 84 | var pos = {};
|
30 | 85 | pos.offsetX = e.pageX - this.offset(target).left;
|
|
0 commit comments