Skip to content

Commit 688eb4f

Browse files
authored
Fix picking in the polygon layer (#113)
* Fix picking in the polygon layer * Fix picking in the polygon layer
1 parent 4bc976e commit 688eb4f

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

examples/polygon/app.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const NAV_CONTROL_STYLE = {
2929
function Root() {
3030
const onClick = (info: PickingInfo) => {
3131
if (info.object) {
32-
console.log(JSON.stringify(info.object.toJSON()));
32+
console.log(info.object["BoroName"]);
3333
}
3434
};
3535

@@ -66,10 +66,10 @@ function Root() {
6666
extruded: false,
6767
wireframe: true,
6868
// getElevation: 0,
69-
pickable: false,
69+
pickable: true,
7070
positionFormat: "XY",
7171
_normalize: false,
72-
autoHighlight: true,
72+
autoHighlight: false,
7373
earcutWorkerUrl: new URL(
7474
"https://cdn.jsdelivr.net/npm/@geoarrow/[email protected]/dist/earcut-worker.min.js",
7575
),

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"examples/*"
55
],
66
"name": "@geoarrow/deck.gl-layers",
7-
"version": "0.3.0-beta.14",
7+
"version": "0.3.0-beta.15",
88
"type": "module",
99
"description": "",
1010
"source": "src/index.ts",

src/polygon-layer.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ export class GeoArrowPolygonLayer<
185185
sourceLayer: { props: GeoArrowExtraPickingProps };
186186
},
187187
): GeoArrowPickingInfo {
188-
return getPickingInfo(params, this.props.data);
188+
// Propagate the picked info from the SolidPolygonLayer
189+
return params.info;
189190
}
190191

191192
renderLayers(): Layer<{}> | LayersList | null {
@@ -348,6 +349,8 @@ export class GeoArrowPolygonLayer<
348349
data: table,
349350
positionFormat,
350351
getPath,
352+
// We only pick solid polygon layers, not the path layers
353+
pickable: false,
351354
},
352355
);
353356

0 commit comments

Comments
 (0)