Skip to content

Commit

Permalink
Merge pull request #190 from Type-Style/189-improve-arrows
Browse files Browse the repository at this point in the history
189 improve arrows
  • Loading branch information
Type-Style authored Dec 29, 2024
2 parents 820403c + 1f47da0 commit 5c4aed3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
1 change: 0 additions & 1 deletion httpdocs/images/marker.svg

This file was deleted.

14 changes: 8 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/client/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const App = () => {

useEffect(() => {
if (!isLoggedIn) return;
const fetchToken = async (path:string, setState:Function) => {
const fetchToken = async (path:string, setState: React.Dispatch<React.SetStateAction<string | null>>) => {
try {
const token = localStorage.getItem("jwt");
const response = await axios.get(path, {
Expand Down
8 changes: 5 additions & 3 deletions src/client/components/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,14 @@ function Map({ entries }: { entries: Models.IEntry[] }) {

// Function to create custom icon with dynamic className
function createCustomIcon(entry: Models.IEntry, iconObj: { className: string, iconSize: number }) {
const defaultArrow = `<path fill="var(--contrastText, currentColor)" d="m34.11959,102.6673l-18.15083,-17.53097l31.75703,-30.64393l-31.75703,-30.64391l18.15083,-17.51581l49.91164,48.15972l-49.91164,48.1749z" transform="rotate(-90, 50, 54.5)"/>`
const triangleArrow = `<polygon fill="var(--contrastText, currentColor)" points="50,0 100,100 0,100" />`

return L.divIcon({
html: `
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
<title>Marker Arrow</title>
<polygon fill="var(--contrastText, currentColor)" points="50,0 100,100 0,100" />
${iconObj.className != "none" ? triangleArrow : defaultArrow}
</svg>`,
shadowUrl: null,
shadowSize: null,
Expand Down Expand Up @@ -162,7 +165,6 @@ function Map({ entries }: { entries: Models.IEntry[] }) {
}



return (
<div className="mapStyle" data-mui-color-scheme={mapStyle}>
<MapContainer className="mapContainer" center={[lastEntry.lat, lastEntry.lon]} zoom={13} maxZoom={19}>
Expand Down Expand Up @@ -212,7 +214,7 @@ function Map({ entries }: { entries: Models.IEntry[] }) {

</LayersControl>

<MarkerClusterGroup disableClusteringAtZoom={15} animateAddingMarkers={true} maxClusterRadius={45}>
<MarkerClusterGroup disableClusteringAtZoom={14} animateAddingMarkers={true} maxClusterRadius={25}>
{cleanEntries.map((entry) => {
const iconObj = getClassName(entry);
if (iconObj.className != "none") { return } // exclude start and end from being in cluster group;
Expand Down

0 comments on commit 5c4aed3

Please sign in to comment.