forked from philorg/treetrail-frontend
first commit
This commit is contained in:
commit
62506c830a
1207 changed files with 40706 additions and 0 deletions
17
src/app/indicator/indicator.component.html
Normal file
17
src/app/indicator/indicator.component.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
<div class="container">
|
||||
<mat-icon *ngIf='featureFinderService.hasDirection$ | async' aria-hidden="false"
|
||||
matTooltip="Direction to interesting stuff..."
|
||||
[ngStyle]="{'transform':'rotate(' + (featureFinderService.direction$ | async) + 'deg)'}">
|
||||
north
|
||||
</mat-icon>
|
||||
|
||||
<div *ngIf='distance'>
|
||||
{{ distance }} m
|
||||
</div>
|
||||
|
||||
<mat-icon class="north"
|
||||
matTooltip="Direction of north"
|
||||
[ngStyle]="{'transform':'rotate(' + (featureFinderService.orientation$ | async) + 'deg)'}">
|
||||
north
|
||||
</mat-icon>
|
||||
<div>
|
6
src/app/indicator/indicator.component.scss
Normal file
6
src/app/indicator/indicator.component.scss
Normal file
|
@ -0,0 +1,6 @@
|
|||
.container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
font-size: 1.5em;
|
||||
}
|
25
src/app/indicator/indicator.component.spec.ts
Normal file
25
src/app/indicator/indicator.component.spec.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { IndicatorComponent } from './indicator.component';
|
||||
|
||||
describe('IndicatorComponent', () => {
|
||||
let component: IndicatorComponent;
|
||||
let fixture: ComponentFixture<IndicatorComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ IndicatorComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(IndicatorComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
41
src/app/indicator/indicator.component.ts
Normal file
41
src/app/indicator/indicator.component.ts
Normal file
|
@ -0,0 +1,41 @@
|
|||
import { Component, OnInit,
|
||||
ChangeDetectorRef, ChangeDetectionStrategy } from '@angular/core'
|
||||
import { Observable, BehaviorSubject } from 'rxjs'
|
||||
import { map } from 'rxjs/operators'
|
||||
|
||||
import { ActionService } from '../action.service'
|
||||
import { FeatureFinderService } from '../feature-finder.service'
|
||||
|
||||
@Component({
|
||||
selector: 'app-indicator',
|
||||
templateUrl: './indicator.component.html',
|
||||
styleUrls: ['./indicator.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class IndicatorComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
public actionService: ActionService,
|
||||
public featureFinderService: FeatureFinderService,
|
||||
private cdr: ChangeDetectorRef,
|
||||
) { }
|
||||
|
||||
distance: number
|
||||
|
||||
ngOnInit(): void {
|
||||
this.featureFinderService.distance$.subscribe(
|
||||
dist => {
|
||||
this.distance = Math.round(dist)
|
||||
this.cdr.markForCheck()
|
||||
}
|
||||
)
|
||||
|
||||
this.featureFinderService.direction$.subscribe(
|
||||
_ => this.cdr.markForCheck()
|
||||
)
|
||||
|
||||
this.featureFinderService.orientation$.subscribe(
|
||||
_ => this.cdr.markForCheck()
|
||||
)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue