| 1 | |
| 2 | _initIndicators: function () { |
| 3 | var interactive = this.options.interactiveScrollbars, |
| 4 | defaultScrollbars = typeof this.options.scrollbars != 'object', |
| 5 | indicator1, |
| 6 | indicator2; |
| 7 | |
| 8 | if ( this.options.scrollbars ) { |
| 9 | // Vertical scrollbar |
| 10 | if ( this.options.scrollY ) { |
| 11 | indicator1 = { |
| 12 | el: createDefaultScrollbar('v', interactive, this.options.scrollbars), |
| 13 | interactive: interactive, |
| 14 | defaultScrollbars: true, |
| 15 | resize: this.options.resizeIndicator, |
| 16 | listenX: false |
| 17 | }; |
| 18 | |
| 19 | this.wrapper.appendChild(indicator1.el); |
| 20 | } |
| 21 | |
| 22 | // Horizontal scrollbar |
| 23 | if ( this.options.scrollX ) { |
| 24 | indicator2 = { |
| 25 | el: createDefaultScrollbar('h', interactive, this.options.scrollbars), |
| 26 | interactive: interactive, |
| 27 | defaultScrollbars: true, |
| 28 | resize: this.options.resizeIndicator, |
| 29 | listenY: false |
| 30 | }; |
| 31 | |
| 32 | this.wrapper.appendChild(indicator2.el); |
| 33 | } |
| 34 | } else { |
| 35 | indicator1 = this.options.indicators.length ? this.options.indicators[0] : this.options.indicators; |
| 36 | indicator2 = this.options.indicators[1] && this.options.indicators[1]; |
| 37 | } |
| 38 | |
| 39 | if ( indicator1 ) { |
| 40 | this.indicator1 = new Indicator(this, indicator1); |
| 41 | } |
| 42 | |
| 43 | if ( indicator2 ) { |
| 44 | this.indicator2 = new Indicator(this, indicator2); |
| 45 | } |
| 46 | |
| 47 | this.on('refresh', function () { |
| 48 | if ( this.indicator1 ) { |
| 49 | this.indicator1.refresh(); |
| 50 | } |
| 51 | |
| 52 | if ( this.indicator2 ) { |
| 53 | this.indicator2.refresh(); |
| 54 | } |
| 55 | }); |
| 56 | |
| 57 | this.on('destroy', function () { |
| 58 | if ( this.indicator1 ) { |
| 59 | this.indicator1.destroy(); |
| 60 | this.indicator1 = null; |
| 61 | } |
| 62 | |
| 63 | if ( this.indicator2 ) { |
| 64 | this.indicator2.destroy(); |
| 65 | this.indicator2 = null; |
| 66 | } |
| 67 | }); |
| 68 | }, |