diff --git a/lib/layer/featureStyle.mjs b/lib/layer/featureStyle.mjs index 55342d7dee..f2d1d9ede6 100644 --- a/lib/layer/featureStyle.mjs +++ b/lib/layer/featureStyle.mjs @@ -251,7 +251,10 @@ export default layer => { if (layer.locations.selected.has(`${layer.key}!${feature.properties.id}`)) { - feature.style = layer.style.selected + feature.style = { + ...feature.style, + ...layer.style.selected + } return } } diff --git a/lib/layer/themes/distributed.mjs b/lib/layer/themes/distributed.mjs index e82c4f123a..3d02339515 100644 --- a/lib/layer/themes/distributed.mjs +++ b/lib/layer/themes/distributed.mjs @@ -25,13 +25,21 @@ export default function(theme, feature) { theme.index = 0 } + let field = theme.field || 'id' + // Get feature identifier for theme. - const ID = feature.properties[theme.field || 'id'] || 0 + const val = feature.properties[field] + + // Assign theme.style if val is falsy. + if (!val) { + feature.style = theme.style + return; + } // The feature field property value already has a style assigned. - if (theme.lookup[ID]) { + if (theme.lookup[val]) { - feature.style = theme.lookup[ID].style + feature.style = theme.lookup[val].style return; } @@ -88,7 +96,7 @@ export default function(theme, feature) { bbox.themeIdx = i // Assign the style to the lookup object for the feature field property value. - theme.lookup[ID] = theme.categories[i] + theme.lookup[val] = theme.categories[i] - feature.style = theme.lookup[ID].style + feature.style = theme.lookup[val].style } \ No newline at end of file