Skip to content

Commit

Permalink
fix picking with binary geojson (visgl#6011)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pessimistress authored Jul 25, 2021
1 parent 7bc510b commit 1d058a0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion modules/layers/src/geojson-layer/geojson-binary.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export function calculatePickingColors(geojsonBinary, encodePickingColor) {
polygons: null
};
for (const key in pickingColors) {
const featureIds = geojsonBinary[key].featureIds.value;
const featureIds = geojsonBinary[key].globalFeatureIds.value;
pickingColors[key] = new Uint8ClampedArray(featureIds.length * 3);
const pickingColor = [];
for (let i = 0; i < featureIds.length; i++) {
Expand Down
12 changes: 4 additions & 8 deletions modules/layers/src/geojson-layer/geojson-layer-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,17 @@ export function createLayerPropsFromFeatures(features, featuresDiff) {
return layerProps;
}

export function createLayerPropsFromBinary(geojsonBinary, uniqueIdProperty, encodePickingColor) {
export function createLayerPropsFromBinary(geojsonBinary, encodePickingColor) {
const layerProps = createEmptyLayerProps();
const {points, lines, polygons} = geojsonBinary;

const customPickingColors = calculatePickingColors(
geojsonBinary,
uniqueIdProperty,
encodePickingColor
);
const customPickingColors = calculatePickingColors(geojsonBinary, encodePickingColor);

layerProps.points.data = {
length: points.positions.value.length / points.positions.size,
attributes: {
getPosition: points.positions,
pickingColors: {
instancePickingColors: {
size: 3,
value: customPickingColors.points
}
Expand All @@ -67,7 +63,7 @@ export function createLayerPropsFromBinary(geojsonBinary, uniqueIdProperty, enco
startIndices: lines.pathIndices.value,
attributes: {
getPath: lines.positions,
pickingColors: {
instancePickingColors: {
size: 3,
value: customPickingColors.lines
}
Expand Down

0 comments on commit 1d058a0

Please sign in to comment.