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

Add d3.pathRound. #12

Merged
merged 9 commits into from
Dec 19, 2022
Merged

Add d3.pathRound. #12

merged 9 commits into from
Dec 19, 2022

Conversation

mbostock
Copy link
Member

@mbostock mbostock commented Nov 22, 2016

Fixes #10, taking option 2.

Fil
Fil previously approved these changes Jun 6, 2019
src/path.js Outdated Show resolved Hide resolved
@mbostock
Copy link
Member Author

mbostock commented Jun 7, 2019

I’m pretty sure we don’t want to introduce the overhead of calling the identity function in the common case, which means a lot of code duplication.

@Fil Fil requested review from Fil and removed request for Fil June 11, 2019 19:05
@Fil Fil dismissed their stale review June 11, 2019 19:07

issue of overhead vs duplication

@Fil
Copy link
Member

Fil commented Jun 1, 2020

Now trying to call this._format as parsimoniously as possible; in the standard case _format return +x. I hope this limits the overhead.

(I'll review the git pseudo-conflicts situation if the approach seems acceptable.)

README.md Outdated Show resolved Hide resolved
@mbostock
Copy link
Member Author

mbostock commented Jun 1, 2020

I think of format as something that takes a number and returns a string. Relying on format to return a number (and taking arbitrary input) suggests that “format” is the wrong name.

Did you overwrite the original commits?

@Fil
Copy link
Member

Fil commented Jun 1, 2020

Hmm it looks like I force-pushed over your original commit ( 7b1c410 ) in June 2019, after a rebase.

@Fil
Copy link
Member

Fil commented Jun 4, 2020

should we name this function this._number?

@Fil
Copy link
Member

Fil commented Jul 10, 2020

yet another rebase, sorry—this has me struggling

Reference commits are: 7b1c410 (original) and 2897aa6 (rebase against branch two)

@Fil Fil added the feature label Jul 10, 2020
@Fil Fil mentioned this pull request Apr 27, 2021
4 tasks
@mbostock mbostock requested a review from Fil December 17, 2022 23:05
@mbostock
Copy link
Member Author

I’ve updated this to take a cleaner approach using an internal tagged template literal, and changed d3.pathFixed so that it defaults digits to three (which matches number.toLocaleString and seems like a very reasonable default). I think this is ready to go.

Copy link
Member

@Fil Fil left a comment

Choose a reason for hiding this comment

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

love the templating approach!

@mbostock mbostock mentioned this pull request Dec 18, 2022
@mbostock mbostock changed the title Add d3.pathFixed. Dec 19, 2022
@mbostock mbostock requested a review from Fil December 19, 2022 05:18
@mbostock
Copy link
Member Author

The latest commit switches to rounding per performance recommendations in #10 and d3/d3-geo#272 (comment).

Copy link
Member

@Fil Fil left a comment

Choose a reason for hiding this comment

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

🏇

@mbostock mbostock mentioned this pull request Dec 19, 2022
@mbostock mbostock merged commit da5c99c into main Dec 19, 2022
@mbostock mbostock deleted the fixed branch December 19, 2022 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 participants