diff --git a/modules/aggregation-layers/src/aggregation-layer-v9/aggregation-layer.ts b/modules/aggregation-layers/src/aggregation-layer-v9/aggregation-layer.ts index 0f5e8ce4c45..86b29e37c27 100644 --- a/modules/aggregation-layers/src/aggregation-layer-v9/aggregation-layer.ts +++ b/modules/aggregation-layers/src/aggregation-layer-v9/aggregation-layer.ts @@ -4,7 +4,8 @@ import { LayerContext, UpdateParameters, CompositeLayerProps, - Attribute + Attribute, + AttributeManager } from '@deck.gl/core'; import {Aggregator} from './aggregator'; @@ -28,7 +29,7 @@ export default abstract class AggregationLayer< cpuAggregator: CPUAggregator | null; }; - /** Allow this layer to have an AttributeManager and participates in the draw cycle */ + /** Allow this layer to participates in the draw cycle */ get isDrawable() { return true; } @@ -89,6 +90,14 @@ export default abstract class AggregationLayer< return this.state.gpuAggregator || this.state.cpuAggregator; } + // override CompositeLayer._getAttributeManager to create AttributeManager instance + _getAttributeManager() { + return new AttributeManager(this.context.device, { + id: this.props.id, + stats: this.context.stats + }); + } + // Override CompositeLayer._postUpdate to update attributes and the CPUAggregator protected _postUpdate(updateParams: UpdateParameters, forceUpdate: boolean) { this._updateAttributes(); diff --git a/modules/core/src/lib/composite-layer.ts b/modules/core/src/lib/composite-layer.ts index 1f31c3ab2bb..c039dbd65cc 100644 --- a/modules/core/src/lib/composite-layer.ts +++ b/modules/core/src/lib/composite-layer.ts @@ -21,6 +21,7 @@ import Layer, {UpdateParameters} from './layer'; import debug from '../debug/index'; import {flatten} from '../utils/flatten'; +import type AttributeManager from './attribute/attribute-manager'; import type {PickingInfo, GetPickingInfoParams} from './picking/pick-info'; import type {FilterContext} from '../passes/layers-pass'; import type {LayersList, LayerContext} from './layer-manager'; @@ -257,6 +258,11 @@ export default abstract class CompositeLayer extends Lay } } + /** Override base Layer method */ + protected _getAttributeManager(): AttributeManager | null { + return null; + } + /** (Internal) Called after an update to rerender sub layers */ protected _postUpdate(updateParams: UpdateParameters, forceUpdate: boolean) { // @ts-ignore (TS2531) this method is only called internally when internalState is defined diff --git a/modules/core/src/lib/layer.ts b/modules/core/src/lib/layer.ts index 4707a6b7d25..52397496c21 100644 --- a/modules/core/src/lib/layer.ts +++ b/modules/core/src/lib/layer.ts @@ -884,7 +884,7 @@ export default abstract class Layer extends Component< debug(TRACE_INITIALIZE, this); - const attributeManager = this.isDrawable ? this._getAttributeManager() : null; + const attributeManager = this._getAttributeManager(); if (attributeManager) { // All instanced layers get instancePickingColors attribute by default