-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVScroll.js
More file actions
43 lines (39 loc) · 1.42 KB
/
Copy pathVScroll.js
File metadata and controls
43 lines (39 loc) · 1.42 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
var compose = require('ksf/utils/compose');
var delegateGetSet = require('./utils/delegateGetSet');
var Margin = require('./layout/Margin');
var DomNodeContainer = require('./DomNodeContainer');
/**
Impose la largeur à son enfant mais pas la hauteur
Crée un domNode avec un ascenseur toujours visible
*/
module.exports = compose(function(content, options) {
options = options || {};
options.scrollbarDisplay = options.scrollbarDisplay || 'scroll';
options.scrollBarSize = options.scrollBarSize === undefined ? 15 : options.scrollBarSize;
this._content = content;
this._container = new DomNodeContainer(content);
content.left(0).top(0).zIndex(0);
this._container.style({
overflowX: 'hidden',
overflowY: options.scrollbarDisplay,
});
this._horizontalLayouter = new Margin('horizontal', content, 0, options.scrollBarSize);
}, {
width: function(width) {
if (arguments.length) {
this._horizontalLayouter.size(width);
this._container.width(width);
return this;
} else {
return this._container.width();
}
},
height: delegateGetSet('_container', 'height'),
depth: delegateGetSet('_container', 'depth'),
left: delegateGetSet('_container', 'left'),
top: delegateGetSet('_container', 'top'),
zIndex: delegateGetSet('_container', 'zIndex'),
parentNode: delegateGetSet('_container', 'parentNode'),
containerVisible: delegateGetSet('_container', 'containerVisible'),
visible: delegateGetSet('_container', 'visible'),
});