Skip to content

Commit a0bfdf8

Browse files
authored
[Maps] fix Filter shape stops showing feedback when data refreshes (#89009)
* [Maps] fix Filter shape stops showing feedback when data refreshes * update comment * add curly braces around if
1 parent 5908bd0 commit a0bfdf8

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

x-pack/plugins/maps/public/connected_components/mb_map/sort_layers.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ describe('sortLayer', () => {
135135
{ id: `${BRAVO_LAYER_ID}_circle`, type: 'circle' } as MbLayer,
136136
{ id: `${SPATIAL_FILTERS_LAYER_ID}_fill`, type: 'fill' } as MbLayer,
137137
{ id: `${SPATIAL_FILTERS_LAYER_ID}_circle`, type: 'circle' } as MbLayer,
138+
{ id: `gl-draw-polygon-fill-active.cold`, type: 'fill' } as MbLayer,
138139
{
139140
id: `${CHARLIE_LAYER_ID}_text`,
140141
type: 'symbol',
@@ -158,6 +159,7 @@ describe('sortLayer', () => {
158159
'alpha_text',
159160
'alpha_circle',
160161
'charlie_text',
162+
'gl-draw-polygon-fill-active.cold',
161163
'SPATIAL_FILTERS_LAYER_ID_fill',
162164
'SPATIAL_FILTERS_LAYER_ID_circle',
163165
]);

x-pack/plugins/maps/public/connected_components/mb_map/sort_layers.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ export function getIsTextLayer(mbLayer: MbLayer) {
2828
});
2929
}
3030

31+
export function isGlDrawLayer(mbLayerId: string) {
32+
return mbLayerId.startsWith('gl-draw');
33+
}
34+
3135
function doesMbLayerBelongToMapLayerAndClass(
3236
mapLayer: ILayer,
3337
mbLayer: MbLayer,
@@ -118,6 +122,18 @@ export function syncLayerOrder(mbMap: MbMap, spatialFiltersLayer: ILayer, layerL
118122
}
119123
let beneathMbLayerId = getBottomMbLayerId(mbLayers, spatialFiltersLayer, LAYER_CLASS.ANY);
120124

125+
// Ensure gl-draw layers are on top of all layerList layers
126+
const glDrawLayer = ({
127+
ownsMbLayerId: (mbLayerId: string) => {
128+
return isGlDrawLayer(mbLayerId);
129+
},
130+
} as unknown) as ILayer;
131+
moveMapLayer(mbMap, mbLayers, glDrawLayer, LAYER_CLASS.ANY, beneathMbLayerId);
132+
const glDrawBottomMbLayerId = getBottomMbLayerId(mbLayers, glDrawLayer, LAYER_CLASS.ANY);
133+
if (glDrawBottomMbLayerId) {
134+
beneathMbLayerId = glDrawBottomMbLayerId;
135+
}
136+
121137
// Sort map layer labels
122138
[...layerList]
123139
.reverse()

x-pack/plugins/maps/public/connected_components/mb_map/utils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
import { RGBAImage } from './image_utils';
8+
import { isGlDrawLayer } from './sort_layers';
89

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

1920
// ignore gl-draw layers
20-
if (mbLayer.id.startsWith('gl-draw')) {
21+
if (isGlDrawLayer(mbLayer.id)) {
2122
return;
2223
}
2324

0 commit comments

Comments
 (0)