File size: 714 Bytes
7aec436
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import styles from './style.css';

class ControlBar {
  constructor () {
    this.hasItem = false;
    this.root = document.createElement('div');
    this.root.className = styles.controlsBar;
    this.start = document.createElement('div');
    this.end = document.createElement('div');
    this.root.appendChild(this.start);
    this.root.appendChild(this.end);
  }

  addToStart (el) {
    this.hasItem = true;
    this.start.appendChild(el);
  }

  addToEnd (el) {
    this.hasItem = true;
    this.end.appendChild(el);
  }

  computeHeight () {
    if (!this.hasItem) {
      return 0;
    }
    return this.root.getBoundingClientRect().height;
  }
}

export default ControlBar;