Skip to content

Commit 6f051b4

Browse files
committed
Document imagePath: new String('')
1 parent 8691578 commit 6f051b4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/markers/icons.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,14 @@ export function createDefaultMarkerIconSrc(colors: Record<string, string>) {
2424

2525
export function createDefaultMarkerIcon(colors: Record<string, string>) {
2626
const url = createSvgDataUrl(createDefaultMarkerIconSrc(colors));
27-
return new Icon.Default({ imagePath: new String('') as string, iconUrl: url, iconRetinaUrl: url, shadowUrl: markerShadowUrl }) as Icon;
27+
return new Icon.Default({
28+
// Icon.Default uses `this.options.imagePath || IconDefault.imagePath` as the prefix for the icon URL.
29+
// new String('') is an empty string that is truthy, resulting in an empty prefix (which we want for the data URL).
30+
imagePath: new String('') as string,
31+
iconUrl: url,
32+
iconRetinaUrl: url,
33+
shadowUrl: markerShadowUrl
34+
}) as Icon;
2835
}
2936

3037
export const defaultIcon = createDefaultMarkerIcon({ color1: "#2e6c97", color2: "#3883b7", color3: "#126fc6", color4: "#4c9cd1" });

0 commit comments

Comments
 (0)