Skip to content

Commit

Permalink
feat(poi): zoom on click instead of on change
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbeau committed Sep 6, 2017
1 parent 8b5cd70 commit 17a7eb5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
7 changes: 3 additions & 4 deletions src/lib/map/poi-button/poi-button.component.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<md-select [placeholder]="'igo.poiButton.placeholder' | translate"
floatPlaceholder="never"
(change)="handlePoiChanged($event.value)">
floatPlaceholder="never">

<md-option>
<md-option (click)="createPoi()">
<div class="titlePoi">{{ 'igo.poiButton.create' | translate }}</div>
<button igoStopPropagation class="addPoi buttonPoi"
md-icon-button
Expand All @@ -13,7 +12,7 @@
</md-icon>
</button>
</md-option>
<md-option *ngFor="let poi of pois" [value]="poi.id">
<md-option *ngFor="let poi of pois" [value]="poi.id" (click)="zoomOnPoi(poi.id)">
<div class="titlePoi">{{ poi.title }}</div>
<button igoStopPropagation class="deletePoi buttonPoi"
md-icon-button
Expand Down
10 changes: 1 addition & 9 deletions src/lib/map/poi-button/poi-button.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,6 @@ export class PoiButtonComponent implements OnInit {
});
}

handlePoiChanged(value: string) {
if (!value) {
this.createPoi();
} else {
this.zoomOnPoi(value);
}
}

deletePoi(poi: Poi) {
if (poi && poi.id) {
const translate = this.languageService.translate;
Expand Down Expand Up @@ -111,7 +103,7 @@ export class PoiButtonComponent implements OnInit {
});
}

private zoomOnPoi(id) {
zoomOnPoi(id) {
const poi = this.pois.find((p) => p.id === id);

const center = ol.proj.fromLonLat([poi.x, poi.y], this.map.projection);
Expand Down

0 comments on commit 17a7eb5

Please sign in to comment.