Skip to content

Commit

Permalink
fix(feature-details): fix routing property when directions tool out o…
Browse files Browse the repository at this point in the history
…f config (#745)
  • Loading branch information
PhilippeLafreniere18 committed Oct 14, 2020
1 parent 8368057 commit 4d8618b
Showing 1 changed file with 19 additions and 1 deletion.
@@ -1,3 +1,4 @@
import { BehaviorSubject } from 'rxjs';
import {
Component,
Input,
Expand Down Expand Up @@ -37,7 +38,16 @@ export class FeatureDetailsComponent {

@Input() map: IgoMap;

@Input() toolbox: Toolbox;
@Input()
get toolbox(): Toolbox {
return this._toolbox;
}
set toolbox(value: Toolbox) {
this._toolbox = value;
this.toolbox$.next(value);
}
private _toolbox: Toolbox;
public toolbox$ = new BehaviorSubject<Toolbox>(undefined);

@Input()
get feature(): Feature {
Expand Down Expand Up @@ -118,6 +128,14 @@ export class FeatureDetailsComponent {
});
}

if (feature.properties && feature.properties.Route) {
this.toolbox$.subscribe((value) => {
if (value && !value.getTool('directions')) {
delete feature.properties.Route;
}
});
}

if (allowedFieldsAndAlias) {
Object.keys(allowedFieldsAndAlias).forEach(field => {
properties[allowedFieldsAndAlias[field]] = feature.properties[field];
Expand Down

0 comments on commit 4d8618b

Please sign in to comment.