The angular-ready wrapper for the native google.maps.Map
class.
GoogleMapsNativeObjectEmittingWrapper
core/modules/map/google-map.ts
Properties |
|
Methods |
|
constructor(superpowers: ISuperpowers, api: GoogleMapsApiService, native: any)
|
||||||||||||
Parameters:
|
||||||||||||
Public Readonly superpowers |
Type: ISuperpowers
|
The superpowers loaded for this map instance. Any lazy loaded superpowers will automatically load here as well. |
Public custom |
Type: any
|
Inherited from
GoogleMapsNativeObjectWrapper
|
Public Readonly native |
Type: TNative
|
Inherited from
GoogleMapsNativeObjectWrapper
|
The instantiated native object to be wrapped.
|
Public fitBounds | |||||||||
fitBounds(elements: BoundsLike[], padding?: number | google.maps.Padding)
|
|||||||||
Decorators :
@OutsideAngular()
|
|||||||||
Parameters:
Returns:
void
|
|||||||||
Public getMapType |
getMapType()
|
Returns:
string | google.maps.MapTypeId
|
Public panTo | ||||||
panTo(position: Coord)
|
||||||
Decorators :
@OutsideAngular()
|
||||||
Parameters:
Returns:
void
|
||||||
Public panToBounds | |||||||||
panToBounds(elements: BoundsLike[], padding?: number | google.maps.Padding)
|
|||||||||
Decorators :
@OutsideAngular()
|
|||||||||
Parameters:
Returns:
void
|
|||||||||
Public setCenter | ||||||
setCenter(center: Coord)
|
||||||
Decorators :
@OutsideAngular()
|
||||||
Parameters:
Returns:
void
|
||||||
Public setMapType | ||||||
setMapType(type: string | google.maps.MapTypeId)
|
||||||
Decorators :
@OutsideAngular()
|
||||||
Parameters:
Returns:
void
|
||||||
Public clearListeners |
clearListeners()
|
Inherited from
GoogleMapsNativeObjectEmittingWrapper
|
Unregisters all handlers of any previously registered native event.
Returns:
void
|
Public listenTo | ||||||||||||
listenTo(eventName: string, handleEvent: (args: any[]) => void)
|
||||||||||||
Inherited from
GoogleMapsNativeObjectEmittingWrapper
|
||||||||||||
Registers a handler to a specific event of the native object and takes care of executing the handler inside angular's zone.
Parameters:
Returns:
void
An function for unregistering the handler from the event. |
||||||||||||
Public stopListeningTo | ||||||||
stopListeningTo(eventName: string)
|
||||||||
Inherited from
GoogleMapsNativeObjectEmittingWrapper
|
||||||||
Unregisters all handlers previously registered to handle a specific event.
Parameters:
Returns:
void
|
||||||||
Public setCustom | ||||||
setCustom(custom: any)
|
||||||
Inherited from
GoogleMapsNativeObjectWrapper
|
||||||
Parameters:
Returns:
void
|
||||||
import { GoogleMapsNativeObjectEmittingWrapper } from '../../abstraction/base/google-maps-native-object-emitting-wrapper';
import { Coord, BoundsLike } from '../../abstraction/types/geometry.type';
import { NativeObjectWrapper } from '../../decorators/native-object-wrapper.decorator';
import { OutsideAngular } from '../../decorators/outside-angular.decorator';
import { Delegation } from '../../decorators/wrapper-definition';
import { GoogleMapsApiService } from '../../api/google-maps-api.service';
import { ISuperpowers } from './superpowers/i-superpowers';
import { IGoogleMap, WrappedGoogleMapFunctions } from './i-google-map';
/** Extends intellisense for `GoogleMapsMap` with native map functions. */
export interface GoogleMap extends WrappedGoogleMapFunctions { }
/**
* The angular-ready wrapper for the native `google.maps.Map` class.
*
* @export
* @class GoogleMap
* @extends {GoogleMapsNativeObjectEmittingWrapper<google.maps.Map>}
* @implements {IGoogleMap}
*/
// @dynamic
@NativeObjectWrapper<GoogleMap>({
panBy: Delegation.OutsideAngular
})
export class GoogleMap extends GoogleMapsNativeObjectEmittingWrapper<google.maps.Map> implements IGoogleMap
{
constructor(
/** The superpowers loaded for this map instance. Any lazy loaded superpowers will automatically load here as well. */
public readonly superpowers: ISuperpowers,
api : GoogleMapsApiService,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
native : any /* See super for docs on `any` */
)
{
super(api, native);
superpowers.attachToMap(this);
}
@OutsideAngular
public setCenter(center: Coord)
{
this.native.setCenter(this.api.geometry.toLiteralCoord(center));
}
@OutsideAngular
public fitBounds(elements: BoundsLike[], padding?: number | google.maps.Padding): void
{
this.native.fitBounds(this.api.geometry.defineBounds(...elements), padding);
}
@OutsideAngular
public panToBounds(elements: BoundsLike[], padding?: number | google.maps.Padding): void
{
this.native.panToBounds(this.api.geometry.defineBounds(...elements), padding);
}
@OutsideAngular
public panTo(position: Coord): void
{
this.native.panTo(this.api.geometry.toLiteralCoord(position));
}
public getMapType(): string | google.maps.MapTypeId { return this.native.getMapTypeId(); }
@OutsideAngular
public setMapType(type: string | google.maps.MapTypeId): void { this.native.setMapTypeId(type); }
}