@@ -2235,7 +2235,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo }) {
2235
2235
this . _changeSourceListModel ( ) ;
2236
2236
const appreciableLayers = this . getLayers ( ) ;
2237
2237
const layerOptions = this . _getSelfAppreciableLayers ( appreciableLayers ) ;
2238
- this . _rectifyLayersOrder ( layerOptions . layers ) ;
2238
+ this . rectifyLayersOrder ( layerOptions . layers ) ;
2239
2239
this . fire ( 'mapcreatesucceeded' , {
2240
2240
...layerOptions ,
2241
2241
map : this . map ,
@@ -2244,22 +2244,11 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo }) {
2244
2244
}
2245
2245
}
2246
2246
2247
- _rectifyLayersOrder ( appreciableLayers , topLayerBeforeId ) {
2248
- const renderLayers = appreciableLayers
2249
- . filter ( ( item ) => ! item . reused )
2250
- . reduce ( ( layers , layer ) => {
2251
- return layers . concat ( layer . renderLayers ) ;
2252
- } , [ ] ) ;
2247
+ rectifyLayersOrder ( appreciableLayers , topLayerBeforeId ) {
2248
+ const exsitLayers = super . rectifyLayersOrder ( appreciableLayers , topLayerBeforeId ) ;
2253
2249
const labelLayerIds = [ ] ;
2254
- const exsitLayers = renderLayers . filter ( ( layerId ) => ! ! this . map . getLayer ( layerId ) ) ;
2255
2250
for ( let index = exsitLayers . length - 1 ; index > - 1 ; index -- ) {
2256
2251
const targetlayerId = exsitLayers [ index ] ;
2257
- const afterLayers = exsitLayers . slice ( index + 1 ) ;
2258
- let beforLayerId = afterLayers . find ( ( id ) => this . map . style . _layers [ id ] ) ;
2259
- if ( ! afterLayers . length ) {
2260
- beforLayerId = topLayerBeforeId ;
2261
- }
2262
- this . map . moveLayer ( targetlayerId , beforLayerId ) ;
2263
2252
const labelLayerId = this . _getSymbolLabelLayerName ( targetlayerId ) ;
2264
2253
if ( this . map . getLayer ( labelLayerId ) ) {
2265
2254
labelLayerIds . push ( labelLayerId ) ;
@@ -2781,7 +2770,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo }) {
2781
2770
const appreciableLayers = this . getLayers ( ) ;
2782
2771
const selfAppreciableLayers = this . getSelfAppreciableLayers ( appreciableLayers ) ;
2783
2772
const topLayerBeforeId = this . _findTopLayerBeforeId ( selfAppreciableLayers ) ;
2784
- this . _rectifyLayersOrder ( selfAppreciableLayers , topLayerBeforeId ) ;
2773
+ this . rectifyLayersOrder ( selfAppreciableLayers , topLayerBeforeId ) ;
2785
2774
this . fire ( 'layeraddchanged' , this . _getSelfAppreciableLayers ( appreciableLayers ) ) ;
2786
2775
}
2787
2776
}
0 commit comments