Adding tiles to custom pane
bardrotzer opened this issue · 3 comments
Would it be possible to add an option to draw a mapboxGL tile layer in a custom pane?
I know this was discussed (and closed) in #67, that would be some three years ago. Fixing this would not really be a big issue, something along this, in the onAdd
function (and again in the onRemove
) (https://github.com/mapbox/mapbox-gl-leaflet/blob/master/leaflet-mapbox-gl.js#L40).
// map.getPanes().tilePane.appendChild(this._container);
var paneName = map.getPane(this.options.pane) ? this.options.pane : 'tilePane';
map.getPane(paneName).appendChild(this._container);
An alternative would be to set the pane in the constructor aka:
this._tilePane = map.getPane(this.options.pane) ? this.options.pane : 'tilePane';
and then use it in the onAdd
and onRemove
map.getPane(this._pane).appendChild(this._container);
Please let me know if you see any issues with this, if not I'll open a PR on this issue
This was previously supported. Then for some reason it was regressed.
This was previously supported. Then for some reason it was regressed.
from the sounds of it #68 reverted #10 and #109 reverted #68.
the logic @bardrotzer describes above should allow for both features simultaneously and a PR would still be welcome.
- optional custom panes
- tilePane as a default.