Skip to content

Commit 7ae7330

Browse files
committed
make colors work for scattermap icons, and fetch maki icons from jsdelivr instead of unpkg so we can use maki 8
1 parent c338b60 commit 7ae7330

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

src/plots/map/map.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ proto.createMap = function(calcData, fullLayout, resolve, reject) {
111111
requestedIcons[id] = true;
112112
var img = new Image(15, 15);
113113
img.onload = function() {
114-
map.addImage(id, img);
114+
map.addImage(id, img, {sdf: true});
115115
};
116116
img.crossOrigin = 'Anonymous';
117-
img.src = 'https://unpkg.com/maki@2.1.0/icons/' + id + '.svg';
117+
img.src = "https://cdn.jsdelivr.net/npm/@mapbox/maki@8.2.0/icons/" + id.slice(0, -3) + '.svg';
118118
}
119119
});
120120

src/traces/scattermap/convert.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,11 @@ module.exports = function convert(gd, calcTrace) {
141141

142142
Lib.extendFlat(symbol.paint, {
143143
'icon-opacity': trace.opacity * trace.marker.opacity,
144-
145-
// TODO does not work ??
146-
'icon-color': trace.marker.color
144+
'icon-color': trace.marker.color,
145+
// Set a tiny blur to make the edges look nicer
146+
'icon-halo-color': trace.marker.color,
147+
'icon-halo-width': 2,
148+
'icon-halo-blur': 1.5,
147149
});
148150
}
149151

0 commit comments

Comments
 (0)