Skip to content

Commit

Permalink
adds kiosk mode toggle ctrl+/
Browse files Browse the repository at this point in the history
  • Loading branch information
Kim committed Nov 14, 2024
1 parent 8a8c935 commit f2ed98c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, OnInit, OnDestroy, AfterViewInit, ViewChild, Inject } from '@angular/core';
import { Component, OnInit, OnDestroy, AfterViewInit, ViewChild, Inject, HostListener } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { MatSidenav } from '@angular/material/sidenav';
import { MatIconRegistry } from '@angular/material/icon';
Expand Down Expand Up @@ -67,6 +67,8 @@ export class AppComponent implements OnInit, OnDestroy, AfterViewInit {

public interactionTypes = models.MapInteractionModeType;
public searchType: models.SearchType;
public kioskMode = false;

private helpTopic: string | null;

private subs = new SubSink();
Expand Down Expand Up @@ -98,8 +100,14 @@ export class AppComponent implements OnInit, OnDestroy, AfterViewInit {
private titleService: Title,
@Inject(MAT_DATE_LOCALE) public _locale: string,
) { }


@HostListener('window:keydown.control./', ['$event'])
handleKeyDown(_event: KeyboardEvent) {
console.log('Toggling kiosk mode. Use "ctrl+/" to re-toggle')
this.store$.dispatch(new searchStore.setSearchKioskMode(!this.kioskMode))
}
public ngOnInit(): void {
console.log('To toggle kiosk mode, use "ctrl+/"')
this.store$.dispatch(new hyp3Store.LoadCosts());

this.subs.add(
Expand All @@ -125,6 +133,9 @@ export class AppComponent implements OnInit, OnDestroy, AfterViewInit {
)
);

this.subs.add(
this.store$.select(searchStore.getKioskMode).subscribe(kioskMode => this.kioskMode = kioskMode)
)
this.subs.add(
this.store$.select(uiStore.getHelpDialogTopic).subscribe(topic => {
const previousTopic = this.helpTopic;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ export class TimeseriesChartComponent implements OnInit, OnDestroy {
this.timeSeriesData = [];
for (let key of Object.keys(result.point).filter(x => x !== 'mean' && x !== 'aoi')) {
let daDate = new Date(result.point[key].secondary_datetime).valueOf();
if (daDate < this.startDate.valueOf() || daDate > this.endDate.valueOf()) { continue; }
if (daDate < this.startDate?.valueOf() || daDate > this.endDate?.valueOf()) { continue; }
this.dataSource.push({
'aoi': aoi,
'short_wavelength_displacement': result.point[key].short_wavelength_displacement,
Expand Down

0 comments on commit f2ed98c

Please sign in to comment.