From aff653de2e4e12bb533a370ebce866173b2b2ab6 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Sat, 8 Jul 2017 08:43:11 -0400 Subject: [PATCH] feat(google-maps): add GoogleMapOptions interface --- .../plugins/google-maps/index.ts | 34 +++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/src/@ionic-native/plugins/google-maps/index.ts b/src/@ionic-native/plugins/google-maps/index.ts index cd1a9dac1..f83c3a696 100644 --- a/src/@ionic-native/plugins/google-maps/index.ts +++ b/src/@ionic-native/plugins/google-maps/index.ts @@ -4,6 +4,34 @@ import { Observable } from 'rxjs/Observable'; import { Observer } from 'rxjs/Observer'; import 'rxjs/add/observable/fromEvent'; + +export type MapType = 'MAP_TYPE_NORMAL' | 'MAP_TYPE_ROADMAP' | 'MAP_TYPE_SATELLITE' | 'MAP_TYPE_HYBRID' | 'MAP_TYPE_TERRAIN' | 'MAP_TYPE_NONE'; + +export interface GoogleMapOptions { + mapType: MapType; + controls: { + compass: boolean; + myLocationButton: boolean; + indoorPicker: boolean; + zoom: boolean; + }; + gestures: { + scroll: boolean; + tilt: boolean; + zoom: boolean; + rotate: boolean; + }; + styles: any[]; + camera: CameraPosition; + preferences: { + zoom: { + minZoom: number; + maxZoom: number; + }, + building: boolean; + }; +} + export interface AnimateCameraOptions { target?: LatLng | Array | LatLngBounds; tilt?: number; @@ -392,7 +420,7 @@ export class GoogleMaps extends IonicNativePlugin { * @param options {any} Options * @returns {GoogleMap} */ - create(element: string | HTMLElement, options?: any): GoogleMap { + create(element: string | HTMLElement, options?: GoogleMapOptions): GoogleMap { return new GoogleMap(element, options); } @@ -777,7 +805,7 @@ export class Geocoder { plugin: 'cordova-plugin-googlemaps' }) export class GoogleMap extends BaseClass { - constructor(element: string | HTMLElement, options?: any) { + constructor(element: string | HTMLElement, options?: GoogleMapOptions) { super(); if (checkAvailability(GoogleMaps.getPluginRef(), null, GoogleMaps.getPluginName()) === true) { if (typeof element === 'string') { @@ -1028,7 +1056,7 @@ export class GoogleMap extends BaseClass { * @param options */ @CordovaInstance({ sync: true }) - setOptions(options: any): void {} + setOptions(options: GoogleMapOptions): void {} /** * Adds a marker