Skip to content

Commit 61fdd03

Browse files
committed
Hide output when empty
1 parent a3866fe commit 61fdd03

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/mapml/layers/FeatureIndex.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,21 @@ export var FeatureIndex = L.Layer.extend({
110110

111111
_addOrRemoveFeatureIndex: function (e) {
112112
let obj = this;
113+
let features = this._body.allFeatures ? this._body.allFeatures.length : 0;
113114
setTimeout(function() {
114115
if (e && e.type === "focus") {
115116
obj._container.removeAttribute("hidden");
116-
obj._output.removeAttribute("hidden");
117+
if (features !== 0) obj._output.removeAttribute("hidden");
117118
} else if (e && e.type === "blur") {
118119
obj._container.setAttribute("hidden", "");
119120
obj._output.setAttribute("hidden", "");
120121
} else if (obj._map.isFocused) {
121122
obj._container.removeAttribute("hidden");
122-
obj._output.removeAttribute("hidden");
123+
if (features !== 0) {
124+
obj._output.removeAttribute("hidden");
125+
} else {
126+
obj._output.setAttribute("hidden", "");
127+
}
123128
} else {
124129
obj._container.setAttribute("hidden", "");
125130
obj._output.setAttribute("hidden", "");

0 commit comments

Comments
 (0)