Skip to content

Commit 7da6476

Browse files
committed
fix: proper scaling for icons
1 parent 52b04e1 commit 7da6476

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/icons.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ export function MaterialIcons(
5959
}
6060

6161
return iconId =>
62-
createSpan(materialIconsClasses[optionsWithDefaults.style], iconId);
62+
createSpan(materialIconsClasses[optionsWithDefaults.style], iconId, {
63+
fontSize: 'calc(15px * var(--marker-scale, 1.0))'
64+
});
6365
}
6466

6567
export function PlaceIcons(): IconProvider {
@@ -74,13 +76,20 @@ export function PlaceIcons(): IconProvider {
7476
*
7577
* @param className
7678
* @param content
79+
* @param styles
7780
*/
78-
function createSpan(className: string, content: string): HTMLElement {
81+
function createSpan(
82+
className: string,
83+
content: string,
84+
styles: Record<string, string | number> | null = null
85+
): HTMLElement {
7986
const el = document.createElement('span');
8087

8188
el.className = className;
8289
el.textContent = content;
8390

91+
Object.assign(el.style, styles);
92+
8493
return el;
8594
}
8695

src/marker.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ export class Marker<TUserData = unknown> {
281281
this.updateGlyph_(attrs);
282282
}
283283

284-
if (content && this.markerView_.element) {
284+
if (this.markerView_.element) {
285285
const el = this.markerView_.element as HTMLElement;
286286
const {
287287
color = null,

0 commit comments

Comments
 (0)