A marker is rasterised once per icon and colour, so a single raster stands in
for every category drawn that way -- Shrine and Daedric Shrine, House and
House (Ownable), and the ten Skyrim ores that all take the pickaxe. Only the
first of them asks for it; the rest wait on the same key.
When the raster arrived, the style cache was cleared for the category that had
asked, and for nobody else. Everyone sharing the icon kept the initials they
had cached while the image was still loading, and kept them for good: "H(" and
"S" and "Po" scattered across the map. Clicking one drew it properly, because
a selected marker is a style that had never been cached.
Every marker style is dropped when a raster lands. Recomputing them is lazy
and cheap, and no category is left holding a fallback it can never learn to
replace.- commit
- 818c67afca05cbb5baffc3a51c48e73ecbbccbe9
- parent
- b4a126e15d7ba398e38ed3f39ab00d84b6f2f929
- author
- Dami <dami.etoile@gmail.com>
| M | frontend/ | 14 | ++++++++++++-- |
@@ -2131,8 +2131,12 @@ function prepareMarkerIcon(category) {
21312131 }21322132 context.drawImage(tinted, 0, 0);21332133 state.markerIcons.set(key, canvas.toDataURL("image/png"));2134- state.styleCache.delete(`marker:${category.id}:0`);2135- state.styleCache.delete(`marker:${category.id}:1`);2134+ // A raster is keyed by asset and colour, so it stands in for every category2135+ // drawn that way -- Shrine and Daedric Shrine, House and House (Ownable) --2136+ // and only one of them asked for it. Every marker style is dropped rather2137+ // than that category's two, because the others cached their initials while2138+ // this was still loading and have nothing to tell them the icon arrived.2139+ dropMarkerStyles();21362140 state.layers.pins.changed();21372141 state.layers.zonePins.changed();21382142 state.layers.priority.changed();@@ -2141,6 +2145,12 @@ function prepareMarkerIcon(category) {
21412145 source.src = iconURL(category.iconAsset);21422146 }21432147 2148+function dropMarkerStyles() {2149+ for (const key of state.styleCache.keys()) {2150+ if (key.startsWith("marker:")) state.styleCache.delete(key);2151+ }2152+}2153+21442154 function markerIconKey(category) {21452155 return `${category.iconAsset || ""}:${categoryColor(category)}:${state.map?.iconOutset || "light"}`;21462156 }