1 | var Group = require('./Group');
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | function BackgroundGroup (groupId, data, itemSet) {
|
11 | Group.call(this, groupId, data, itemSet);
|
12 |
|
13 | this.width = 0;
|
14 | this.height = 0;
|
15 | this.top = 0;
|
16 | this.left = 0;
|
17 | }
|
18 |
|
19 | BackgroundGroup.prototype = Object.create(Group.prototype);
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | BackgroundGroup.prototype.redraw = function(range, margin, forceRestack) {
|
29 | var resized = false;
|
30 |
|
31 | this.visibleItems = this._updateItemsInRange(this.orderedItems, this.visibleItems, range);
|
32 |
|
33 |
|
34 | this.width = this.dom.background.offsetWidth;
|
35 |
|
36 |
|
37 | this.dom.background.style.height = '0';
|
38 |
|
39 |
|
40 | for (var i = 0, ii = this.visibleItems.length; i < ii; i++) {
|
41 | var item = this.visibleItems[i];
|
42 | item.repositionY(margin);
|
43 | }
|
44 |
|
45 | return resized;
|
46 | };
|
47 |
|
48 |
|
49 |
|
50 |
|
51 | BackgroundGroup.prototype.show = function() {
|
52 | if (!this.dom.background.parentNode) {
|
53 | this.itemSet.dom.background.appendChild(this.dom.background);
|
54 | }
|
55 | };
|
56 |
|
57 | module.exports = BackgroundGroup;
|