Keeps menu open if user is hovering over it

This commit is contained in:
Aaron Louie 2019-10-17 13:39:53 -04:00
parent 31e1c669b2
commit ad031dc3f3
2 changed files with 8 additions and 1 deletions

View File

@ -8,6 +8,8 @@
fxLayoutGap="20px"
fxLayoutAlign="center end"
[ngClass]="{'scrolling': isScrolling}"
(mouseover)="keepMenuOpen()"
(mouseout)="isScrolling = false"
>
<button mat-fab (click)="toggleMenu()" class="toggle-menu" color="primary">
<mat-icon *ngIf="!isScrolling">menu</mat-icon>

View File

@ -71,7 +71,7 @@ export class AppComponent implements AfterViewInit {
clearTimeout(this.scrollTimer);
}
this.scrollTimer = setTimeout(() => {
this.scrollTimer = window.setTimeout(() => {
this.showIndicator = true;
this.isScrolling = false;
this.scrollTimer = -1;
@ -83,4 +83,9 @@ export class AppComponent implements AfterViewInit {
this.isScrolling = !this.isScrolling;
}
keepMenuOpen() {
this.isScrolling = true;
clearTimeout(this.scrollTimer);
}
}