Skip to content

Commit

Permalink
undefined distributed style; spread selected style
Browse files Browse the repository at this point in the history
  • Loading branch information
dbauszus-glx committed Mar 26, 2024
1 parent c2346ba commit 3b0c59f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
5 changes: 4 additions & 1 deletion lib/layer/featureStyle.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
18 changes: 13 additions & 5 deletions lib/layer/themes/distributed.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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
}

0 comments on commit 3b0c59f

Please sign in to comment.