-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(journey-maps): show geolocation with custom control (#2011)
Refs: ROKAS-100 --------- Co-authored-by: Chris Dickinson <“christopher.dickinson@sbb.ch”>
- Loading branch information
1 parent
ad87bd7
commit c5745c7
Showing
16 changed files
with
617 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/journey-maps/angular/components/geolocate-button/geolocate-button.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<div class="map-control-container" [class.small-buttons]="showSmallButtons" *ngIf="map"> | ||
<div class="map-control-button-wrapper"> | ||
<button | ||
type="button" | ||
(click)="onGeolocateButtonClicked()" | ||
class="map-control-button" | ||
[attr.aria-label]="geolocateButtonLabel" | ||
></button> | ||
</div> | ||
</div> |
5 changes: 5 additions & 0 deletions
5
src/journey-maps/angular/components/geolocate-button/geolocate-button.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@use './../../style/functions' as f; | ||
|
||
@include f.map-controls-shared; | ||
@include f.map-control-icon; | ||
@include f.map-control-icon-button('gps'); |
30 changes: 30 additions & 0 deletions
30
src/journey-maps/angular/components/geolocate-button/geolocate-button.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; | ||
import { Map as MaplibreMap } from 'maplibre-gl'; | ||
|
||
import { SbbLocaleService } from '../../services/locale-service'; | ||
|
||
@Component({ | ||
selector: 'sbb-geolocate-button', | ||
templateUrl: './geolocate-button.html', | ||
styleUrls: ['./geolocate-button.css'], | ||
}) | ||
export class SbbGeolocateButton implements OnInit { | ||
@Input() map: MaplibreMap | null; | ||
@Input() showSmallButtons: boolean | undefined; | ||
|
||
@Output() geolocateButtonClicked: EventEmitter<void> = new EventEmitter<void>(); | ||
|
||
geolocateButtonLabel: string; | ||
|
||
constructor(private _i18n: SbbLocaleService) {} | ||
|
||
ngOnInit(): void { | ||
this.geolocateButtonLabel = `${this._i18n.getText('a4a.visualFunction')} ${this._i18n.getText( | ||
'a4a.geolocateButton', | ||
)}`; | ||
} | ||
|
||
onGeolocateButtonClicked(): void { | ||
this.geolocateButtonClicked.next(); | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.