From 1274f054b420542b7554a06a8ea62a9b8a25b111 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Mon, 23 Dec 2019 17:30:03 -0500 Subject: [PATCH 1/2] only show when visible --- .../widget_overlay/layer_control/layer_toc/toc_entry/view.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/legacy/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/view.js b/x-pack/legacy/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/view.js index b843d2d4758d4..48ea334d80d6f 100644 --- a/x-pack/legacy/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/view.js +++ b/x-pack/legacy/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/view.js @@ -46,7 +46,8 @@ export class TOCEntry extends React.Component { }; async _loadHasLegendDetails() { - const hasLegendDetails = await this.props.layer.hasLegendDetails(); + const hasLegendDetails = + (await this.props.layer.hasLegendDetails()) && this.props.layer.isVisible(); if (this._isMounted && hasLegendDetails !== this.state.hasLegendDetails) { this.setState({ hasLegendDetails }); } From 48b2866fb16ee43a6b1fae970d50ea32770bb619 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Thu, 26 Dec 2019 09:32:36 -0500 Subject: [PATCH 2/2] also hide if outside zoomrange --- .../widget_overlay/layer_control/layer_toc/toc_entry/view.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/x-pack/legacy/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/view.js b/x-pack/legacy/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/view.js index 48ea334d80d6f..c9f115c1ba4cc 100644 --- a/x-pack/legacy/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/view.js +++ b/x-pack/legacy/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/view.js @@ -47,7 +47,9 @@ export class TOCEntry extends React.Component { async _loadHasLegendDetails() { const hasLegendDetails = - (await this.props.layer.hasLegendDetails()) && this.props.layer.isVisible(); + (await this.props.layer.hasLegendDetails()) && + this.props.layer.isVisible() && + this.props.layer.showAtZoomLevel(this.props.zoom); if (this._isMounted && hasLegendDetails !== this.state.hasLegendDetails) { this.setState({ hasLegendDetails }); }