1 | import {Directive, EventEmitter, Input, OnChanges, Output, SimpleChanges} from '@angular/core';
|
2 | import {LatLngLiteral} from '../../core/services/google-maps-types';
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | @Directive({selector: 'sebm-google-map-polyline-point'})
|
9 | export class SebmGoogleMapPolylinePoint implements OnChanges {
|
10 | |
11 |
|
12 |
|
13 | @Input() public latitude: number;
|
14 |
|
15 | |
16 |
|
17 |
|
18 | @Input() public longitude: number;
|
19 |
|
20 | |
21 |
|
22 |
|
23 | @Output() positionChanged: EventEmitter<LatLngLiteral> = new EventEmitter<LatLngLiteral>();
|
24 |
|
25 | constructor() {}
|
26 |
|
27 | ngOnChanges(changes: SimpleChanges): any {
|
28 | if (changes['latitude'] || changes['longitude']) {
|
29 | const position: LatLngLiteral = <LatLngLiteral>{
|
30 | lat: changes['latitude'].currentValue,
|
31 | lng: changes['longitude'].currentValue
|
32 | };
|
33 | this.positionChanged.emit(position);
|
34 | }
|
35 | }
|
36 | }
|