Skip to content

Commit

Permalink
carto: fix subLayerProps overriding in VectorTileLayer (#9075)
Browse files Browse the repository at this point in the history
  • Loading branch information
zbigg authored and felixpalmer committed Aug 6, 2024
1 parent 8bd7ba6 commit d4a5c07
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions modules/carto/src/layers/vector-tile-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,19 +134,30 @@ export default class VectorTileLayer<
const tileBbox = props.tile.bbox as any;
const {west, south, east, north} = tileBbox;

const extensions = [new ClipExtension(), ...(props.extensions || [])];
const clipProps = {
extensions: [new ClipExtension(), ...(props.extensions || [])],
clipBounds: [west, south, east, north]
};

const applyClipExtensionToSublayerProps = (subLayerId: string) => {
return {
[subLayerId]: {
...clipProps,
...props?._subLayerProps?.[subLayerId],
extensions: [...extensions, ...(props?._subLayerProps?.[subLayerId]?.extensions || [])]
}
};
};

const subLayerProps = {
...props,
autoHighlight: false,
// Do not perform clipping on points (#9059)
_subLayerProps: {
'polygons-fill': clipProps,
'polygons-stroke': clipProps,
linestrings: clipProps
...props._subLayerProps,
...applyClipExtensionToSublayerProps('polygons-fill'),
...applyClipExtensionToSublayerProps('polygons-stroke'),
...applyClipExtensionToSublayerProps('linestrings')
}
};

Expand Down

0 comments on commit d4a5c07

Please sign in to comment.