layerchart 0.7.4 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/utils/scales.js +1 -1
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "author": "Sean Lynch <techniq35@gmail.com>",
4
4
  "license": "MIT",
5
5
  "repository": "techniq/layerchart",
6
- "version": "0.7.4",
6
+ "version": "0.7.5",
7
7
  "devDependencies": {
8
8
  "@rollup/plugin-dsv": "^2.0.3",
9
9
  "@sveltejs/adapter-vercel": "^1.0.0-next.59",
package/utils/scales.js CHANGED
@@ -14,7 +14,7 @@ import { motionStore } from '../stores/motionStore';
14
14
  export function scaleBandInvert(scale) {
15
15
  const domain = scale.domain();
16
16
  const eachBand = scale.step();
17
- const paddingOuter = eachBand * scale.paddingOuter(); // scale(domain[0]);
17
+ const paddingOuter = eachBand * (scale.paddingOuter?.() ?? scale.padding()); // `scaleBand` uses paddingOuter(), while `scalePoint` uses padding() for outer paddding - https://github.com/d3/d3-scale#point_padding
18
18
  return function (value) {
19
19
  // TODO: Should this use Math.round to better select? https://stackoverflow.com/questions/38633082/d3-getting-invert-value-of-band-scales/50846323#comment104743795_50846323
20
20
  const index = Math.floor((value - paddingOuter) / eachBand);