2015-09-21 59 views

回答

1

它應該是這樣的:

var 
    tile_loading = 0, 
    tile_loaded = 0, 
    tiles_loaded_all = false 
; 
yourTileLayer.getSource().on('tileloadstart', function(evt){ 
    ++tile_loading; 
}); 
yourTileLayer.getSource().on('tileloadend', function(evt){ 
    ++tile_loaded; 
    if(tile_loaded === tile_loading){ 
     tile_loading = 0; 
     tile_loaded = 0; 
     tiles_loaded_all = true; 


    } 
}); 

官方例子 - http://openlayers.org/en/v3.9.0/examples/tile-load-events.html