Skip to content

Commit

Permalink
[FE-17159] Changing the style of the map is affecting layer ordering (#…
Browse files Browse the repository at this point in the history
…653)

Co-authored-by: Christie Villanueva <christie.villanueva@heavy.ai>
  • Loading branch information
cjvil and cjvil committed Aug 30, 2023
1 parent 159f74d commit 1a1cb36
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion dist/charting.js
Original file line number Diff line number Diff line change
Expand Up @@ -38670,6 +38670,7 @@ function mapMixin(_chart, chartDivId, _mapboxgl) {
});
_map.on("styledata", function () {
// reapplying the previous style's render layer to the new style layer when basemap gets changed
var firstSymbolLayerId = getFirstSymbolLayerId();
if (savedLayers.length) {
Object.entries(savedSources).forEach(function (_ref4) {
var _ref5 = _slicedToArray(_ref4, 2),
Expand All @@ -38678,7 +38679,7 @@ function mapMixin(_chart, chartDivId, _mapboxgl) {
if (!_map.getSource(source)) {
_map.addSource(id, source);
savedLayers.forEach(function (layer) {
_map.addLayer(layer);
_map.addLayer(layer, firstSymbolLayerId);
});
savedLayers = [];
savedSources = {};
Expand Down
4 changes: 3 additions & 1 deletion src/mixins/map-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -873,12 +873,14 @@ export default function mapMixin(

_map.on("styledata", () => {
// reapplying the previous style's render layer to the new style layer when basemap gets changed
const firstSymbolLayerId = getFirstSymbolLayerId()

if (savedLayers.length) {
Object.entries(savedSources).forEach(([id, source]) => {
if (!_map.getSource(source)) {
_map.addSource(id, source)
savedLayers.forEach(layer => {
_map.addLayer(layer)
_map.addLayer(layer, firstSymbolLayerId)
})
savedLayers = []
savedSources = {}
Expand Down

0 comments on commit 1a1cb36

Please sign in to comment.