Skip to content

Commit 880761f

Browse files
committed
feat: layer minzoom maxzoom support
1 parent fa640cd commit 880761f

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/layers/layer-factory.android.ts

+6
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ export class LayerFactory {
3131

3232
const layer = new Layer(nativeLayer);
3333

34+
if (style.minzoom !== undefined) {
35+
nativeLayer.setMinZoom(style.minzoom);
36+
}
37+
if (style.maxzoom !== undefined) {
38+
nativeLayer.setMaxZoom(style.maxzoom);
39+
}
3440
return layer;
3541
}
3642

src/layers/layer-factory.ios.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { PropertyParser } from './parser/property-parser.ios';
44

55
export class LayerFactory {
66
static async createLayer(style, source): Promise<LayerCommon> {
7-
let nativeLayer;
7+
let nativeLayer: MGLStyleLayer;
88
switch (style.type) {
99
case 'line':
1010
nativeLayer = MGLLineStyleLayer.alloc().initWithIdentifierSource(style.id, source);
@@ -24,7 +24,12 @@ export class LayerFactory {
2424
default:
2525
throw new Error(`Unknown layer type: ${style.type}`);
2626
}
27-
27+
if (style.minzoom !== undefined) {
28+
nativeLayer.minimumZoomLevel = style.minzoom;
29+
}
30+
if (style.maxzoom !== undefined) {
31+
nativeLayer.maximumZoomLevel = style.maxzoom;
32+
}
2833
const layerProperties = this.parseProperties(style.type, Object.assign(style.paint || {}, style.layout || {})); // TODO: handle defaults
2934

3035
for (const propKey in layerProperties) {

0 commit comments

Comments
 (0)