@@ -2235,7 +2235,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo }) {
22352235 this . _changeSourceListModel ( ) ;
22362236 const appreciableLayers = this . getLayers ( ) ;
22372237 const layerOptions = this . _getSelfAppreciableLayers ( appreciableLayers ) ;
2238- this . _rectifyLayersOrder ( layerOptions . layers ) ;
2238+ this . rectifyLayersOrder ( layerOptions . layers ) ;
22392239 this . fire ( 'mapcreatesucceeded' , {
22402240 ...layerOptions ,
22412241 map : this . map ,
@@ -2244,22 +2244,11 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo }) {
22442244 }
22452245 }
22462246
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 ) ;
22532249 const labelLayerIds = [ ] ;
2254- const exsitLayers = renderLayers . filter ( ( layerId ) => ! ! this . map . getLayer ( layerId ) ) ;
22552250 for ( let index = exsitLayers . length - 1 ; index > - 1 ; index -- ) {
22562251 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 ) ;
22632252 const labelLayerId = this . _getSymbolLabelLayerName ( targetlayerId ) ;
22642253 if ( this . map . getLayer ( labelLayerId ) ) {
22652254 labelLayerIds . push ( labelLayerId ) ;
@@ -2781,7 +2770,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo }) {
27812770 const appreciableLayers = this . getLayers ( ) ;
27822771 const selfAppreciableLayers = this . getSelfAppreciableLayers ( appreciableLayers ) ;
27832772 const topLayerBeforeId = this . _findTopLayerBeforeId ( selfAppreciableLayers ) ;
2784- this . _rectifyLayersOrder ( selfAppreciableLayers , topLayerBeforeId ) ;
2773+ this . rectifyLayersOrder ( selfAppreciableLayers , topLayerBeforeId ) ;
27852774 this . fire ( 'layeraddchanged' , this . _getSelfAppreciableLayers ( appreciableLayers ) ) ;
27862775 }
27872776 }
0 commit comments