Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/components/src/map-container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,12 @@ export default function MapContainerFactory(
} as Partial<LayerBaseConfig>);
};

_onForceUpdate = () => {
Comment thread
igorDykhta marked this conversation as resolved.
Outdated
// Force a map re-render by triggering a minimal map state update
Comment thread
igorDykhta marked this conversation as resolved.
Outdated
const {mapStateActions, mapState, index} = this.props;
mapStateActions.updateMap({width: mapState.width, height: mapState.height}, index);
Comment thread
igorDykhta marked this conversation as resolved.
Outdated
};

_onLayerFilteredItemsChange = (idx, event) => {
this.props.visStateActions.layerFilteredItemsChange(this.props.visState.layers[idx], event);
};
Expand Down Expand Up @@ -841,7 +847,8 @@ export default function MapContainerFactory(
onLayerHover: this._onLayerHover,
onSetLayerDomain: this._onLayerSetDomain,
onFilteredItemsChange: this._onLayerFilteredItemsChange,
onWMSFeatureInfo: this._onWMSFeatureInfo
onWMSFeatureInfo: this._onWMSFeatureInfo,
onForceUpdate: this._onForceUpdate
},
deckGlProps
);
Expand Down
12 changes: 10 additions & 2 deletions src/layers/src/icon-layer/icon-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import {
VisConfigNumber,
VisConfigRange,
Merge,
LayerColumn
LayerColumn,
BindedLayerCallbacks
} from '@kepler.gl/types';

export type IconLayerColumnsConfig = {
Expand Down Expand Up @@ -112,6 +113,7 @@ export default class IconLayer extends Layer {
_layerInfoModal: () => JSX.Element;
iconGeometry: IconGeometry;
iconGeometryVersion: number;
protected forceUpdate: BindedLayerCallbacks['onForceUpdate'] = undefined;
Comment thread
igorDykhta marked this conversation as resolved.
Outdated

declare visConfigSettings: IconLayerVisConfigSettings;
declare config: IconLayerConfig;
Expand Down Expand Up @@ -246,6 +248,9 @@ export default class IconLayer extends Layer {
this.iconGeometryVersion += 1;

this._layerInfoModal = IconInfoModalFactory(svgIcons);

// Trigger a map redraw so deck.gl picks up the new geometry
this.forceUpdate?.();
Comment thread
igorDykhta marked this conversation as resolved.
Outdated
}

static findDefaultLayerProps({
Expand Down Expand Up @@ -361,7 +366,10 @@ export default class IconLayer extends Layer {
}

renderLayer(opts) {
const {data, gpuFilter, objectHovered, mapState, interactionConfig} = opts;
const {data, gpuFilter, objectHovered, mapState, interactionConfig, layerCallbacks} = opts;

// Store callback to trigger map redraw when icon geometry loads asynchronously
this.forceUpdate = layerCallbacks?.onForceUpdate;
Comment thread
igorDykhta marked this conversation as resolved.
Outdated

const radiusScale = this.getRadiusScaleByZoom(mapState);

Expand Down
2 changes: 2 additions & 0 deletions src/types/layers.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ export type LayerCallbacks = {
coordinate?: [number, number] | null;
}
) => void;
onForceUpdate?: (idx: number) => void;
};

export type BindedLayerCallbacks = {
Expand All @@ -436,6 +437,7 @@ export type BindedLayerCallbacks = {
featureInfo: Array<{name: string; value: string}> | string | null,
coordinate?: [number, number]
) => void;
onForceUpdate?: () => void;
};

export type VisualChannelAggregation = 'colorAggregation' | 'sizeAggregation';
Expand Down