Commit 200d579e authored by Rron Jahja's avatar Rron Jahja
Browse files

Get Current Position feature completed with custom icon on map.

parent 11e3848a
...@@ -13,14 +13,21 @@ ...@@ -13,14 +13,21 @@
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content> <ion-content>
<div #mapElement2d style="width: 100%; height: 100%" id="mapContainer" *ngIf="!is3DChecked"></div> <div #mapElement2d style="width: 100%; height: 100%" id="mapContainer" *ngIf="!is3DChecked"></div>
<div #mapElement3d style="width: 100%; height: 100%" id="mapContainer" *ngIf="is3DChecked"></div> <div #mapElement3d style="width: 100%; height: 100%" id="mapContainer" *ngIf="is3DChecked"></div>
<!--div #mapElement style="width: 100%; height: 100%" id="mapContainer"></div--> <!--div #mapElement style="width: 100%; height: 100%" id="mapContainer"></div-->
<ion-fab vertical="bottom" horizontal="end" (click)="getCurrentPosition()" slot="fixed">
<ion-fab-button>
<ion-icon name="locate"></ion-icon>
</ion-fab-button>
</ion-fab>
</ion-content> </ion-content>
<ion-footer> <ion-footer>
<div class="bike-list-container"> <div class="bike-list-container">
<ion-icon class="bike-list-expander" name="arrow-dropup-circle" (click)="expandBikeList()"></ion-icon>
<div class="bike-container" *ngFor="let bike of bikes"> <div class="bike-container" *ngFor="let bike of bikes">
<div class="bike-name"> <div class="bike-name">
{{bike.name}} {{bike.name}}
......
...@@ -96,3 +96,7 @@ ion-footer{ ...@@ -96,3 +96,7 @@ ion-footer{
.mapContainer{ .mapContainer{
background-color: white; background-color: white;
} }
.get-position{
margin-bottom:10px;
}
\ No newline at end of file
...@@ -137,7 +137,9 @@ export class HomePage { ...@@ -137,7 +137,9 @@ export class HomePage {
this.addMarker(this.locationArr[i].lat, this.locationArr[i].lng, img[i % 3]); this.addMarker(this.locationArr[i].lat, this.locationArr[i].lng, img[i % 3]);
} }
} }
getCurrentPosition(){
this.getLocation(this.map);
}
getLocation(map) { getLocation(map) {
this.geolocation.getCurrentPosition( this.geolocation.getCurrentPosition(
{ {
...@@ -159,7 +161,7 @@ export class HomePage { ...@@ -159,7 +161,7 @@ export class HomePage {
moveMapToGiven(map, lat, lng) { moveMapToGiven(map, lat, lng) {
var icon = new H.map.Icon('../../../assets/images/icon_map_currentLocation.png'); var icon = new H.map.Icon('../../../assets/images/ic_position.png');
// Create a marker using the previously instantiated icon: // Create a marker using the previously instantiated icon:
var marker = new H.map.Marker({ lat: lat, lng: lng }, { icon: icon }); var marker = new H.map.Marker({ lat: lat, lng: lng }, { icon: icon });
......
src/assets/images/ic_position.png

11.4 KB | W: | H:

src/assets/images/ic_position.png

3.97 KB | W: | H:

src/assets/images/ic_position.png
src/assets/images/ic_position.png
src/assets/images/ic_position.png
src/assets/images/ic_position.png
  • 2-up
  • Swipe
  • Onion skin
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment