-
Notifications
You must be signed in to change notification settings - Fork 0
/
Margin.js
32 lines (28 loc) · 1.22 KB
/
Margin.js
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
var compose = require('ksf/utils/compose');
var delegateGetSet = require('./utils/delegateGetSet');
var Margin = require('./layout/Margin');
module.exports = compose(function(content, margin) {
this._content = content;
this._horizontalLayouter = new Margin('horizontal', content,
typeof margin === 'number' ? margin :
('horizontal' in margin ? margin.horizontal : margin.left),
typeof margin === 'number' ? margin :
('horizontal' in margin ? margin.horizontal : margin.right)
);
this._verticalLayouter = new Margin('vertical', content,
typeof margin === 'number' ? margin :
('vertical' in margin ? margin.vertical : margin.top),
typeof margin === 'number' ? margin :
('vertical' in margin ? margin.vertical : margin.bottom)
);
}, {
left: delegateGetSet('_horizontalLayouter', 'position'),
top: delegateGetSet('_verticalLayouter', 'position'),
zIndex: delegateGetSet('_content', 'zIndex'),
width: delegateGetSet('_horizontalLayouter', 'size'),
height: delegateGetSet('_verticalLayouter', 'size'),
depth: delegateGetSet('_content', 'depth'),
parentNode: delegateGetSet('_content', 'parentNode'),
containerVisible: delegateGetSet('_content', 'containerVisible'),
visible: delegateGetSet('_content', 'visible'),
});