7 return document.querySelector('.cursor');
10 getIdOfNode(): string {
11 return this.get().getAttribute('data-id');
15 const el = this.get();
17 el.classList.remove('cursor');
21 set(elementId: string) {
23 const el = document.querySelector(elementId);
26 el.classList.add('cursor');
27 if(!this.isVisible(elementId)) {
28 el.scrollIntoView(true);
34 this.get().classList.remove('expanded');
35 this.get().classList.add('collapsed');
39 this.get().classList.remove('collapsed');
40 this.get().classList.add('expanded');
43 isNodeCollapsed(): boolean {
44 return this.get().classList.contains('collapsed');
47 isNodeExpanded(): boolean {
48 return this.get().classList.contains('expanded');
51 isVisible(elementId: string) {
52 const el = document.querySelector(elementId) as HTMLElement;
53 var rect = el.getBoundingClientRect();
57 rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
58 rect.right <= (window.innerWidth || document.documentElement.clientWidth)