Skip to content

Commit 208bc96

Browse files
author
Natalia Kowalczyk
committed
remove handling visibility expressions in layer metadata
1 parent 01db110 commit 208bc96

4 files changed

Lines changed: 2 additions & 141 deletions

File tree

lib/map.js

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const object = require('./object');
33
const util = require('./util');
44
const makeEventHandler = require('./event-handler');
55
const mapGestures = require('@mapwhit/map-gestures').default;
6-
const { initVisibility, evalVisibility } = require('./style/visibility');
76
const { query, refresh: refreshFeatures } = require('@mapwhit/features');
87

98
module.exports = map;
@@ -27,8 +26,7 @@ async function map(node, options) {
2726
version: 8,
2827
sources: {},
2928
layers: []
30-
},
31-
visibility: {}
29+
}
3230
},
3331
options
3432
);
@@ -46,7 +44,6 @@ async function map(node, options) {
4644
queryRenderedFeatures,
4745
refresh,
4846
state,
49-
visibility,
5047
zoom,
5148
registerImage
5249
});
@@ -155,23 +152,15 @@ async function map(node, options) {
155152
}
156153
styles = style.layers.reduce(
157154
(result, layer) => {
158-
if (layer.metadata) {
159-
const visibility = initVisibility(layer.id, layer.metadata.visibility);
160-
if (visibility) {
161-
result.visibility.push(visibility);
162-
}
163-
}
164155
if (layer['source-layer'] === 'poi') {
165156
result.poi.push(layer.id);
166157
}
167158
return result;
168159
},
169160
{
170-
poi: [],
171-
visibility: []
161+
poi: []
172162
}
173163
);
174-
evalVisibility(self._m, styles.visibility, options.visibility);
175164
self._images.refresh({
176165
_m: self._m,
177166
ready: true
@@ -225,18 +214,6 @@ async function map(node, options) {
225214
self._m.setGlobalStateProperty(key, value);
226215
}
227216

228-
function visibility(key, value) {
229-
if (key === undefined) {
230-
return options.visibility;
231-
}
232-
if (typeof key === 'object') {
233-
options.visibility = key;
234-
} else {
235-
options.visibility[key] = value;
236-
}
237-
evalVisibility(self._m, styles.visibility, options.visibility);
238-
}
239-
240217
function path2url(url) {
241218
if (typeof url === 'string') {
242219
return url;

lib/style/expression.js

Lines changed: 0 additions & 27 deletions
This file was deleted.

lib/style/visibility.js

Lines changed: 0 additions & 31 deletions
This file was deleted.

test/style/visibility.js

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)