Skip to content

Commit 1c51441

Browse files
committed
feat(font-awesome 6): added support for text pins
1 parent 6ffa574 commit 1c51441

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

app/Http/Controllers/API/v3/FontAwesome/v6/PinController.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,39 @@ protected function showIconPin(Request $request)
6262

6363
return response($mapMarkerMarkup)->header('Content-Type', 'image/svg+xml');
6464
}
65+
66+
protected function showTextPin(Request $request)
67+
{
68+
// GET MARKER CONFIG
69+
$markerSize = $request->get('size', 100);
70+
71+
// TEXT
72+
$text = $request->get('text', '');
73+
$textSize = $markerSize / 3.00;
74+
$textFont = 'Arial';
75+
$textFontColor = '#'.$request->get('color', '000');
76+
77+
// BACKGROUND ICON
78+
$backgroundIcon = 'fa-solid fa-location-pin';
79+
$backgroundIconColor = '#'.$request->get('background', 'CCC');
80+
$backgroundIconMarkup = GetIconMarkup::run($backgroundIcon);
81+
82+
// LABEL
83+
$labelMarkup = GetLabelMarkup::run(request: $request, markerSize: $markerSize);
84+
85+
$mapMarkerMarkup = <<<EOD
86+
<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 100 100" width="{$markerSize}" height="{$markerSize}">
87+
<!--! Generated with MapMarker.io - https://mapmarker.io License - https://www.mapmarker.io/license -->
88+
<svg fill="{$backgroundIconColor}">
89+
{$backgroundIconMarkup}
90+
</svg>
91+
92+
<text x="50%" y="30%" fill="{$textFontColor}" text-anchor="middle" dy=".5em" font-size="{$textSize}" font-family="{$textFont}">{$text}</text>
93+
94+
{$labelMarkup}
95+
</svg>
96+
EOD;
97+
98+
return response($mapMarkerMarkup)->header('Content-Type', 'image/svg+xml');
99+
}
65100
}

0 commit comments

Comments
 (0)