Skip to content

Commit

Permalink
fix(landing): hide label button on debug page as its broken BM-20 (#3341
Browse files Browse the repository at this point in the history
)

### Motivation

the labels view requires the "labels" style to exist, this generally
does not exist inside of custom configs.

### Modifications

Hide the label button when custom configs on the debug page.

### Verification

Manually tested with current debug page.
  • Loading branch information
blacha authored Sep 16, 2024
1 parent 406b3eb commit f1424a0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/landing/src/components/map.label.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,22 @@ export class MapLabelControl implements IControl {
Config.map.setLabels(labelState);
};

/** Is the label button hidden from view */
isDisabled(): boolean {
// Most vector styles have overlaps with the labels and make them useless
if (Config.map.style && LabelsDisabledLayers.has(Config.map.style)) return true;
// Labels use the merge style feature and need the production configuration to work
if (Config.map.isDebug && Config.map.config) return true;

return false;
}

updateLabelIcon = (): void => {
if (this.button == null) return;
this.button.classList.remove('maplibregl-ctrl-labels-enabled');

// Topographic style disables the button
if (Config.map.style && LabelsDisabledLayers.has(Config.map.style)) {
if (this.isDisabled()) {
this.button.classList.add('display-none');
this.button.title = 'Topographic style does not support layers';
return;
Expand Down

0 comments on commit f1424a0

Please sign in to comment.