Skip to content

Commit

Permalink
Fix picking in the polygon layer (#113)
Browse files Browse the repository at this point in the history
* Fix picking in the polygon layer

* Fix picking in the polygon layer
  • Loading branch information
kylebarron authored Mar 22, 2024
1 parent 4bc976e commit 688eb4f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
6 changes: 3 additions & 3 deletions examples/polygon/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const NAV_CONTROL_STYLE = {
function Root() {
const onClick = (info: PickingInfo) => {
if (info.object) {
console.log(JSON.stringify(info.object.toJSON()));
console.log(info.object["BoroName"]);
}
};

Expand Down Expand Up @@ -66,10 +66,10 @@ function Root() {
extruded: false,
wireframe: true,
// getElevation: 0,
pickable: false,
pickable: true,
positionFormat: "XY",
_normalize: false,
autoHighlight: true,
autoHighlight: false,
earcutWorkerUrl: new URL(
"https://cdn.jsdelivr.net/npm/@geoarrow/[email protected]/dist/earcut-worker.min.js",
),
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"examples/*"
],
"name": "@geoarrow/deck.gl-layers",
"version": "0.3.0-beta.14",
"version": "0.3.0-beta.15",
"type": "module",
"description": "",
"source": "src/index.ts",
Expand Down
5 changes: 4 additions & 1 deletion src/polygon-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ export class GeoArrowPolygonLayer<
sourceLayer: { props: GeoArrowExtraPickingProps };
},
): GeoArrowPickingInfo {
return getPickingInfo(params, this.props.data);
// Propagate the picked info from the SolidPolygonLayer
return params.info;
}

renderLayers(): Layer<{}> | LayersList | null {
Expand Down Expand Up @@ -348,6 +349,8 @@ export class GeoArrowPolygonLayer<
data: table,
positionFormat,
getPath,
// We only pick solid polygon layers, not the path layers
pickable: false,
},
);

Expand Down

0 comments on commit 688eb4f

Please sign in to comment.