Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Maps] fix zooming while drawing shape filter logs errors in console #88413

Merged
merged 3 commits into from
Jan 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,16 @@ describe('removeOrphanedSourcesAndLayers', () => {
removeOrphanedSourcesAndLayers(mockMbMap, [], spatialFilterLayer);
expect(mockMbMap.getStyle()).toEqual(styleWithSpatialFilters);
});

test('should not remove mapbox gl draw layers and sources', async () => {
const fooLayer = makeMultiSourceMockLayer('foo');
const layerList = [fooLayer];

const currentStyle = getMockStyle(layerList);
currentStyle.layers.push({ id: 'gl-draw-points' });
const mockMbMap = new MockMbMap(currentStyle);

removeOrphanedSourcesAndLayers(mockMbMap, layerList, spatialFilterLayer);
expect(mockMbMap.getStyle()).toEqual(currentStyle);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ export function removeOrphanedSourcesAndLayers(mbMap, layerList, spatialFilterLa
return;
}

// ignore gl-draw layers
if (mbLayer.id.startsWith('gl-draw')) {
return;
}

const layer = layerList.find((layer) => {
return layer.ownsMbLayerId(mbLayer.id);
});
Expand Down