Skip to content

Commit

Permalink
use "light" as a fallback when no theme is provided to leafletLayer()
Browse files Browse the repository at this point in the history
  • Loading branch information
wginsberg committed May 7, 2024
1 parent e638dff commit 0bb2d62
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/frontends/leaflet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,13 @@ const leafletLayer = (options: LeafletLayerOptions = {}): unknown => {
'<a href="https://protomaps.com">Protomaps</a> © <a href="https://openstreetmap.org/copyright">OpenStreetMap</a>';
super(options);

if (options.theme) {
const theme = themes[options.theme];
this.paintRules = paintRules(theme);
this.labelRules = labelRules(theme);
this.backgroundColor = theme.background;
} else {
this.paintRules = options.paintRules || [];
this.labelRules = options.labelRules || [];
this.backgroundColor = options.backgroundColor;
}
const theme = options.theme
? themes[options.theme]
: themes.light;

this.paintRules = options.paintRules || paintRules(theme);
this.labelRules = options.labelRules || labelRules(theme);
this.backgroundColor = options.backgroundColor || theme.background;

this.lastRequestedZ = undefined;
this.tasks = options.tasks || [];
Expand Down

0 comments on commit 0bb2d62

Please sign in to comment.