Skip to content

Commit

Permalink
Merge pull request #1010 from dbauszus-glx/skip-theme
Browse files Browse the repository at this point in the history
Skip themes with skip flag
  • Loading branch information
dbauszus-glx authored Nov 21, 2023
2 parents b3e97f6 + dab5321 commit bd49a07
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/layer/decorate.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,18 @@ export default async layer => {
// Layer style has multiple themes.
if (layer.style?.themes) {

Object.keys(layer.style.themes).forEach(key => {

// Assign theme key as title if undefined.
layer.style.themes[key].title ??= key

if (layer.style.themes[key].skip) delete layer.style.themes[key]
})

// Keep object theme.
layer.style.theme = typeof layer.style.theme === 'object' ? layer.style.theme
layer.style.theme = typeof layer.style.theme === 'object'

? layer.style.theme

// Assign theme from key [string], or first theme.
: layer.style.themes[layer.style.theme || Object.keys(layer.style.themes)[0]];
Expand Down
1 change: 1 addition & 0 deletions lib/ui/layers/panels/style.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ export default layer => {

// Add theme control
if (Object.keys(layer.style.themes || 0).length > 1) {

content.push(mapp.utils.html`
<div>${mapp.dictionary.layer_style_select_theme}</div>
${mapp.ui.elements.dropdown({
Expand Down

0 comments on commit bd49a07

Please sign in to comment.