UNPKG

977 BPlain TextView Raw
1import {Column} from "../entities/column";
2import {BeanStub} from "../context/beanStub";
3import {Autowired} from "../context/context";
4import {ColumnHoverService} from "../rendering/columnHoverService";
5
6export class HoverFeature extends BeanStub {
7
8 @Autowired('columnHoverService') private columnHoverService: ColumnHoverService;
9
10 private columns: Column[];
11
12 constructor(columns: Column[], element: HTMLElement) {
13 super();
14 this.columns = columns;
15 this.addMouseHoverListeners(element);
16 }
17
18 private addMouseHoverListeners(element: HTMLElement): void {
19 this.addDestroyableEventListener(element, 'mouseout', this.onMouseOut.bind(this));
20 this.addDestroyableEventListener(element, 'mouseover', this.onMouseOver.bind(this));
21 }
22
23 private onMouseOut(): void {
24 this.columnHoverService.clearMouseOver();
25 }
26
27 private onMouseOver(): void {
28 this.columnHoverService.setMouseOver(this.columns);
29 }
30
31}
\No newline at end of file