Created
November 3, 2019 16:24
-
-
Save timdeschryver/24b8c8cc75c236f9c75d50109d6f33d9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| export class AppComponent implements OnInit { | |
| zoom = 12 | |
| center: google.maps.LatLngLiteral | |
| options: google.maps.MapOptions = { | |
| mapTypeId: 'hybrid', | |
| zoomControl: false, | |
| scrollwheel: false, | |
| disableDoubleClickZoom: true, | |
| maxZoom: 15, | |
| minZoom: 8, | |
| } | |
| ngOnInit() { | |
| navigator.geolocation.getCurrentPosition(position => { | |
| this.center = { | |
| lat: position.coords.latitude, | |
| lng: position.coords.longitude, | |
| } | |
| }) | |
| } | |
| zoomIn() { | |
| if (this.zoom < this.options.maxZoom) this.zoom++ | |
| } | |
| zoomOut() { | |
| if (this.zoom > this.options.minZoom) this.zoom-- | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment