Skip to content

Commit

Permalink
[Maps] fix Filter shape stops showing feedback when data refreshes (#…
Browse files Browse the repository at this point in the history
…89009)

* [Maps] fix Filter shape stops showing feedback when data refreshes

* update comment

* add curly braces around if
  • Loading branch information
nreese authored Jan 22, 2021
1 parent 5908bd0 commit a0bfdf8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ describe('sortLayer', () => {
{ id: `${BRAVO_LAYER_ID}_circle`, type: 'circle' } as MbLayer,
{ id: `${SPATIAL_FILTERS_LAYER_ID}_fill`, type: 'fill' } as MbLayer,
{ id: `${SPATIAL_FILTERS_LAYER_ID}_circle`, type: 'circle' } as MbLayer,
{ id: `gl-draw-polygon-fill-active.cold`, type: 'fill' } as MbLayer,
{
id: `${CHARLIE_LAYER_ID}_text`,
type: 'symbol',
Expand All @@ -158,6 +159,7 @@ describe('sortLayer', () => {
'alpha_text',
'alpha_circle',
'charlie_text',
'gl-draw-polygon-fill-active.cold',
'SPATIAL_FILTERS_LAYER_ID_fill',
'SPATIAL_FILTERS_LAYER_ID_circle',
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ export function getIsTextLayer(mbLayer: MbLayer) {
});
}

export function isGlDrawLayer(mbLayerId: string) {
return mbLayerId.startsWith('gl-draw');
}

function doesMbLayerBelongToMapLayerAndClass(
mapLayer: ILayer,
mbLayer: MbLayer,
Expand Down Expand Up @@ -118,6 +122,18 @@ export function syncLayerOrder(mbMap: MbMap, spatialFiltersLayer: ILayer, layerL
}
let beneathMbLayerId = getBottomMbLayerId(mbLayers, spatialFiltersLayer, LAYER_CLASS.ANY);

// Ensure gl-draw layers are on top of all layerList layers
const glDrawLayer = ({
ownsMbLayerId: (mbLayerId: string) => {
return isGlDrawLayer(mbLayerId);
},
} as unknown) as ILayer;
moveMapLayer(mbMap, mbLayers, glDrawLayer, LAYER_CLASS.ANY, beneathMbLayerId);
const glDrawBottomMbLayerId = getBottomMbLayerId(mbLayers, glDrawLayer, LAYER_CLASS.ANY);
if (glDrawBottomMbLayerId) {
beneathMbLayerId = glDrawBottomMbLayerId;
}

// Sort map layer labels
[...layerList]
.reverse()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

import { RGBAImage } from './image_utils';
import { isGlDrawLayer } from './sort_layers';

export function removeOrphanedSourcesAndLayers(mbMap, layerList, spatialFilterLayer) {
const mbStyle = mbMap.getStyle();
Expand All @@ -17,7 +18,7 @@ export function removeOrphanedSourcesAndLayers(mbMap, layerList, spatialFilterLa
}

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

Expand Down

0 comments on commit a0bfdf8

Please sign in to comment.