Skip to content

BGDIINF_SB-2859: Removing legend button#403

Merged
ltkum merged 1 commit intodevelopfrom
BGDIINF_SB-2859-remomve-legend-icon-when-no-legend
May 1, 2023
Merged

BGDIINF_SB-2859: Removing legend button#403
ltkum merged 1 commit intodevelopfrom
BGDIINF_SB-2859-remomve-legend-icon-when-no-legend

Conversation

@ltkum
Copy link
Contributor

@ltkum ltkum commented Apr 25, 2023

Issue : Some layers have no legend, and upon clicking the legend button, the legend popup shows up and looks like it's perpetually loading content.

Fix : We added a hasLegend getter in the abstractLayer class, which is then called to decide wheter we show the legend button or not.

Currently, we consider KML and external layers has having no legend. A refinement might be needed further down in the line to ensure layers with legends show the legend icon, but this is sufficient for now.

Test link

@ltkum ltkum requested a review from pakb April 25, 2023 11:09
@ltkum ltkum force-pushed the BGDIINF_SB-2859-remomve-legend-icon-when-no-legend branch 5 times, most recently from 4f0b4cd to 618894a Compare April 28, 2023 07:18
Issue : Some layers have no legend, and upon clicking the legend button,
the legend popup shows up and looks like it's perpetually loading
content.

Fix : We added a `hasLegend` getter in the abstractLayer class, which is
then called to decide wheter we show the legend button or not.

Currently, we consider KML and external layers has having no legend. A
refinement might be needed further down in the line to ensure layers
with legends show the legend icon, but this is sufficient for now.

importing layertypes

remove logs
Comment on lines +183 to +186
if (this.layer !== null) {
return this.layer.hasLegend
}
return false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just for curiosity, you can "one line" this in JS with the optional chaining :
return this.layer?.hasLegend

with this notation, hasLegend will only be accessed if this.layer is valid (not null or undefined), otherwise it returns null (and as null is somewhat equivalent to false in JS, that works pretty well)

@ltkum ltkum merged commit 9444635 into develop May 1, 2023
@ltkum ltkum deleted the BGDIINF_SB-2859-remomve-legend-icon-when-no-legend branch May 1, 2023 07:49
@pakb pakb mentioned this pull request May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants