Skip to content

Commit

Permalink
fix(AgmMarker): match Marker iconUrl input type to native api
Browse files Browse the repository at this point in the history
allow AgmMarker `iconUrl` to be a GoogleSymbol or an Icon type.

fixes: #1740
fixes: #1622
fixes: #1580
probably fixes a bunch more, since this was often requested.
  • Loading branch information
darron1217 committed Jul 16, 2020
1 parent d2ef77c commit 4e38075
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/core/directives/marker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class AgmMarker implements OnDestroy, OnChanges, AfterContentInit, FitBou
/**
* Icon (the URL of the image) for the foreground.
*/
@Input() iconUrl: string;
@Input() iconUrl: string | mapTypes.MarkerIcon | mapTypes.GoogleSymbol;

/**
* If true, the marker is visible
Expand Down
2 changes: 2 additions & 0 deletions packages/core/map-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export {
LatLngLiteral,
PolyMouseEvent,
MarkerLabel,
MarkerIcon,
Geocoder,
GeocoderAddressComponent,
GeocoderComponentRestrictions,
Expand Down Expand Up @@ -42,6 +43,7 @@ export {
RectangleOptions,
Marker,
MarkerOptions,
GoogleSymbol,
} from './services/google-maps-types';

/**
Expand Down
13 changes: 11 additions & 2 deletions packages/core/services/google-maps-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export interface Marker extends MVCObject {
setTitle(title: string): void;
setLabel(label: string | MarkerLabel): void;
setDraggable(draggable: boolean): void;
setIcon(icon: string): void;
setIcon(icon: string | MarkerIcon | GoogleSymbol): void;
setOpacity(opacity: number): void;
setVisible(visible: boolean): void;
setZIndex(zIndex: number): void;
Expand All @@ -66,7 +66,7 @@ export interface MarkerOptions {
map?: GoogleMap;
label?: string | MarkerLabel;
draggable?: boolean;
icon?: string;
icon?: string | MarkerIcon | GoogleSymbol;
opacity?: number;
visible?: boolean;
zIndex?: number;
Expand All @@ -82,6 +82,15 @@ export interface MarkerLabel {
text: string;
}

export interface MarkerIcon {
anchor?: Point;
labelOrigin?: Point;
origin?: Point;
scaledSize?: Size;
size?: Size;
url: string;
}

export interface Circle extends MVCObject {
getBounds(): LatLngBounds;
getCenter(): LatLng;
Expand Down

0 comments on commit 4e38075

Please sign in to comment.