The angular-ready wrapper for the native google.maps.Marker
class.
overlays/modules/marker/google-maps-marker.ts
Properties |
Methods |
|
constructor(map: IGoogleMap, api: GoogleMapsApiService, native: any)
|
||||||||||||
Parameters:
|
||||||||||||
Public map |
Type: IGoogleMap
|
Inherited from
GoogleMapsDrawableOverlay
|
The map to which this overlay should be added.
|
Public Readonly type |
Type: OverlayType
|
Inherited from
GoogleMapsDrawableOverlay
|
The type of overlay this wrapper holds. Used by the `OverlayTracker` to distinguish between types.
|
Public custom |
Type: any
|
Inherited from
GoogleMapsNativeObjectWrapper
|
Public Readonly native |
Type: TNative
|
Inherited from
GoogleMapsNativeObjectWrapper
|
The instantiated native object to be wrapped.
|
Public getBounds |
getBounds()
|
Inherited from
GoogleMapsDrawableOverlay
|
Returns:
google.maps.LatLngBounds
|
Public getPosition |
getPosition()
|
Returns:
google.maps.LatLngLiteral
|
Public setPosition | ||||||
setPosition(position: BoundsLike)
|
||||||
Decorators :
@OutsideAngular()
|
||||||
Parameters:
Returns:
void
|
||||||
Public attach | ||||||||
attach(map: IGoogleMap)
|
||||||||
Inherited from
GoogleMapsDrawableOverlay
|
||||||||
Assigns the overlay to the specified map. If possible, prefer using the appropriate
Parameters:
Returns:
void
|
||||||||
Public detach |
detach()
|
Inherited from
GoogleMapsDrawableOverlay
|
Removes the overlay from the map it is attached to. If possible, prefer using the
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 { GoogleMapsApiService, NativeObjectWrapper, IGoogleMap, OutsideAngular, BoundsLike, Delegation } from '@bespunky/angular-google-maps/core';
import { GoogleMapsDrawableOverlay } from '../../abstraction/base/google-maps-drawable-overlay';
import { OverlayType } from '../../abstraction/base/overlay-type.enum';
import { IGoogleMapsMarker, WrappedMarkerFunctions } from './i-google-maps-marker';
/** Extends intellisense for `GoogleMapsMarker` with native marker functions. */
export interface GoogleMapsMarker extends WrappedMarkerFunctions { }
/**
* The angular-ready wrapper for the native `google.maps.Marker` class.
*
* @export
* @class GoogleMapsMarker
* @extends {GoogleMapsDrawableOverlay<google.maps.Marker>}
* @implements {IGoogleMapsMarker}
*/
// @dynamic
@NativeObjectWrapper<GoogleMapsMarker>({
getMap: Delegation.Exclude,
setMap: Delegation.Exclude
})
export class GoogleMapsMarker extends GoogleMapsDrawableOverlay<google.maps.Marker> implements IGoogleMapsMarker
{
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(map: IGoogleMap, api: GoogleMapsApiService, native: any /* See super for docs on `any` */)
{
super(OverlayType.Marker, map, api, native);
}
public getBounds(): google.maps.LatLngBounds
{
return this.api.geometry.defineCoordBounds(this.getPosition());
}
public getPosition(): google.maps.LatLngLiteral
{
return this.api.geometry.toLiteralCoord(this.native.getPosition());
}
@OutsideAngular
public setPosition(position: BoundsLike): void
{
this.native.setPosition(this.api.geometry.centerOf(position));
}
}