@@ -42,7 +42,7 @@ import type Context from '../gl/context';
4242import type { CanonicalTileID , OverscaledTileID } from './tile_id' ;
4343import type Framebuffer from '../gl/framebuffer' ;
4444import type Transform from '../geo/transform' ;
45- import type { FeatureStates } from './source_state' ;
45+ import type { FeatureStates , LayerFeatureStates } from './source_state' ;
4646import type { Cancelable } from '../types/cancelable' ;
4747import type { FilterSpecification } from '../style-spec/types' ;
4848import type { TilespaceQueryGeometry } from '../style/query_geometry' ;
@@ -674,12 +674,12 @@ class Tile {
674674 }
675675 }
676676
677- refreshFeatureState ( painter ?: Painter ) {
677+ refreshFeatureState ( painter ?: Painter , states ?: LayerFeatureStates ) {
678678 if ( ! this . latestFeatureIndex || ! ( this . latestFeatureIndex . rawTileData || this . latestFeatureIndex . is3DTile ) || ! painter ) {
679679 return ;
680680 }
681681
682- this . updateBuckets ( painter ) ;
682+ this . updateBuckets ( painter , false , states ) ;
683683 }
684684
685685 hasAppearances ( painter : Painter ) {
@@ -692,7 +692,7 @@ class Tile {
692692 return false ;
693693 }
694694
695- updateBuckets ( painter : Painter , isBrightnessChanged ?: boolean ) {
695+ updateBuckets ( painter : Painter , isBrightnessChanged ?: boolean , states ?: LayerFeatureStates ) {
696696 if ( ! this . latestFeatureIndex ) return ;
697697 if ( ! painter . style ) return ;
698698
@@ -708,8 +708,8 @@ class Tile {
708708 const sourceLayerId = bucketLayer [ 'sourceLayer' ] || '_geojsonTileLayer' ;
709709 const sourceCache = painter . style . getLayerSourceCache ( bucketLayer ) ;
710710
711- let sourceLayerStates : FeatureStates = { } ;
712- if ( sourceCache ) {
711+ let sourceLayerStates : FeatureStates = ( states && states [ sourceLayerId ] ) || { } ;
712+ if ( ! states ) { // only fetch the full state if it's not an incremental state update
713713 sourceLayerStates = sourceCache . _state . getState ( sourceLayerId , undefined ) as FeatureStates ;
714714 }
715715
0 commit comments