GithubHelp home page GithubHelp logo

Comments (2)

mbostock avatar mbostock commented on April 25, 2024

See d3/d3-shape#23, and earlier, d3/d3#1145.

In the past, I tried to preserve the type as it was set, mostly to facilitate debugging. So, if the value was set as a constant, it would be returned as a constant. In 4.0, I think I generally standardized on always promoting constants to functions. The path.pointRadius is treated a little specially because it can be optimized to set contextStream.pointRadius once if the radius is a constant, rather than always boxing it with a function. That avoids initializing the circle string (see path/string.js) for rendering each feature, but a better optimization would be to initialize the circle string lazily.

I’d probably be okay with changing the behavior without a major release, as the documentation does say that it returns the “current radius accessor” and not the “current radius”, and so this should probably be considered a bug. But yes, there’s a chance this could break something, and it doesn’t seem hugely important either way. 😁

from d3-geo.

tomwanzek avatar tomwanzek commented on April 25, 2024

Thanks, like I said, I thought you might have had a reason. So I leave it up to you to find the best fit for this particular accessor (rather than just blindly following a pattern.) I have just pushed updated d3-geo definitions (1.3.1) to DefinitelyTyped. So once they are merged/published everything is in synch with D3 proper.

The definitions in this latest version return a union-type of either number or "accessor function signature". If the module changes we can change that as well.

I am considering a follow-up commit/PR anyway, because I might want to break-out the composite projection interface from the more complete projection interface (i.e. the unsupported methods).

from d3-geo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.