From d40d44bc6da012f3a519df9a9cb6673e6fd760b0 Mon Sep 17 00:00:00 2001 From: Matt-Hurd Date: Sun, 17 Sep 2023 09:34:28 -0500 Subject: [PATCH] Allow custom icons --- src/components/MapDisplay/RouteMarkers.tsx | 2 +- src/models/Game.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/MapDisplay/RouteMarkers.tsx b/src/components/MapDisplay/RouteMarkers.tsx index 6c37d41..97377a0 100644 --- a/src/components/MapDisplay/RouteMarkers.tsx +++ b/src/components/MapDisplay/RouteMarkers.tsx @@ -38,7 +38,7 @@ export const RouteMarkers: React.FC = ({ branch, activeThing } const newIcon = L.icon({ - iconUrl: route?.url + "icons/" + thing.icon + ".png", + iconUrl: route?.game.icons[thing.icon] || new URL("/assets/images/route_icons/blank.png", import.meta.url).href, iconSize: [40, 40], iconAnchor: [20, 20], }); diff --git a/src/models/Game.ts b/src/models/Game.ts index af7a0fe..f230538 100644 --- a/src/models/Game.ts +++ b/src/models/Game.ts @@ -4,10 +4,12 @@ export default class Game { id: string; name: string; layers: { [key: string]: Layer }; + icons: { [key: string]: string }; constructor(id: string, name: string) { this.id = id; this.name = name; this.layers = {}; + this.icons = {}; } }