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

"--invert false" setting doesn't work #209

Closed
rufushuang opened this issue Nov 6, 2014 · 2 comments
Closed

"--invert false" setting doesn't work #209

rufushuang opened this issue Nov 6, 2014 · 2 comments

Comments

@rufushuang
Copy link

Is it caused by the 'optimist' doesn't support 'auto' on 'boolean' type?

    .options("invert", {
      describe: "in conjunction with --width or --height, whether to invert y",
      type: "boolean",
      default: "auto"
    })

when '--invert false' is set, the argv.invert changes to be an array insteadof a string

argv.invert == ['auto', false];

This can be reviewed as following code change to bin\topojson

      console.log("1:"); console.log(argv.invert);
      if (argv.invert.length !== undefined) argv.invert = argv.invert[argv.invert.length - 1]
      console.log("2:"); console.log(argv.invert);
      if (argv.invert === "auto") argv.invert = !argv.projection;
      console.log("3:"); console.log(argv.invert);

Add argv.invert = argv.invert[argv.invert.length - 1] can fix the 'true'/'false' setting, but it makes 'auto' setting useless.

@rufushuang
Copy link
Author

or should we deal with the array-ed invert option in
'lib/topojson/scale.js'

12 "margin" in options && (margin = +options["margin"]),
13 "invert" in options && (invert = !!options["invert"]);

fix it in line 13 instead?

@mbostock
Copy link
Member

The --invert functionality is moving to d3-geo-projection’s geoscale in 2.0, and I’ll be using commander instead of optimist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants