diff --git a/packages/google-maps/index.d.ts b/packages/google-maps/index.d.ts index 2b761d0c..996f81e4 100644 --- a/packages/google-maps/index.d.ts +++ b/packages/google-maps/index.d.ts @@ -1,5 +1,5 @@ import { Color, ImageSource, EventData, View } from '@nativescript/core'; -import { JointType, MapViewBase } from './common'; +import { JointType, MapType, MapViewBase } from './common'; export type FeatureTypeAdministrative = 'administrative' | 'administrative.country' | 'administrative.land_parcel' | 'administrative.locality' | 'administrative.neighborhood' | 'administrative.province'; @@ -380,6 +380,8 @@ export interface IGoogleMap { mapStyle: Style[]; + mapType: MapType; + snapshot(): Promise; animateCamera(update: CameraUpdate); @@ -413,6 +415,7 @@ export interface IGoogleMap { export class GoogleMap implements IGoogleMap { mapStyle: Style[]; + mapType: MapType; addTileOverlay(options: TileOverlayOptions): TileOverlay; removeTileOverlay(overlay: TileOverlay); buildingsEnabled: boolean; diff --git a/packages/google-maps/index.ios.ts b/packages/google-maps/index.ios.ts index 03940ca1..d9076fe7 100644 --- a/packages/google-maps/index.ios.ts +++ b/packages/google-maps/index.ios.ts @@ -1,7 +1,7 @@ import { Color, EventData, ImageSource, Utils, View } from '@nativescript/core'; import { isNullOrUndefined } from '@nativescript/core/utils/types'; import { ActiveBuildingEvent, ActiveLevelEvent, CameraPositionEvent, CameraPositionStartEvent, CircleOptions, Coordinate, CoordinateBounds, GroundOverlayOptions, GroundOverlayTapEvent, ICameraPosition, ICameraUpdate, ICircle, IGoogleMap, IGroundOverlay, IIndoorBuilding, IIndoorLevel, IMarker, InfoWindowEvent, IPatternItem, IPoi, IPolygon, IPolyline, IProjection, ITileOverlay, ITileProvider, IUISettings, IVisibleRegion, MapTapEvent, MarkerDragEvent, MarkerInfoEvent, MarkerOptions, MarkerTapEvent, PoiTapEvent, PolygonOptions, PolylineOptions, Style, TileOverlayOptions } from '.'; -import { bearingProperty, JointType, latProperty, lngProperty, MapViewBase, tiltProperty, zoomProperty } from './common'; +import { bearingProperty, JointType, latProperty, lngProperty, MapType, MapViewBase, tiltProperty, zoomProperty } from './common'; import { deserialize, intoNativeCircleOptions, intoNativeGroundOverlayOptions, intoNativeMarkerOptions, intoNativePolygonOptions, intoNativePolylineOptions, serialize } from './utils'; export class CameraUpdate implements ICameraUpdate { @@ -820,6 +820,41 @@ export class GoogleMap implements IGoogleMap { return UISettings.fromNative(this.native.settings); } + get mapType() { + switch (this.native.mapType) { + case GMSMapViewType.kGMSTypeNone: + return MapType.None; + case GMSMapViewType.kGMSTypeNormal: + return MapType.Normal; + case GMSMapViewType.kGMSTypeSatellite: + return MapType.Satellite; + case GMSMapViewType.kGMSTypeTerrain: + return MapType.Terrain; + case GMSMapViewType.kGMSTypeHybrid: + return MapType.Hybrid; + } + } + + set mapType(value: MapType) { + switch (value) { + case MapType.None: + this.native.mapType = GMSMapViewType.kGMSTypeNone; + break; + case MapType.Normal: + this.native.mapType = GMSMapViewType.kGMSTypeNormal; + break; + case MapType.Satellite: + this.native.mapType = GMSMapViewType.kGMSTypeSatellite; + break; + case MapType.Terrain: + this.native.mapType = GMSMapViewType.kGMSTypeTerrain; + break; + case MapType.Hybrid: + this.native.mapType = GMSMapViewType.kGMSTypeHybrid; + break; + } + } + #mapStyle: Style[]; get mapStyle() { return this.#mapStyle;