-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoffset.js
More file actions
60 lines (60 loc) · 1.18 KB
/
offset.js
File metadata and controls
60 lines (60 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
module.exports = {
name: "offset",
ns: "dom",
description: "dom offset",
phrases: {
active: "Calculating offset"
},
ports: {
input: {
window: {
type: "Window",
title: "Window"
},
element: {
type: "HTMLElement",
title: "Dom Element"
}
},
output: {
element: {
type: "HTMLElement",
title: "Dom Element"
},
top: {
type: "number",
title: "Top"
},
left: {
type: "number",
title: "Left"
},
width: {
type: "number",
title: "Width"
},
height: {
type: "number",
title: "Height"
}
}
},
fn: function offset(input, $, output, state, done, cb, on) {
var r = function() {
var rect = $.element.getBoundingClientRect();
output = {
element: $.get('element'),
left: $.create(rect.left + $.win.pageXOffset),
top: $.create(rect.top + $.win.pageYOffset),
width: $.create(rect.width),
height: $.create(rect.height)
};
}.call(this);
return {
output: output,
state: state,
on: on,
return: r
};
}
}