Skip to content

Commit df9c15e

Browse files
author
Voles
committed
Add documentation for $helper
1 parent b364f9c commit df9c15e

File tree

2 files changed

+56
-2
lines changed

2 files changed

+56
-2
lines changed

source/helper.js

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,61 @@
22
'use strict';
33

44
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+
*/
615
.factory('$helper', ['$document', '$window',
716
function ($document, $window) {
817
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+
*/
930
height: function (element) {
1031
return element.prop('scrollHeight');
1132
},
1233

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+
*/
1345
width: function (element) {
1446
return element.prop('scrollWidth');
1547
},
1648

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+
*/
1760
offset: function (element) {
1861
var boundingClientRect = element[0].getBoundingClientRect();
1962

@@ -25,6 +68,18 @@
2568
};
2669
},
2770

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+
*/
2883
positionStarted: function (e, target) {
2984
var pos = {};
3085
pos.offsetX = e.pageX - this.offset(target).left;

source/main.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
'use strict';
88

99
angular.module('ui.nestedSortable', [])
10-
1110
.constant('nestedSortableConfig', {
1211
listClass: 'nestedSortable-list',
1312
itemClass: 'nestedSortable-item',

0 commit comments

Comments
 (0)