Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip themes with skip flag #1010

Merged
merged 2 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion lib/layer/decorate.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,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