Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix center and add pointRadius, innerRef #213

Merged
merged 3 commits into from
Dec 11, 2017
Merged
Changes from all commits
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
7 changes: 6 additions & 1 deletion packages/vx-geo/src/projections/Projection.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ export default function Projection({
graticuleLines,
graticuleOutline,
className,
innerRef,
pointRadius,
...restProps
}) {
const currProjection = projectionMapping[projection]();
Expand All @@ -47,14 +49,16 @@ export default function Projection({
if (clipExtent) currProjection.clipExtent(clipExtent);
if (scale) currProjection.scale(scale);
if (translate) currProjection.translate(translate);
if (center) currProjection.translate(center);
if (center) currProjection.center(center);
if (rotate) currProjection.rotate(rotate);
if (precision) currProjection.rotate(precision);
if (fitExtent) currProjection.fitExtent(...fitExtent);
if (fitSize) currProjection.fitSize(...fitSize);

const path = geoPath().projection(currProjection);

if (pointRadius) path.pointRadius(pointRadius);
Copy link
Contributor

@kachkaev kachkaev Nov 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (pointRadius) path.pointRadius(pointRadius);
if (pointRadius !== undefined) path.pointRadius(pointRadius);

👋 folks! Do you if pointRaidus can be 0? Would it be a valid input? I can change this in #1767 if it makes sense.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @kachkaev according to the d3-geo docs this should be a 2-element numerical array https://d3js.org/d3-geo/projection#projection_center

that's consistent with our @visx/geo types / docs https://airbnb.io/visx/docs/geo#Projection_center

so I don't think 0 is valid.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it’s related to https://d3js.org/d3-geo/path#path_pointRadius (one number)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦 🤦 🤦 sorry no idea how I misread that one. 100% agree with you/thanks for adding in your new PR 🙏


return (
<Group className={`vx-geo`}>
{graticule &&
Expand All @@ -75,6 +79,7 @@ export default function Projection({
<path
className={cx(`vx-geo-${projection}`, className)}
d={path(feature)}
ref={innerRef && innerRef(feature, i)}
{...additionalProps(restProps, {
...feature,
index: i,
Expand Down