minzoom seems not to work with custom layers
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
I have used the mapbox example from [Add a 3D model](https://docs.mapbox.com/mapbox-gl-js/example/add-3d-model/) but when I add `minzoom : 17,` property to the layer definition is not hidden once the zoom out is lower, but it works well with other fill or fill extrusion layers.
Is this a known bug, a constrain or by design decision?
**mapbox-gl-js v1.10.1**:
**browser**:
### Steps to Trigger Behavior
1. Just add `minzoom : 17,` to the fiddle sample [Add a 3D model](https://docs.mapbox.com/mapbox-gl-js/example/add-3d-model/)
### Link to Demonstration
Here's the test [fiddle](https://jsfiddle.net/3mpotsqy/1/)
### Expected Behavior
The Layer should hide as any other layer
### Workaround
I found a workaround but must be done after the layer is created through addLayer which is not ideal. You must execute setLayerZoomRange explicitly, the attribute in the addLayer creation doesn't work for custom layers.
`map.setLayerZoomRange('layername', 17, 22);`
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Add a 3D model example and its linked JSFiddle, then trace how the custom layer is passed to addLayer and how setLayerZoomRange handles the same layer. Confirm whether minzoom is ignored for this custom layer type; done means the layer hides below zoom 17 without requiring the explicit workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- computer-graphics, frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100