Skip to content

Commit d2cf843

Browse files
committed
chore(collections/map): make icon inside marker bigger
1 parent 5fec097 commit d2cf843

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

apps/client/src/widgets/collections/geomap/Markers.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ const LABEL_LAYOUT: Extract<AddLayerObject, { type: "symbol"}>["layout"] = {
2323
"text-allow-overlap": true,
2424
};
2525

26+
const MARKER_WIDTH = 25;
27+
const MARKER_ICON_SIZE = 20;
28+
const MARKER_ICON_X = (MARKER_WIDTH / 2) - (MARKER_ICON_SIZE / 2);
29+
2630
export default function Markers({ note, hideLabels }: { note: FNote, hideLabels: boolean }) {
2731
const map = useContext(ParentMap);
2832
const childNotes = useChildNotes(note?.noteId);
@@ -130,16 +134,16 @@ export default function Markers({ note, hideLabels }: { note: FNote, hideLabels:
130134

131135
//#region Renderer
132136
async function buildMarkerIcon(color: string, iconClass: string, scale = window.devicePixelRatio || 1) {
133-
const iconUrl = iconClassToBitmapCache.get(iconClass) ?? await snapshotIcon(iconClass, 16 * scale);
137+
const iconUrl = iconClassToBitmapCache.get(iconClass) ?? await snapshotIcon(iconClass, MARKER_ICON_SIZE * scale);
134138
return `\
135-
<svg width="${25 * scale}" height="${41 * scale}" viewBox="0 0 25 41" xmlns="http://www.w3.org/2000/svg">
139+
<svg width="${MARKER_WIDTH * scale}" height="${41 * scale}" viewBox="0 0 ${MARKER_WIDTH} 41" xmlns="http://www.w3.org/2000/svg">
136140
<defs>
137141
<filter id="shadow" x="-50%" y="-50%" width="200%" height="200%">
138142
<feDropShadow dx="0" dy="2" stdDeviation="3" flood-color="black" flood-opacity="0.4" />
139143
</filter>
140144
</defs>
141145
<path d="M12.5 0C5.6 0 0 5.6 0 12.5C0 21.9 12.5 41 12.5 41S25 21.9 25 12.5C25 5.6 19.4 0 12.5 0Z" filter="url(#shadow)" fill="${color}" />
142-
<image href="${iconUrl}" x="4.5" y="4.5" width="16" height="16" preserveAspectRatio="xMidYMid meet" />
146+
<image href="${iconUrl}" x="${MARKER_ICON_X}" y="4" width="${MARKER_ICON_SIZE}" height="${MARKER_ICON_SIZE}" preserveAspectRatio="xMidYMid meet" />
143147
</svg>
144148
`;
145149
}

0 commit comments

Comments
 (0)