Skip to content
This repository has been archived by the owner on May 25, 2021. It is now read-only.

Commit

Permalink
Merge pull request #460 from christinekoul/master
Browse files Browse the repository at this point in the history
Added feature for arrow keys to toggle schedule
  • Loading branch information
Bad-Science authored Jun 28, 2019
2 parents 14c5133 + 10b7772 commit 0f8e6bf
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions web/src/app/schedule-view/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ import { ScheduleComponent } from '../schedule-view/schedule/component';
// import 'rxjs/Rx';
import {Subject, Subscription} from 'rxjs/Rx';
import * as domtoimage from 'dom-to-image';
import { Component, HostListener } from '@angular/core';

export enum KEY_CODE {
RIGHT_ARROW = 39,
LEFT_ARROW = 37
}

@Component({
selector: 'schedule-view',
Expand All @@ -15,6 +21,18 @@ import * as domtoimage from 'dom-to-image';
})

export class ScheduleViewComponent implements OnInit, OnDestroy, AfterViewInit {

@HostListener('window:keyup', ['$event'])
keyEvent(event: KeyboardEvent) {
if(event.keyCode === KEY_CODE.RIGHT_ARROW) {
this.scheduleSet.incrementActiveSchedule();
}

if(event.keyCode === KEY_CODE.LEFT_ARROW) {
this.scheduleSet.decrementActiveSchedule();
}
}

@ViewChildren(ScheduleComponent)
public ScheduleList: QueryList<ScheduleComponent>

Expand Down

0 comments on commit 0f8e6bf

Please sign in to comment.